git: kernel - Separate inherited mplocks from td_mplocks and fix a gettoken bug

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Aug 30 12:37:03 PDT 2010


commit 3933a3ab606b81b57423112e261ca5426deac2e6
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Aug 30 12:29:06 2010 -0700

    kernel - Separate inherited mplocks from td_mplocks and fix a gettoken bug
    
    * Separate out td_mpcount into td_xpcount and td_mpcount.  td_xpcount
      is an inherited mpcount.  A preempting thread inherits the mpcount
      on the thread being preempted until it switches out to guarantee
      that the mplock remains atomic through the preemption (as expected
      by the poor thread that got preempted).
    
    * Fix a serious but hard to reproduce bug in lwkt_gettoken().  This
      function marks the token reference as being MPSAFE if td_mpcount
      is non-zero even when the token is not a MPSAFE token.
    
      However, until this patch td_mpcount also included inherited mpcounts
      when one thread preempts another and the inherited mpcounts could
      go away if the thread blocks or switches, leaving the token unprotected.
    
    * Fix a less serious bug where a new token reference was being populated
      prior to td_toks_stop being incremented, and where an existing token
      reference was being depopulated after td_toks_stop is decremented.
      Nothing can race us but switch around the index increment/decrement
      to protect the slot being operated upon.
    
    * Add a ton of assertions in the interrupt, trap, and syscall paths
      To assert that the mplock, number of tokens, and critcount remain
      unchanged across driver and other calls.

Summary of changes:
 sys/kern/kern_intr.c                 |   51 ++++++++++++++++++++++++++++
 sys/kern/kern_mplock.c               |   56 ++++++++++++++++++------------
 sys/kern/kern_shutdown.c             |   20 +++++++++--
 sys/kern/lwkt_thread.c               |   62 +++++++++++++++++----------------
 sys/kern/lwkt_token.c                |   20 +++++++----
 sys/platform/pc32/i386/trap.c        |   16 +++++++--
 sys/platform/pc64/x86_64/trap.c      |   16 +++++++--
 sys/platform/vkernel/i386/trap.c     |   20 +++++++++--
 sys/platform/vkernel64/x86_64/trap.c |   22 ++++++++++--
 sys/sys/mplock2.h                    |   17 ++++++++-
 sys/sys/thread.h                     |   11 +++++-
 11 files changed, 231 insertions(+), 80 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3933a3ab606b81b57423112e261ca5426deac2e6


-- 
DragonFly BSD source repository





More information about the Commits mailing list