freebsd-skq/sys
jhb 5d22bdedcf Fix a race in the sleepqueue timeout code that resulted in sleeps not
being properly cancelled by a timeout.  In general there is a race
between a the sleepq timeout handler firing while the thread is still
in the process of going to sleep.  In 6.x with sched_lock, the race was
largely protected by sched_lock.  The only place it was "exposed" and had
to be handled was while checking for any pending signals in
sleepq_catch_signals().

With the thread lock changes, the thread lock is dropped in between
sleepq_add() and sleepq_*wait*() opening up a new window for this race.
Thus, if the timeout fired while the sleeping thread was in between
sleepq_add() and sleepq_*wait*(), the thread would be marked as timed
out, but the thread would not be dequeued and sleepq_switch() would
still block the thread until it was awakened via some other means.  In
the case of pause(9) where there is no other wakeup, the thread would
never be awakened.

Fix this by teaching sleepq_switch() to check if the thread has had its
sleep canceled before blocking by checking the TDF_TIMEOUT flag and
aborting the sleep and dequeueing the thread if it is set.

MFC after:	3 days
Reported by:	dwhite, peter
2008-01-25 02:09:38 +00:00
..
amd64 Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY(). 2008-01-17 18:59:38 +00:00
arm - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and 2008-01-17 23:37:47 +00:00
boot Bump manpage date for rev 1.27 2008-01-16 07:00:55 +00:00
bsm Merge OpenBSM 1.0 changes to src/sys/bsm: 2007-10-29 18:47:25 +00:00
cam o Correct EasyMP3 EM732X usb 2.0 flash mp3 player revision: 2008-01-12 19:24:55 +00:00
cddl - Reduce how much ZFS caches by default. This is another change to mitigate 2008-01-24 11:24:16 +00:00
compat Change type of kmem_used() and kmem_size() functions to uint64_t, so it 2008-01-24 11:21:54 +00:00
conf Update file list and Makefile after repocopying sf(4) from 2008-01-21 04:27:32 +00:00
contrib - Reduce how much ZFS caches by default. This is another change to mitigate 2008-01-24 11:24:16 +00:00
crypto Make test00 compilable again. 2008-01-15 18:34:47 +00:00
ddb Refine textdump comments slightly. 2008-01-10 00:26:47 +00:00
dev Do not dereference NULL scp in the case the screen is not opened. 2008-01-24 15:37:48 +00:00
fs Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
gdb Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
geom Various fixes: 2007-12-24 01:01:59 +00:00
gnu Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
i4b Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
i386 Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY(). 2008-01-17 18:59:38 +00:00
ia64 Add COMPAT_FREEBSD7 and enable it in configs that have COMPAT_FREEBSD6. 2008-01-07 21:40:11 +00:00
isa Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY(). 2008-01-17 18:59:38 +00:00
kern Fix a race in the sleepqueue timeout code that resulted in sleeps not 2008-01-25 02:09:38 +00:00
libkern Do not use __XSCALE__ to detect if clz is available, use _ARM_ARCH_5 instead. 2007-10-13 12:05:36 +00:00
modules Update file list and Makefile after repocopying sf(4) from 2008-01-21 04:27:32 +00:00
net Remove a chunk of duplicated code, test the destination address against the 2008-01-18 09:34:09 +00:00
net80211 update channel flag defs to match _ieee80211.h so cpp doesn't complain 2007-12-13 01:23:40 +00:00
netatalk Annotate two possible bugs in a comment: (1) we allocate and explicitly 2007-11-20 18:50:54 +00:00
netatm Disconnect netatm from the build as it is not MPSAFE and relies on 2007-07-14 21:49:24 +00:00
netgraph Fix bundle xmit octets stats for packet-split operation mode. 2008-01-23 11:47:09 +00:00
netinet Replace the last susers calls in netinet6/ with privilege checks. 2008-01-24 08:25:59 +00:00
netinet6 Replace the last susers calls in netinet6/ with privilege checks. 2008-01-24 08:25:59 +00:00
netipsec Add sysctls to if_enc(4) to control whether the firewalls or 2007-11-28 22:33:53 +00:00
netipx Make tcpstates[] static, and make sure TCPSTATES is defined before 2007-07-30 11:06:42 +00:00
netnatm
netncp Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
netsmb Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
nfs
nfs4client Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
nfsclient Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
nfsserver Use nfsrv_destroycache() only once, else it crashes the server. 2008-01-18 17:03:36 +00:00
opencrypto Make ftruncate a 'struct file' operation rather than a vnode operation. 2008-01-07 20:05:19 +00:00
pc98 Add COMPAT_FREEBSD7 and enable it in configs that have COMPAT_FREEBSD6. 2008-01-07 21:40:11 +00:00
pccard
pci Add copyrights. 2008-01-21 13:26:33 +00:00
powerpc Add COMPAT_FREEBSD7 and enable it in configs that have COMPAT_FREEBSD6. 2008-01-07 21:40:11 +00:00
rpc Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which 2007-08-06 14:26:03 +00:00
security Fix gratuitous whitespace bug 2008-01-18 19:57:21 +00:00
sparc64 Uncomment sf(4), sf(4) should work on all architectures. 2008-01-21 06:51:25 +00:00
sun4v Add an access type parameter to pmap_enter(). It will be used to implement 2008-01-03 07:34:34 +00:00
sys When asked to use kqueue, AIO stores its internal state in the 2008-01-24 17:10:19 +00:00
tools
ufs Cleanup lockmgr interface and exported KPI: 2008-01-24 12:34:30 +00:00
vm VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in 2008-01-13 14:44:15 +00:00
Makefile o Add boot, gdb, nfsserver and opencrypto dirs to CSCOPEDIRS; sort. 2008-01-23 08:50:34 +00:00