kernel - refactor cpusync and pmap_inval code, fix lockup
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 10 Jan 2011 23:17:25 +0000 (15:17 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 10 Jan 2011 23:17:25 +0000 (15:17 -0800)
commitd5b2d319bb8e5009b38780b6cacd8dae71b2f06d
tree397b9b2c38e81b3777113695a536091eeb2ce47e
parentc98f21694743514ff7b4dad6d61e4ab9931c4a05
kernel - refactor cpusync and pmap_inval code, fix lockup

* Simplify the cpusync API.  The API now has only one initialization call,
  one simplified rollup call, and two primary calls handling a single
  function callback (instead of three callbacks).

  cpusync_interlock() interlocks the specified set of cpus and ensures they
  are running in a safe place, cpusync_deinterlock() executes the initialized
  function on the cpu set and does not return until all cpus have completed
  the operation.

* Simplify the pmap_inval per-platform API.  pmap_inval_interlock() and
  pmap_inval_deinterlock() now reflect similar functionality to the cpusync
  API.  pmap/pte operations are now synchronized when pmap_inval_deinterlock()
  is called and not when pmap_inval_done() is called, reducing the range of
  code which can execute while the cpu set is held quiescent.

  pmap_inval_flush() has been removed.  Critical section handling has also
  been rearranged slightly in the pmap_inval* and cpusync* APIs.

* Fixes a cpusync lockup which occurs when the x86-64 pmap and pmap_inval
  code is used to hold a cpu mask quiescent across complex subsystem calls.
  Primarily accomplished by moving the synchronization out of
  pmap_inval_flush() and into pmap_inval_deinterlock().
12 files changed:
sys/kern/lwkt_ipiq.c
sys/kern/lwkt_thread.c
sys/platform/pc32/i386/i686_mem.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc32/i386/pmap_inval.c
sys/platform/pc32/i386/sys_machdep.c
sys/platform/pc32/include/pmap_inval.h
sys/platform/pc64/include/pmap_inval.h
sys/platform/pc64/x86_64/pmap.c
sys/platform/pc64/x86_64/pmap_inval.c
sys/sys/thread.h
sys/sys/thread2.h