git: kernel - refactor cpusync and pmap_inval code, fix lockup

Matthew Dillon dillon at
Mon Jan 10 15:26:49 PST 2011

commit d5b2d319bb8e5009b38780b6cacd8dae71b2f06d
Author: Matthew Dillon <dillon at>
Date:   Mon Jan 10 15:17:25 2011 -0800

    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().

Summary of changes:
 sys/kern/lwkt_ipiq.c                   |  264 ++++++++++++-------------------
 sys/kern/lwkt_thread.c                 |   13 ++
 sys/platform/pc32/i386/i686_mem.c      |   12 +-
 sys/platform/pc32/i386/pmap.c          |    7 +-
 sys/platform/pc32/i386/pmap_inval.c    |   90 +++--------
 sys/platform/pc32/i386/sys_machdep.c   |    4 +-
 sys/platform/pc32/include/pmap_inval.h |    2 +-
 sys/platform/pc64/include/pmap_inval.h |    2 +-
 sys/platform/pc64/x86_64/pmap.c        |    7 +-
 sys/platform/pc64/x86_64/pmap_inval.c  |   96 ++++--------
 sys/sys/thread.h                       |   21 +--
 sys/sys/thread2.h                      |   13 ++
 12 files changed, 199 insertions(+), 332 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list