kernel - (mainly x86_64) - Fix a number of rare races
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Oct 2010 23:07:05 +0000 (16:07 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 21 Oct 2010 23:07:05 +0000 (16:07 -0700)
commit2883d2d843e07344552e83fb1e8e60cfdf565f3e
tree0f3f0e939c516d09e0b2df4e0d9bb477441d8d27
parent24872d8bb91420034731142e230b872d0159dd24
kernel - (mainly x86_64) - Fix a number of rare races

* Move the MP lock from outside to inside exit1(), also fixing an issue
  where sigexit() was calling exit1() without it.

* Move calls to dsched_exit_thread() and biosched_done() out of the
  platform code and into the mainline code.  This also fixes an
  issue where the code was improperly blocking way too late in the
  thread termination code, after the point where it had been descheduled
  permanently and tsleep decomissioned for the thread.

* Cleanup and document related code areas.

* Fix a missing proc_token release in the SIGKILL exit path.

* Fix FAKE_MCOUNT()s in the x86-64 code.  These are NOPs anyway
  (since kernel profiling doesn't work), but fix them anyway.

* Use APIC_PUSH_FRAME() in the Xcpustop assembly code for x86-64
  in order to properly acquire a working %gs.  This may improve the
  handling of panic()s on x86_64.

* Also fix some cases if #if JG'd (ifdef'd out) code in case the
  code is ever used later on.

* Protect set_user_TLS() with a critical section to be safe.

* Add debug code to help track down further x86-64 seg-fault issues,
  and provide better kprintf()s for the debug path in question.
19 files changed:
sys/emulation/linux/i386/linux_machdep.c
sys/kern/kern_exit.c
sys/kern/kern_sig.c
sys/kern/lwkt_thread.c
sys/platform/pc32/i386/trap.c
sys/platform/pc32/i386/vm_machdep.c
sys/platform/pc64/apic/apic_vector.s
sys/platform/pc64/icu/icu_vector.s
sys/platform/pc64/x86_64/exception.S
sys/platform/pc64/x86_64/ipl.s
sys/platform/pc64/x86_64/machdep.c
sys/platform/pc64/x86_64/swtch.s
sys/platform/pc64/x86_64/tls.c
sys/platform/pc64/x86_64/trap.c
sys/platform/pc64/x86_64/vm_machdep.c
sys/platform/vkernel/i386/trap.c
sys/platform/vkernel/i386/vm_machdep.c
sys/platform/vkernel64/x86_64/trap.c
sys/platform/vkernel64/x86_64/vm_machdep.c