summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_ntptime.c
Commit message (Collapse)AuthorAgeFilesLines
* Introduce the sysclock_getsnapshot() and sysclock_snap2bintime() KPIs. Thelstewart2011-12-241-2/+2
| | | | | | | | | | | | | | | | | | | | sysclock_getsnapshot() function allows the caller to obtain a snapshot of all the system clock and timecounter state required to create time stamps at a later point. The sysclock_snap2bintime() function converts a previously obtained snapshot into a bintime time stamp according to the specified flags e.g. which system clock, uptime vs absolute time, etc. These KPIs enable useful functionality, including direct comparison of the feedback and feed-forward system clocks and generation of multiple time stamps with different formats from a single timecounter read. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ In collaboration with: Julien Ridoux (jridoux at unimelb edu au)
* Document a large number of currently undocumented sysctls. While hereeadler2011-12-131-5/+9
| | | | | | | | | | | | fix some style(9) issues and reduce redundancy. PR: kern/155491 PR: kern/155490 PR: kern/155489 Submitted by: Galimov Albert <wtfcrap@mail.ru> Approved by: bde Reviewed by: jhb MFC after: 1 week
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-3/+3
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/netchild2011-02-251-0/+4
| | | | | | | | | | | | | PMC/SYSV/...). No FreeBSD version bump, the userland application to query the features will be committed last and can serve as an indication of the availablility if needed. Sponsored by: Google Summer of Code 2010 Submitted by: kibab Reviewed by: arch@ (parts by rwatson, trasz, jhb) X-MFC after: to be determined in last commit with code from this project
* Fix up a few more sysctl(9) mis-typing found in various LINT builds.mdf2011-01-131-1/+2
|
* there must be only one SYSINIT with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY orderavg2010-09-301-1/+1
| | | | | | | | | | | | | | | SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY should only be used to call scheduler() function which turns the initial thread into swapper proper and thus there is no further SYSINIT processing. Other SYSINITs with SI_SUB_RUN_SCHEDULER+SI_ORDER_ANY may get ordered after scheduler() and thus never executed. That particular relative order is semi-arbitrary. Thus, change such places to use SI_ORDER_MIDDLE. Also, use SI_ORDER_MIDDLE instead of correct, but less appealing, SI_ORDER_ANY - 1. MFC after: 1 week
* kern_ntptime: drop a comment that became stale after r207359avg2010-04-291-4/+0
| | | | | MFC after: 1 week X-MFC after: r207359
* periodically save system time to hardware time-of-day clockavg2010-04-291-0/+65
| | | | | | | | | | | | | | | This is done in kern_ntptime, perhaps not the best place. This is done using resettodr(). Some features: - make save period configurable via tunable and sysctl - period of zero disables saving, setting a non-zero period re-enables it or reschedules it - do saving only if system clock is ntp-synchronized - save on shutdown Discussed with: des, Peter Jeremy <peterjeremy@acm.org> X-Maybe: save time near seconds boundary for better precision MFC after: 2 weeks
* kern_ntptime: abstract time error check into a functionavg2010-04-291-23/+27
| | | | | | ... to avoid code duplication MFC after: 1 week
* In keeping with style(9)'s recommendations on macros, use a ';'rwatson2008-03-161-1/+1
| | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink
* Only require privilege to set the current time adjustment, not in order torwatson2007-06-141-5/+7
| | | | query it.
* Further system call comment cleanup:rwatson2007-03-051-6/+6
| | | | | | | | | | - Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde) - Remove extra blank lines in some cases. - Add extra blank lines in some cases. - Remove no-op comments consisting solely of the function name, the word "syscall", or the system call name. - Add punctuation. - Re-wrap some comments.
* Remove 'MPSAFE' annotations from the comments above most system calls: allrwatson2007-03-041-6/+0
| | | | | | | | system calls now enter without Giant held, and then in some cases, acquire Giant explicitly. Remove a number of other MPSAFE annotations in the credential code and tweak one or two other adjacent comments.
* When ntp_gettime() was converted from a sysctl + wrapper to a systemimp2007-01-121-0/+1
| | | | | | | | | | | | call, its semantics were unintentionally changed. It went from returning the time state to returning 0 or -1. Since 0 means time normal, and non-zero effectively only shows up around leap seconds, this went unnoticed until now. At least unnoticed until someone was trying to run a binary they didn't have source for and it was misbehaving... Submitted by: Judah Levine MFC After: 2 weeks
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-2/+3
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Explicitly acquire Giant around the ntp_gettime() and assert it in therwatson2005-05-281-0/+4
| | | | | | | sysctl path. While this code is close to MPSAFE, it may require some additional locking. Mark ntp_gettime1() as GIANT_REQUIRED for now. Suggested by: phk
* Implement kern_adjtime(), kern_readv(), kern_sched_rr_get_interval(),jhb2005-03-311-11/+25
| | | | | kern_settimeofday(), and kern_writev() to allow for further stackgap reduction in the compat ABIs.
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+2
|
* Place function comment above the right function.marks2004-11-191-7/+7
|
* Add system call implementation of ntp_gettime(2).marks2004-11-181-18/+43
| | | | | | | | Moved most of the work to ntp_gettime1(), which is now called by ntp_gettime() and ntp_sysctl(). Reviewed by: imp, phk, njl, peter Approved by: njl
* Annual NTP kernel code spring-cleaning:phk2004-03-141-8/+11
| | | | | | Use int64_t rather than long long for the fixpoint type. Don't discard fractional nanosecond frequency correction.
* Deal with MOD_FREQUENCY before MOD_OFFSET because the latter is thephk2004-01-241-6/+6
| | | | | | one which runs the actual update. This fixes a bug where there were a delay in applying the frequency adjustment. In extreme cases this could result in marginal stability of the kernel-pll.
* During a positive leap second, the tai_time offset should beimp2003-06-251-1/+1
| | | | | | | | | | | incremented at the start of the leap second, not after the leap second has been inserted. This is because at the start of the leap second, we set the time back one second. This setting back one second is the moment that the offset changes. The old code set it back after the leap second, but that's one second too late. The negative leap second case is handled correctly. Reviewed by: phk
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Explicitly have the timecounter init happen after the cpu_initclocks ispeter2003-01-061-1/+1
| | | | | | | | | called. Otherwise (depending on a non-deterministic sort), the timecounter code can be initialized before the clock rate has been set (on ia64) and it assumes hz = 100, rather than the real value of 1024. I'm not sure how much gets upset by this. Glanced at by: phk
* 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
|
OpenPOWER on IntegriCloud