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>
Sun, 24 Oct 2010 16:34:08 +0000 (09:34 -0700)
commit16a434475b7bd6880282d0b4683759b037023759
tree1b814f4a645a6f2984abde86ea873406dc4d2937
parent05b0fb2471ebec1e708e972fe2ef7e5c82db24a9
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