aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_tc.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Make the dummy timecounter actually tick or we will never get anyhere.Poul-Henning Kamp2002-04-271-1/+1
| | | | Notes: svn path=/head/; revision=95549
* Now that the private parts of timecounters are no longer being fingeredPoul-Henning Kamp2002-04-261-143/+109
| | | | | | | | | | | | | | | | by other bits of code, split struct timecounter into two. struct timecounter contains just the bits which pertains to the hardware counter and the reading of it. struct timehands (as in "the hands on a clock") contains all the ugly bit fidling stuff. Statically compile ten timehands. This commit is the functional part. A later cosmetic patch will rename various variables and fieldnames. Notes: svn path=/head/; revision=95530
* Hide the private parts of timecounter from a couple of places that don'tPoul-Henning Kamp2002-04-261-4/+10
| | | | | | | really need to know the gory details. Notes: svn path=/head/; revision=95529
* Simplify the RFC2783 and PPS_SYNC timestamp collection API.Poul-Henning Kamp2002-04-261-16/+37
| | | | Notes: svn path=/head/; revision=95523
* Move the winding of timecounters out of hardclock and into a normalPoul-Henning Kamp2002-04-261-1/+39
| | | | | | | | | | | | timeout loop. Limit the rate at which we wind the timecounters to approx 1000 Hz. This limits the precision of the get{bin,nano,micro}[up]time(9) functions to roughly a millisecond. Notes: svn path=/head/; revision=95497
* Various cleanup and sorting of clock reading functions. Add the twoPoul-Henning Kamp2002-04-261-71/+79
| | | | | | | functions missing in the complete 12 function complement. Notes: svn path=/head/; revision=95491
* Rename tco_setscales() and tco_delta() to use the same tc_ prefix asPoul-Henning Kamp2002-04-261-11/+8
| | | | | | | the rest of this file. Notes: svn path=/head/; revision=95490
* Remove the tc_update() function. Any frequency change to thePoul-Henning Kamp2002-04-261-6/+0
| | | | | | | | | timecounter will be used starting at the next second, which is good enough for sysctl purposes. If better adjustment is needed the NTP PLL should be used. Notes: svn path=/head/; revision=95489
* Improve the implementation of adjtime(2).Poul-Henning Kamp2002-04-151-19/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=94754
* Get the magnitude of the NTP adjustment right.Poul-Henning Kamp2002-03-281-3/+4
| | | | Notes: svn path=/head/; revision=93343
* Remove __P.Alfred Perlstein2002-03-191-2/+2
| | | | Notes: svn path=/head/; revision=92723
* Remove unused variable.Poul-Henning Kamp2002-02-261-1/+0
| | | | Notes: svn path=/head/; revision=91290
* Add a generation number to timecounters and spin if it changes underPoul-Henning Kamp2002-02-241-37/+62
| | | | | | | | | | | | | | | our feet when we look inside timecounter structures. Make the "sync_other" code more robust by never overwriting the tc_next field. Add counters for the bin[up]time functions. Call tc_windup() in tc_init() and switch_timecounter() to make sure we all the fields set right. Notes: svn path=/head/; revision=91200
* Use better scaling factor for NTPs correction.Poul-Henning Kamp2002-02-221-1/+7
| | | | | | | Explain the magic. Notes: svn path=/head/; revision=91065
* Revise timercounters to use binary fixed point format internally.Poul-Henning Kamp2002-02-071-108/+60
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=90362
* Let the number of timecounters follow hz, otherwise people withPoul-Henning Kamp2002-02-051-2/+3
| | | | | | | | | | | | | | | | HZ=BIGNUM will strain the assumptions behind timecounters to the point where they break. This may or may not help people seeing microuptime() backwards messages. Make the global timecounter variable volatile, it makes no difference in the code GCC generates, but it makes represents the intent correctly. Thanks to: jdp MFC after: 2 weeks Notes: svn path=/head/; revision=90260
* Be more conservative about interrupt latency, it aint getting better it seems.Poul-Henning Kamp2002-01-251-2/+2
| | | | Notes: svn path=/head/; revision=89801
* Remove a bogus #ifdef KTR stanza.Poul-Henning Kamp2001-01-011-7/+0
| | | | | | | Noticed by: Alexander Langer <alex@big.endian.de> Notes: svn path=/head/; revision=70574
* Major update to the way synchronization is done in the kernel. HighlightsJason Evans2000-09-071-1/+8
| | | | | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh Notes: svn path=/head/; revision=65557
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.Poul-Henning Kamp2000-07-041-1/+1
| | | | | | | Pointed out by: bde Notes: svn path=/head/; revision=62573
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:Poul-Henning Kamp2000-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) Notes: svn path=/head/; revision=62454
* Isolate the Timecounter internals in their own two files.Poul-Henning Kamp2000-03-201-477/+54
| | | | | | | | | | | | | | | | | | 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!) Notes: svn path=/head/; revision=58377
* Fix sign reversal in adjtime(2).Poul-Henning Kamp2000-02-131-1/+1
| | | | | | | Approved by: jkh Notes: svn path=/head/; revision=57182
* Make adjtime(2) adjust boottime so it doesn't cause non-monotonousPoul-Henning Kamp1999-12-081-2/+11
| | | | | | | uptime. Notes: svn path=/head/; revision=54299
* Fixed some comments in statclock(). The previous commit made it clearerBruce Evans1999-11-271-8/+8
| | | | | | | that one comment was attached to null code. Notes: svn path=/head/; revision=53751
* Moved scheduling-related code to kern_synch.c so that it is easier to fixBruce Evans1999-11-271-21/+1
| | | | | | | | | | | and extend. The new function containing the code is named schedclock() as in NetBSD, but it has slightly different semantics (it already handles incrementation of p->p_cpticks, and it should handle any calling frequency). Agreed with in principle by: dufault Notes: svn path=/head/; revision=53745
* #ifdef PPS_SYNC around "kapi" declaration to fix a -Wunused warning.Peter Wemm1999-10-101-0/+2
| | | | Notes: svn path=/head/; revision=52097
* Update the PPSAPI to draft-mogul-pps-api-05.txt which is the latest.John Hay1999-10-091-42/+54
| | | | | | | | | NOTE: This will break building ntpd until ntpd has been upgraded to also support draft 05. People that want to build ntpd in the meantime can get patches from me. Notes: svn path=/head/; revision=52061
* Moved the definition of `boottime' and its sysctl to the correct file.Bruce Evans1999-09-131-0/+4
| | | | Notes: svn path=/head/; revision=51229
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Oops, the previous commit only worked in the one case it was tested for.Bruce Evans1999-07-241-2/+3
| | | | Notes: svn path=/head/; revision=49065
* Added a sysctl "kern.timecounter.hardware" for selecting the hardwareBruce Evans1999-07-181-6/+41
| | | | | | | | | | | | used for timecounting. The possible values are the names of the physically present harware timecounters ("i8254" and "TSC" on i386's). Fixed some nearby bitrot in comments in <sys/time.h>. Reviewed by: phk Notes: svn path=/head/; revision=48887
* Remove four no-op casts.John Polstra1999-07-181-5/+5
| | | | Notes: svn path=/head/; revision=48872
* Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify thePoul-Henning Kamp1999-04-251-3/+9
| | | | | | | | | timecounter as well Asked for by: bde, jhay Notes: svn path=/head/; revision=46054
* Don't open window for race condition.Poul-Henning Kamp1999-04-021-4/+1
| | | | | | | Detected by: Reg Clemens <reg@dwf.com> Notes: svn path=/head/; revision=45245
* Fix an old cut&paste bogon.Poul-Henning Kamp1999-03-121-2/+2
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=44695
* Remove duplicate include.Poul-Henning Kamp1999-03-121-4/+1
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=44685
* Make even more of the PPSAPI implementations generic.Poul-Henning Kamp1999-03-111-52/+147
| | | | | | | | | | | FLL support in hardpps() Various magic shuffles and improved comments Style fixes from Bruce. Notes: svn path=/head/; revision=44666
* Integrate the new "nanokernel" PLL from Dave Mills.Poul-Henning Kamp1999-03-081-5/+2
| | | | | | | | | | 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. Notes: svn path=/head/; revision=44574
* Introduce machine-dependent macro pgtok() to convert page count to numberLuoqi Chen1999-02-191-5/+5
| | | | | | | | of kilobytes. Its definition for each architecture could be optimized to avoid potential numerical overflows. Notes: svn path=/head/; revision=44157
* Hide access to vmspace:vm_pmap with inline function vmspace_pmap(). ThisLuoqi Chen1999-02-191-3/+2
| | | | | | | | | | is the preparation step for moving pmap storage out of vmspace proper. Reviewed by: Alan Cox <alc@cs.rice.edu> Matthew Dillion <dillon@apollo.backplane.com> Notes: svn path=/head/; revision=44146
* Make the previous behaviour the default, add a sysctl which youPoul-Henning Kamp1998-11-291-12/+42
| | | | | | | | | | | | | | | | | can set if your hw/sw produces the "calcru negative..." message. Setting the alternate method (sysctl -w kern.timecounter.method=1) makes the the get{nano|micro}*() functions call the real thing at resulting in a measurable but minor overhead. I decided to NOT have the "calcru" change the method automatically because you should be aware of this problem if you have it. The problems currently seen, related to usleep and a few other corners are fixed for both methods. Notes: svn path=/head/; revision=41415
* Make timecounters more resistant to badly behaved SW/HW which locksPoul-Henning Kamp1998-11-231-10/+18
| | | | | | | | | | | | | | out interrupts for too long. If you still see the "calcru: negative time..." message you can increase NTIMECOUNTER (see LINT). Sideeffect is that a timecounter is required to not wrap around in less than (1 + delta) seconds instead of the (1/hz + delta) required until now. Many thanks to: msmith, wpaul, wosch & bde Notes: svn path=/head/; revision=41306
* Add a kludge to prevent panicing when using VM86 and hitting hereSøren Schmidt1998-11-231-2/+2
| | | | | | | | | with a NULL curproc. Originally by: Tor Egge (IIRC) Notes: svn path=/head/; revision=41305
* Fixed breakage of the GPROF case of statclock() in the previous commit.Bruce Evans1998-10-261-1/+2
| | | | Notes: svn path=/head/; revision=40657
* Nitpicking and dusting performed on a train. Removes trivial warningsPoul-Henning Kamp1998-10-251-3/+2
| | | | | | | about unused variables, labels and other lint. Notes: svn path=/head/; revision=40648
* Change the way we simulate stable storage for timecounters.Poul-Henning Kamp1998-10-231-57/+52
| | | | | | | | | If you have problems with the "calcru" messages and processes being killed for excessive cpu time, try to increase the NTIMECOUNTER #define and report your findings. Notes: svn path=/head/; revision=40609
* Cast the return value of tvtohz() from a long to an int to satisfy theAlexander Langer1998-10-061-2/+2
| | | | | | | | | | compiler that we know what we're doing (the value returned has already been restricted to int ranges). Reviewed by: bde Notes: svn path=/head/; revision=40012
* kern_clock.c:Justin T. Gibbs1998-09-151-18/+2
| | | | | | | | | | Remove old disk statistics variables. vfs_bio.c: Enable bowrite now that B_ORDERED works for all buffer devices. Notes: svn path=/head/; revision=39245
* Removed unused function hzto().Bruce Evans1998-08-051-18/+1
| | | | Notes: svn path=/head/; revision=38129