summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_ntptime.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove an unused variable.phk2002-10-111-7/+0
|
* Hide the private parts of timecounter from a couple of places that don'tphk2002-04-261-4/+2
| | | | really need to know the gory details.
* suser is Giant safe, so optimize a pointless case.phk2002-04-191-3/+3
|
* Remove two debug printfs which should never have been committed.phk2002-04-151-4/+0
|
* You have to cast int64_t's to long long if you printf them with %lld.jhb2002-04-151-2/+2
| | | | | | This now compiles on alpha without a warning. Pointy-hat to: phk
* Improve the implementation of adjtime(2).phk2002-04-151-0/+74
| | | | | | | | | | | | | | | | | | | | | | | Apply the change as a continuous slew rather than as a series of discrete steps and make it possible to adjust arbitraryly huge amounts of time in either direction. In practice this is done by hooking into the same once-per-second loop as the NTP PLL and setting a suitable frequency offset deducting the amount slewed from the remainder. If the remaining delta is larger than 1 second we slew at 5000PPM (5msec/sec), for a delta less than a second we slew at 500PPM (500usec/sec) and for the last one second period we will slew at whatever rate (less than 500PPM) it takes to eliminate the delta entirely. The old implementation stepped the clock a number of microseconds every HZ to acheive the same effect, using the same rates of change. Eliminate the global variables tickadj, tickdelta and timedelta and their various use and initializations. This removes the most significant obstacle to running timecounter and NTP housekeeping from a timeout rather than hardclock.
* In the ntp_adjtime(2) syscall, return our actual estimate of unappliedphk2002-04-151-2/+2
| | | | offset correction instead of the most recent offset applied.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Revise timercounters to use binary fixed point format internally.phk2002-02-071-1/+1
| | | | | | | | | | | | | | The binary format "bintime" is a 32.64 format, it will go to 64.64 when time_t does. The bintime format is available to consumers of time in the kernel, and is preferable where timeintervals needs to be accumulated. This change simplifies much of the magic math inside the timecounters and improves the frequency and time precision by a couple of bits. I have not been able to measure a performance difference which was not a tiny fraction of the standard deviation on the measurements.
* KSE Milestone 2julian2001-09-121-4/+4
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Pushdown Giant for: profil(), ntp_adjtime(), ogethostname(),dillon2001-09-011-4/+13
| | | | osethostname(), ogethostid(), osethostid()
* Update to the 2001-04-02 version of the nanokernel code from Dave Mills.jhay2001-04-161-22/+28
|
* Updates to the ntp pll from John Hay.phk2000-09-101-5/+5
| | | | Submitted by: jhay
* Update the NTP kernel PLL code to the 2000-08-29 version of Dave Millsphk2000-09-041-88/+81
| | | | | | nanokernel. The FreeBSD private mode hardpps Type 2 PLL has been removed.
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-1/+1
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-1/+1
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Isolate the Timecounter internals in their own two files.phk2000-03-201-0/+1
| | | | | | | | | | | | | | | Make the public interface more systematically named. Remove the alternate method, it doesn't do any good, only ruins performance. Add counters to profile the usage of the 8 access functions. Apply the beer-ware to my code. The weird +/- counts are caused by two repocopies behind the scenes: kern/kern_clock.c -> kern/kern_tc.c sys/time.h -> sys/timetc.h (thanks peter!)
* Add a couple of strategic sysctls for monitoring.phk2000-01-231-4/+30
| | | | | In the rather obscure case of hardpps(), use a type-II PLL if the external signal is phase locked, but a FLL if it isn't.
* Create a separate pps_offset variable to use for applying thephk2000-01-041-1/+8
| | | | | | | | | | | hardpps() produced offset component. This is tested and behaved stable with frequency offsets from -338.05 to +499.91 PPM. Interestingly the machine I tested this on would fail if the clock were slower than 14.3132 MHz whereas it was perfectly happy to run at 16.384 MHz, in other words [-340PPM ... +14.4%] Make pps_shift tweakable with sysctl.
* Don't use time_offset as a leaky bucket variable in hardpps(), thisphk1999-12-291-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | resulted in vastly optimistic offset values reported to userland (typically a factor 40+ too small). Apart from that, the code had two sign-bugs. Apply the hardpps() phase with the right sign with a simply scaling by integration interval. (This may be too stiff at long integration intervals, see below). Allow pps_shiftmax to be reduced again. Before this, the phase lock in hardpps() were broken, but due to two bugs mostly cancelling out, it would end up basically working with a large stochastic component. Now it behaves as one would expect: smooth and quiet. It seems that pps_shiftmax above 7..9 somewhere makes the phaselock too weak to hold onto random walk phase errors from a HP-105 OCXO, which basically means that it is too weak for real-life use with such integration times. This is yet to be resolved. Submitted to: Prof. Dave "NTP" Mills. Tested by: Terje Mathisen <Terje.Mathisen@hda.hydro.com>
* pps_shiftmax only exists #ifdef PPS_SYNCphk1999-08-301-0/+2
| | | | Found by: Roger Hardiman <roger@cs.strath.ac.uk>
* Update to the latest nanokernel from Dave Mills.phk1999-08-301-106/+94
|
* Suser() simplification:phk1999-04-271-1/+1
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Fix a division which I had made a multiplication.phk1999-04-041-3/+5
| | | | | | Fix return value from ntp_adjtime(). Submitted by: jhay
* Dang, lost some LL's there.phk1999-04-041-3/+3
|
* Update to latest version from Dave Mills. Mostly textual.phk1999-04-041-27/+49
|
* Make the same size rounding error both ways.phk1999-03-221-1/+1
|
* Don't run FLL fodder through the median-filter.phk1999-03-161-16/+10
| | | | | Reduce max integration time to 128sec and use 50% exponential decay rather than 256sec/25%.
* Allow !suser() R/O access to ntp_adjtime()phk1999-03-151-1/+2
| | | | Noticed by: Reg Clemens <reg@dwf.com>
* Make even more of the PPSAPI implementations generic.phk1999-03-111-44/+7
| | | | | | | | FLL support in hardpps() Various magic shuffles and improved comments Style fixes from Bruce.
* Integrate the new "nanokernel" PLL from Dave Mills.phk1999-03-081-644/+638
| | | | | | | This code is backwards compatible with the older "microkernel" PLL, but allows ntpd v4 to use nanosecond resolution. Many other improvements. PPS_SYNC and hardpps() are NOT supported yet.
* Introduce std_pps_ioctl() to automagically DTRT.phk1998-06-131-16/+61
| | | | Add scaling capability to timex.offset, ntpd-4.0.73 will support this.
* Add a tc_ prefix to struct timecounter members.phk1998-06-091-2/+2
| | | | Urged by: bde
* Eradicate the variable "time" from the kernel, using various measures.phk1998-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
* Replace TOD clock code with more systematic approach.phk1998-02-201-24/+27
| | | | | | | | | | | | | | | Highlights: * Simple model for underlying hardware. * Hardware basis for timekeeping can be changed on the fly. * Only one hardware clock responsible for TOD keeping. * Provides a real nanotime() function. * Time granularity: .232E-18 seconds. * Frequency granularity: .238E-12 s/s * Frequency adjustment is continuous in time. * Less overhead for frequency adjustment. * Improves xntpd performance. Reviewed by: bde, bde, bde
* unifdef -UEXT_CLOCK fdef -UEXT_CLOCK, it is irrelevant.phk1998-02-151-21/+3
| | | | Fix a couple of nits from bde while here anyway.
* Make POWERFAIL_NMI, PPS_SYNC and NATM new style options.eivind1998-01-311-0/+3
| | | | This also fixes a couple of defunct options; submitted by bde.
* Move almost all the ntp related stuff from kern_clock.c tophk1998-01-141-21/+575
| | | | | | kern_ntptime.c. The only bit left over is that which is executed in all calls to hardclock(). Various cleanups and staticizing along the road.
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-6/+6
| | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled.
* Update our kernel ntp code to the latest from David Mills. The main changejhay1996-12-301-1/+4
| | | | | is the addition of the FLL code, which is used by the latest versions of xntpd. The kernel PPS code is also updated, although I can't test that yet.
* Removed unnecessary #includes of vm stuff. Most of them were oncebde1995-12-061-1/+0
| | | | | | | prerequisites for <sys/sysctl.h>. subr_prof.c: Also replaced #include of <sys/user.h> by #include of <sys/resourcevar.h>.
* A major sweep over the sysctl stuff.phk1995-12-041-1/+1
| | | | | | | | | | | | | Move a lot of variables home to their own code (In good time before xmas :-) Introduce the string descrition of format. Add a couple more functions to poke into these marvels, while I try to decide what the correct interface should look like. Next is adding vars on the fly, and sysctl looking at them too. Removed a tine bit of defunct and #ifdefed notused code in swapgeneric.
* Move KERN_NTP to a more suitable file.phk1995-11-141-13/+8
|
* Included <sys/sysproto.h> to get central declarations for syscall argsbde1995-11-121-0/+3
| | | | | | | | | | structs and prototypes for syscalls. Ifdefed duplicated decentralized declarations of args structs. It's convenient to have this visible but they are hard to maintain. Some are already different from the central declarations. 4.4lite2 puts them in comments in the function headers but I wanted to avoid the large changes for that.
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
|
* Add vm/vm.h for complete sysctl type.ache1994-09-191-1/+1
| | | | | Remove wrong time declaration, already have correct in kernel.h (kern_ntptime not compiled without this changes)
* Reversed last revision which was a mistake.dfr1994-09-191-1/+0
|
* Added msdosfs.dfr1994-09-191-0/+1
| | | | Obtained from: NetBSD
* Redo Kernel NTP PLL support, kernel side.wollman1994-09-181-0/+269
This code is mostly taken from the 1.1 port (which was in turn taken from Dave Mills's kern.tar.Z example). A few significant differences: 1) ntp_gettime() is now a MIB variable rather than a system call. A few fiddles are done in libc to make it behave the same. 2) mono_time does not participate in the PLL adjustments. 3) A new interface has been defined (in <machine/clock.h>) for doing possibly machine-dependent things around the time of the clock update. This is used in Pentium kernels to disable interrupts, set `time', and reset the CPU cycle counter as quickly as possible to avoid jitter in microtime(). Measurements show an apparent resolution of a bit more than 8.14usec, which is reasonable given system-call overhead.
OpenPOWER on IntegriCloud