kernel - x86_64 - Add additional checks to lwp_wait() & friends
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 23 Oct 2010 16:35:14 +0000 (09:35 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 23 Oct 2010 16:35:14 +0000 (09:35 -0700)
commitcf709dd2875a65b72fa9fa34219405b1ef74df69
treed9f73e683e8cbb66684d27922f28ce38d18151c3
parent40e515fcc137bce9d559adb1c31ad68f1df06f0e
kernel - x86_64 - Add additional checks to lwp_wait() & friends

* lwp_wait() must defer reaping of a lwp that is still running on another
  cpu (i.e. in the midst of exiting).

* It shouldn't be possible for this to happen but just incase the thread
  gets switched out after TDF_EXITING has been set, also make sure
  the threat is no longer on the LWKT run queue.

* Remove old debugging in the LWKT scheduler path.

* Protect gd_freetd (per-cpu td cache) with a critical section.  Again
  this case should not occur as new threads are not allocated from
  interrupts, but protect it anyway.  Also assert that the cached free
  td is in no way still scheduled.

  Note that this cache is required to ensure that the td does not
  end up in the MP-accessible objcache before it has been fully
  descheduled.
sys/kern/kern_exit.c
sys/kern/lwkt_thread.c