summaryrefslogtreecommitdiff
path: root/sys/kern/kern_timeout.c
Commit message (Collapse)AuthorAgeFilesLines
* Catch up to header include changes:John Baldwin2001-03-281-0/+1
| | | | | | | | - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h> Notes: svn path=/head/; revision=74914
* Change and clean the mutex lock interface.Bosko Milekic2001-02-091-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order) Notes: svn path=/head/; revision=72200
* Revert the last commit to the callout interface, and add a flag toJonathan Lemon2000-11-251-6/+7
| | | | | | | | | | callout_init() indicating whether the callout is safe or not. Update the callers of callout_init() to reflect the new interface. Okayed by: Jake Notes: svn path=/head/; revision=69147
* - Rename callout_reset to _callout_reset and add a flags argument.Jake Burkholder2000-11-251-2/+4
| | | | | | | | - Add macros callout_reset, which does the obvious, and mp_callout_reset, which passes the CALLOUT_MPSAFE flag. Notes: svn path=/head/; revision=69136
* - Protect the callout wheel with a separate spin mutex, callout_lock.Jake Burkholder2000-11-191-17/+24
| | | | | | | | | | | | | | - Use the mutex in hardclock to ensure no races between it and softclock. - Make softclock be INTR_MPSAFE and provide a flag, CALLOUT_MPSAFE, which specifies that a callout handler does not need giant. There is still no way to set this flag when regstering a callout. Reviewed by: -smp@, jlemon Notes: svn path=/head/; revision=68889
* Release sched_lock very briefly to give interrupts a chance to fire if weJohn Baldwin2000-11-181-0/+2
| | | | | | | | | are in softclock() for a long time. The old code already did an splx()/slphigh() pair here, I just missed adding in the equivalent mutex operations on sched_lock earlier. Notes: svn path=/head/; revision=68869
* The recent changes to msleep() and mawait() resulted in timeout() andJohn Baldwin2000-11-161-1/+16
| | | | | | | | | | | untimeout() not being called with Giant in those functions. For now, use the sched_lock to protect the callout wheel in softclock() and in the various timeout and callout functions. Noticed by: tegge Notes: svn path=/head/; revision=68840
* - Overhaul the software interrupt code to use interrupt threads for eachJohn Baldwin2000-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD. Submitted by: cp Notes: svn path=/head/; revision=67551
* Restructure TCP timeout handling:Jonathan Lemon1999-08-301-9/+9
| | | | | | | | | | | | | - eliminate the fast/slow timeout lists for TCP and instead use a callout entry for each timer. - increase the TCP timer granularity to HZ - implement "bad retransmit" recovery, as presented in "On Estimating End-to-End Network Path Properties", by Allman and Paxson. Submitted by: jlemon, wollmann Notes: svn path=/head/; revision=50673
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Fix callout_init(). This didn't have any practical effect since itGarrett Wollman1999-03-061-2/+2
| | | | | | | | was only used to initialize the static timeouts, which unconditionally clears the only bits which could have caused problems. Notes: svn path=/head/; revision=44527
* Expose a slightly-lower-level interface to timeouts which allows callersGarrett Wollman1999-03-061-24/+96
| | | | | | | | | | | to manage their own memory. Tested on my machine (make buildworld). I've made analogous changes on the alpha, but don't have a machine to test. Not-objected-to by: dg, gibbs Notes: svn path=/head/; revision=44510
* Fixed stale references to hzto() in comments.Bruce Evans1998-05-171-2/+2
| | | | Notes: svn path=/head/; revision=36127
* Declare function pointer args as pointers, not as functions.Bruce Evans1998-02-251-3/+3
| | | | Notes: svn path=/head/; revision=33824
* A bunch of nits from bde.Poul-Henning Kamp1998-02-151-15/+13
| | | | Notes: svn path=/head/; revision=33392
* Make softticks static.Poul-Henning Kamp1998-01-141-35/+2
| | | | | | | Remove unneeded stuff. Notes: svn path=/head/; revision=32512
* Fix softclock calling so we don't loose timeouts (I broke this ~10h ago)Poul-Henning Kamp1998-01-111-6/+2
| | | | Notes: svn path=/head/; revision=32412
* Whoops. softclock is called from doreti_swi as well. Abandon call fromPoul-Henning Kamp1998-01-101-8/+2
| | | | | | | | | | | hardclock(). Forgot this: Pointed hat sent by: bd Notes: svn path=/head/; revision=32391
* Effect the divorce of kern_clock.c and kern_timeout.c (which wasPoul-Henning Kamp1998-01-101-1111/+20
| | | | | | | repository copied from kern_clock.c) Notes: svn path=/head/; revision=32388
* Improve hardpps readability a bit:Poul-Henning Kamp1998-01-071-50/+45
| | | | | | | | * Rename usec to p_usec so you can search for it. * Macroize the huge median_of_3_samples if statement. Notes: svn path=/head/; revision=32323
* This patch causes the "calltodo" timer list to be decremented by the amountNate Williams1997-12-231-1/+68
| | | | | | | | | | | | | | | | | | | | | | | | | of time that the laptop was suspending. Thus, select() calls that might have suspended rather than firing at 1hr + "time suspended" since the timer was posted. Adding: options APM_FIXUP_CALLTODO to the kernel config enables the patch. [ This patch was slightly modified to use a consistant indent style and I removed some unused local variables. After this has been tested a few weeks we'll make the options the default, so for now I'm now documenting it in LINT. Mike can later if he wants. ] Reviewed by: Mike Smith <msmith@freebsd.org> Submitted by: Ken Key <key@cs.utk.edu> Notes: svn path=/head/; revision=31950
* The improvements to clock statistics by Tor EggeSteve Passe1997-12-081-1/+20
| | | | | | | | | | Wrappered and enabled by the define BETTER_CLOCK (on by default in smpyests.h) Reviewed by: smp@csn.net Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> Notes: svn path=/head/; revision=31639
* Removed all traces of P_IDLEPROC. It was tested but never set.Bruce Evans1997-11-241-2/+2
| | | | Notes: svn path=/head/; revision=31393
* Removed unused #include.Bruce Evans1997-11-181-3/+1
| | | | Notes: svn path=/head/; revision=31259
* Remove a bunch of variables which were unused both in GENERIC and LINT.Poul-Henning Kamp1997-11-071-3/+1
| | | | | | | Found by: -Wunused Notes: svn path=/head/; revision=31016
* Store an absolute tick value in callout entries so that a subtraction onJustin T. Gibbs1997-09-241-10/+18
| | | | | | | | | | | hash chain traversal isn't needed. This also allows untimeout to recompute the hash to find the bucket that the entry to remove is stored in so that each callout entry no longer needs to store that information. Reviewed by: Nate Williams <nate@mt.sri.com> Notes: svn path=/head/; revision=29805
* init_main.c subr_autoconf.c:Justin T. Gibbs1997-09-211-81/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for "interrupt driven configuration hooks". A component of the kernel can register a hook, most likely during auto-configuration, and receive a callback once interrupt services are available. This callback will occur before the root and dump devices are configured, so the configuration task can affect the selection of those two devices or complete any tasks that need to be performed prior to launching init. System boot is posponed so long as a hook is registered. The hook owner is responsible for removing the hook once their task is complete or the system boot can continue. kern_acct.c kern_clock.c kern_exit.c kern_synch.c kern_time.c: Change the interface and implementation for the kernel callout service. The new implemntaion is based on the work of Adam M. Costello and George Varghese, published in a technical report entitled "Redesigning the BSD Callout and Timer Facilities". The interface used in FreeBSD is a little different than the one outlined in the paper. The new function prototypes are: struct callout_handle timeout(void (*func)(void *), void *arg, int ticks); void untimeout(void (*func)(void *), void *arg, struct callout_handle handle); If a client wishes to remove a timeout, it must store the callout_handle returned by timeout and pass it to untimeout. The new implementation gives 0(1) insert and removal of callouts making this interface scale well even for applications that keep 100s of callouts outstanding. See the updated timeout.9 man page for more details. Notes: svn path=/head/; revision=29680
* Some staticized variables were still declared to be extern.Bruce Evans1997-09-071-2/+2
| | | | Notes: svn path=/head/; revision=29179
* Removed unused #includes.Bruce Evans1997-09-021-3/+1
| | | | Notes: svn path=/head/; revision=29041
* #include <machine/limits.h> explicitly in the few places that it is required.Bruce Evans1997-08-211-1/+2
| | | | Notes: svn path=/head/; revision=28551
* Add tickadj to struct clockinfo, like NetBSD and OpenBSD.John Hay1997-06-241-1/+2
| | | | | | | NOTE: libc, time, kgmon and rpc.rstatd will have to be recompiled. Notes: svn path=/head/; revision=26897
* Man the liferafts! Here comes the long awaited SMP -> -current merge!Peter Wemm1997-04-261-2/+2
| | | | | | | | | | | | | | | | | | | There are various options documented in i386/conf/LINT, there is more to come over the next few days. The kernel should run pretty much "as before" without the options to activate SMP mode. There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment. This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code! Notes: svn path=/head/; revision=25164
* Restore Bruce's original comment. It seems that "iff" = if and only if,Mike Pritchard1997-03-221-2/+2
| | | | | | | and is not a typo. It is used other places in the kernel, too. Notes: svn path=/head/; revision=24117
* Fix a typo in a comment of a recent commit.Mike Pritchard1997-03-221-2/+2
| | | | Notes: svn path=/head/; revision=24109
* Fixed some invalid (non-atomic) accesses to `time', mostly ones of theBruce Evans1997-03-221-1/+12
| | | | | | | | | form `tv = time'. Use a new function gettime(). The current version just forces atomicicity without fixing precision or efficiency bugs. Simplified some related valid accesses by using the central function. Notes: svn path=/head/; revision=24101
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-1/+1
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Update our kernel ntp code to the latest from David Mills. The main changeJohn Hay1996-12-301-127/+252
| | | | | | | | 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. Notes: svn path=/head/; revision=21101
* Improved biasing of i586 clock by adjusting for hardclock() latency.Bruce Evans1996-10-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | I decided to do this for every hardclock() call instead of lazily in microtime(). The lazy method is simpler but has more overhead if microtime() is called a lot. CPU_THISTICKLEN() is now a no-op and should probably go away. Previously it did nothing directly but had the side effect of setting i586_last_tick for CPU_CLOCKUPDATE() and i586_avg_tick for debugging. CPU_CLOCKUPDATE() now uses a better method and i586_avg_tick is too much trouble to maintain. Reduced nesting of #includes in the usual case. Increased nesting of #includes when CLOCK_HAIR is defined. This is a kludge to get typedefs for inline functions only when the inline functions are used. Normally only kern_clock.c defines this. kern_clock.c can't include the i386 headers directly. Removed unused LOCORE support. Notes: svn path=/head/; revision=19172
* Don't include "opt_cpu.h" in <machine/clock.h>, since this breaks lkm's.Bruce Evans1996-10-101-1/+3
| | | | | | | | The change breaks kern_clock.c; fix that temporarily by including "opt_cpu.h" there. Notes: svn path=/head/; revision=18855
* Fixed resource usage integrals. They were too large by a factor ofBruce Evans1996-07-301-20/+21
| | | | | | | of profhz/stathz when profiling was enabled. Notes: svn path=/head/; revision=17342
* Unstaticize psratio and staticize profprocs. psratio needs to be exportedBruce Evans1996-06-231-5/+6
| | | | | | | to trap.c to fix user profiling. Notes: svn path=/head/; revision=16635
* Staticize.Poul-Henning Kamp1995-12-171-9/+10
| | | | | | | | | | | | | | | Unstaticize a function in scsi/scsi_base that was used, with an undocumented option. My last count on the LINT kernel shows: Total symbols: 3647 unref symbols: 463 undef symbols: 4 1 ref symbols: 1751 2 ref symbols: 485 Approaching the pain threshold now. Notes: svn path=/head/; revision=12913
* Untangled the vm.h include file spaghetti.David Greenman1995-12-071-1/+6
| | | | Notes: svn path=/head/; revision=12662
* A couple of minor tweaks to the sysctl stuff.Poul-Henning Kamp1995-12-061-2/+2
| | | | Notes: svn path=/head/; revision=12650
* A major sweep over the sysctl stuff.Poul-Henning Kamp1995-12-041-3/+3
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=12623
* Finished (?) cleaning up sysinit stuff.Bruce Evans1995-12-021-9/+4
| | | | Notes: svn path=/head/; revision=12569
* The entire sysctl callback to read/write version. I havn't tested this asPoul-Henning Kamp1995-11-121-3/+2
| | | | | | | | | | | much as I'd like to, but the malloc stunt I tried for an interim for sure does worse. Now we can read and write from any kind of address-space, not only user and kernel, using callbacks. This may be over-generalization for now, but it's actually simpler. Notes: svn path=/head/; revision=12243
* Fix some of the sysctl broke, and add a lot more to it.Poul-Henning Kamp1995-11-081-7/+8
| | | | Notes: svn path=/head/; revision=12152