freebsd-dev/sys
Konstantin Belousov 57d07ca9f0 When callout_reset_on() cannot immediately migrate a callout since it
is running on other cpu, the CALLOUT_PENDING flag is temporarily
cleared. Then, callout_stop() on this, in fact active, callout fails
because CALLOUT_PENDING is not set, and callout_stop() returns 0.

Now, in sleepq_check_timeout(), the failed callout_stop() causes the
sleepq code to execute mi_switch() without even setting the wmesg,
since the switch-out is supposed to be transient. In fact, the thread
is put off the CPU for full timeout interval, instead of being put on
runq immediately.  Until timeout fires, the process is unkillable for
obvious reasons.

Fix this by marking the migrating callouts with CALLOUT_DFRMIGRATION
flag. The flag is cleared by callout_stop_safe() when the function
detects a migration, besides returning the success. The softclock()
rechecks the flag for migrating callout and cancels its execution if
the flag was cleared meantime.

PR:	 misc/166340
Reported, debugging traces provided and tested by:
	Christian Esken <christian.esken trivago com>
Reviewed by:	 avg, jhb
MFC after:	 1 week
2012-05-03 10:38:02 +00:00
..
amd64 Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
arm Fix comment about what board this is really for left over from early 2012-05-02 18:41:58 +00:00
boot Remove some redundant register loads. 2012-05-02 05:49:58 +00:00
bsm
cam Add support for: 2012-04-29 22:28:15 +00:00
cddl Partially revert r232938; ZFS only requires nfs4 but not posix1e. 2012-04-29 16:21:47 +00:00
compat - Implement pipe2 syscall for Linuxulator. This syscall appeared in 2.6.27 2012-04-16 21:22:02 +00:00
conf Break out the arge MDIO bus code into an optional argemdio device. 2012-05-01 06:18:30 +00:00
contrib Revert r234834 per luigi@ request. 2012-05-03 08:56:43 +00:00
crypto
ddb
dev Added D_TRACKCLOSE to sndstat_cdevsw to fix the situation when 2012-05-02 19:32:11 +00:00
fs fixed a unionfs_readdir math issue 2012-05-03 07:22:29 +00:00
gdb
geom Add optional -o argument to the graid label to specify some metadata 2012-05-03 05:32:56 +00:00
gnu/fs Remove unused thread argument to vrecycle(). 2012-04-23 14:10:34 +00:00
i386 Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
ia64 Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
isa
kern When callout_reset_on() cannot immediately migrate a callout since it 2012-05-03 10:38:02 +00:00
kgssapi
libkern
mips In the new world order, multiphy is now when the phymask is 0x0. 2012-05-03 07:48:19 +00:00
modules Fix make depend. 2012-05-01 07:38:40 +00:00
net Revert r234834 per luigi@ request. 2012-05-03 08:56:43 +00:00
net80211 Update HWMP Proactive code and mesh route flags. 2012-05-01 16:18:38 +00:00
netatalk
netgraph Fix panic in ng_patch(4) caused by checksum flags being added to mbuf flags. 2012-04-22 17:00:52 +00:00
netinet Fix another RFC 6458 issue. Spotted by Irene Ruengeler. 2012-05-03 10:26:33 +00:00
netinet6
netipsec
netipx
netnatm
netncp
netsmb
nfs
nfsclient Remove unused thread argument from vtruncbuf(). 2012-04-23 13:21:28 +00:00
nfsserver
nlm
ofed Revert r234834 per luigi@ request. 2012-05-03 08:56:43 +00:00
opencrypto
pc98 Clean up the intr* MD KPI from the SMP dependency, removing a cause of 2012-04-26 20:24:25 +00:00
pci intpm: add ATI IXP400 pci id 2012-04-16 10:33:46 +00:00
powerpc Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
rpc
security
sparc64 Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
sys When callout_reset_on() cannot immediately migrate a callout since it 2012-05-03 10:38:02 +00:00
teken
tools
ufs Remove unused thread argument from ufs_extattr_uepm_lock()/ufs_extattr_uepm_unlock(). 2012-04-23 17:56:35 +00:00
vm Avoid a lock order reversal in pmap_extract_and_hold() from relocking 2012-04-22 17:58:30 +00:00
x86 Clean up the intr* MD KPI from the SMP dependency, removing a cause of 2012-04-26 20:24:25 +00:00
xdr
xen
Makefile