kernel - Revamp LWKT thread migration
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 24 Mar 2011 21:40:08 +0000 (14:40 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 24 Mar 2011 21:40:08 +0000 (14:40 -0700)
commitcc9b6223b2987bd6f07ca869665f420285917156
tree20a432fed0c6ca4781de78700bf365b222bba6ef
parent5c26bcd6e16a9635d747a67bbcec500e43b8e91f
kernel - Revamp LWKT thread migration

* Rearrange the handling of TDF_RUNNING, making lwkt_switch() responsible
  for it instead of the assembly switch code.  Adjust td->td_switch() to
  return the previously running thread.

  This allows lwkt_switch() to process thread migration between cpus after
  the thread has been completely and utterly switched out, removing the
  need to loop on TDF_RUNNING on the target cpu.

* Fixes lwkt_setcpu_remote livelock failure

* This required major surgery on the core thread switch assembly, testing
  is needed.  I tried to avoid doing this but the livelock problems persisted,
  so the only solution was to remove the need for the loops that were causing
  the livelocks.

* NOTE: The user process scheduler is still using the old giveaway/acquire
method.  More work is needed here.

Reported-by: "Magliano Andre'" <masterblaster@tiscali.it>
16 files changed:
sys/kern/lwkt_thread.c
sys/kern/usched_bsd4.c
sys/platform/pc32/i386/exception.s
sys/platform/pc32/i386/swtch.s
sys/platform/pc32/include/md_var.h
sys/platform/pc64/include/md_var.h
sys/platform/pc64/x86_64/exception.S
sys/platform/pc64/x86_64/swtch.s
sys/platform/vkernel/i386/fork_tramp.s
sys/platform/vkernel/i386/swtch.s
sys/platform/vkernel/include/md_var.h
sys/platform/vkernel64/include/md_var.h
sys/platform/vkernel64/x86_64/fork_tramp.s
sys/platform/vkernel64/x86_64/swtch.s
sys/sys/proc.h
sys/sys/thread.h