Commit Graph

46 Commits

Author SHA1 Message Date
martin
083fcd5d58 ifdef a variable like its use 2013-09-14 20:52:43 +00:00
kardel
effe57d37e Extend kernel PPS api with pps_ref_event().
pps_ref_event() allows capturing PPS time stamps
that are not generated at precisely 1Hz (e. g.
by reading a precision clock via callout()).

This extension allows clock drivers to supply PPS
time-stamps and drive the kernel NTP PLL
without the overhead of interrupt-handling and
-processing.
2013-05-26 18:07:42 +00:00
pooka
e51fe9c308 kill some -Wunused-but-set-variable warnings 2012-11-13 20:10:02 +00:00
martin
1e37a35ef0 Make time_second and time_uptime volatile, so the compiler knows they
may change during loops. Fixes the macppc build, which previously
died with:
src/sys/arch/macppc/dev/dbdma.c:62:6: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false
2012-02-21 15:41:24 +00:00
pooka
794d5a7111 _KERNEL_OPT 2010-04-13 22:46:10 +00:00
uebayasi
2903e6d834 __inline -> inline 2010-02-06 12:10:59 +00:00
kardel
a888100516 Make PPS work with fast time counters (> 2GHz)
by making the pps count time stamp and the update
time stamp u_int64.
The time delta between two PPS events can now
be correctly calculated avoiding any unaccounted
for wraps with 32-bit counters.
2009-06-14 13:16:32 +00:00
ad
2fc2b08001 - Add lwp_pctr(), get an LWP's preemption/ctxsw counter.
- Fix a preemption bug in CURCPU_IDLE_P() that can lead to a bogus
  assertion failure on DEBUG kernels.
- Fix MP/preemption races with timecounter detachment.
2009-05-23 17:08:04 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
kardel
ccab995bc6 Initialize timecounter_lock at IPL_HIGH. Prevents a "locking against myself"
when com.c (options PPS_SYNC) delivers a PPS time stamp during clock
interupt processing.
2008-07-19 10:33:58 +00:00
ad
32c5d76875 Fix locking botch. Pointed out by kardel@. 2008-05-11 14:42:18 +00:00
ad
541e4662f9 - Add tc_gonebad(): allows timecounter to be flagged as bad and removed at
the next clock tick.
- Remove time_lock, which is no longer required.
2008-05-08 18:56:58 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad
a2249ef75c Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE. 2008-04-21 12:56:30 +00:00
ad
59c1cd1667 Disable the event counters by default, since they create terrible cache
behaviour on MP systems.
2008-02-10 13:56:17 +00:00
joerg
3615cf7715 Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
2008-01-20 18:09:03 +00:00
ad
63baaccb6d Serialize calls to tc_windup(). 2008-01-05 18:00:37 +00:00
dyoung
a72fb242fe Add tc_detach() for detaching a timecounter. It is good enough to
detach the AMD Geode SC1100 27 MHz clock, geodecntr(4), but there
may be synchronization problems on MP machines.
2008-01-03 04:42:13 +00:00
yamt
5755384fd5 fix a comment. 2007-12-15 18:20:11 +00:00
ad
b470ab628d Use membar_*(). 2007-11-30 23:05:43 +00:00
elad
18558073a1 Kill another instance of KAUTH_GENERIC_ISSUSER. 2007-11-23 16:03:47 +00:00
ad
85a2e7d924 Work around broken MD headers. 2007-11-16 01:21:24 +00:00
ad
ab19d73932 Kill the memory barriers: force users of the outgoing timehand to move
on quickly by also incrementing its generation number.
2007-11-15 23:16:55 +00:00
ad
d3c8987b25 Oops; fix thinko. 2007-11-15 22:28:05 +00:00
ad
0239b151ae Add a bit of locking around timecounter attachment / selection. 2007-11-15 20:12:04 +00:00
simonb
e7d1e5e9ea Adjust a comment. In NetBSD the time-related kernel function prototypes
are in <sys/timevar.h>, not <sys/time.h> like they are in FreeBSD.
2007-10-21 14:55:09 +00:00
ad
26c3495f7d Timecounters are lockless. Add conservative memory barriers to ensure that
loads and stores occur in the correct order.
2007-08-17 21:20:24 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
elad
1e70d64818 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 16:55:29 +00:00
yamt
1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
kardel
d094ff8f40 Avoid printf() the selected timecounter as it is called in the path of hardclock().
The information is available via sysctl anyway.
2006-10-21 07:16:54 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
kardel
182632b893 Reduce hardclock() code path length wrt/ multiply/divide by
re-calculating the th_scale value only when necessary.
As discussed with gdamore@. Tested at (sub-)usec level with
stratum 1 reference.
2006-09-24 06:39:28 +00:00
tsutsui
3134621b5b Fix splclock()/splx() mismatch in previous. 2006-09-10 08:09:46 +00:00
simonb
a6e21ef05b Guard the timecounter manipulations including the call to tc_windup()
in tc_init() with splclock().  Fixes doubled-up "selected timecounter"
messages on some architectures, including pc532 and cobalt.

Fix suggested by Frank Kardel.
2006-09-07 15:48:14 +00:00
christos
28ea22fb52 use c99 initializers, per gimpy's request 2006-09-03 06:40:39 +00:00
kardel
e23bdf3c6e move MAX_TCNAMELEN into timetc.h, use constant in tmp buffer allocation 2006-09-02 13:45:04 +00:00
christos
bdd0dbdf82 add missing initializers 2006-09-02 06:35:12 +00:00
bjh21
47ef6bac03 Using humanize_number() on clock speeds does more harm than good, and
precious little of either.  Go back to displaying them with all their digits.
2006-08-06 13:29:42 +00:00
bjh21
fc39059504 Clock frequencies tend to be big numbers -- use humanize_number() when
displaying them through printf.
2006-08-05 21:59:40 +00:00
ad
f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
kardel
7e5391a22a rename boottimebin to timebasebin as this
struct actually keeps the start of the UTC
time scale and not the boot time. the relationship
is: utc-time = up-time + timebase.
background: when doing an ACPI sleep the uptime
freezes and on wakeup the tc_setclock() leads to
a new timebasebin - this had no relationship with
a boottime as the structure was previously called.

discussed on tech-kern@
anomalies (moving boottime, uptime describing running time)
where discovered by Arnaud Lacombe.
2006-07-14 23:01:12 +00:00
kardel
54cd6fafa8 re-order initialization sequence to have real counters available during autoconfig 2006-06-09 22:47:56 +00:00
kardel
de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
simonb
769d33c547 Import main FreeBSD timecounter support files as of 4th Feb 2006. 2006-02-04 08:06:23 +00:00