tsleep() - Add PINTERLOCKED flag to catch edge case.
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 14 Jul 2009 10:14:33 +0000 (03:14 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 14 Jul 2009 10:14:33 +0000 (03:14 -0700)
commitd9345d3a15a76b50686600e9c522f9e1ba9c855a
treeeca45553d5e16f99bb3d172cd35783de5cd0f3a4
parent899eb297501681913674633aa0823adb6809437c
tsleep() - Add PINTERLOCKED flag to catch edge case.

When the tsleep_interlock() + UNLOCK + tsleep() combination is used it is
possible for an incoming wakeup IPI to be processed even if the combination
is used within a critical section, because operations inbetween the two
may send an IPI.  Under heavy loads sending an IPI can force incoming IPIs
to be processed synchronously to avoid deadlocks.

It is also possible for tsleep itself to create this condition when it
releases the user process schedule prior to descheduling itself.

PINTERLOCKED causes tsleep to check whether the bit set by tsleep_interlock()
is still set.  If it is not set we simply return without sleeping.
25 files changed:
sys/bus/cam/cam_sim.c
sys/bus/cam/cam_xpt.c
sys/dev/disk/ahci/ahci_dragonfly.c
sys/dev/disk/aic7xxx/aic_osm_lib.c
sys/dev/disk/sili/sili_dragonfly.c
sys/dev/drm/drmP.h
sys/dev/drm/drm_drv.c
sys/dev/drm/drm_lock.c
sys/dev/drm/radeon_cp.c
sys/dev/netif/iwi/if_iwi.c
sys/dev/raid/aac/aac.c
sys/dev/sound/pcm/sound.c
sys/kern/kern_synch.c
sys/kern/kern_umtx.c
sys/kern/lwkt_ipiq.c
sys/kern/lwkt_serialize.c
sys/kern/subr_bus.c
sys/kern/sys_pipe.c
sys/kern/vfs_bio.c
sys/kern/vfs_vnops.c
sys/net/tap/if_tap.c
sys/netproto/smb/smb_subr.c
sys/sys/param.h
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_subs.c