cvs commit: src/sys/kern kern_spinlock.c lwkt_thread.c

Matthew Dillon dillon at crater.dragonflybsd.org
Thu May 18 10:56:05 PDT 2006


dillon      2006/05/18 10:53:46 PDT

DragonFly src repository

  Modified files:
    sys/kern             kern_spinlock.c lwkt_thread.c 
  Log:
  Make spinlocks panic-friendly.
  
  * Add code to detect indefinite waits.  If a spinlock cannot be obtained
    after one second a warning is issued to the console.  After 10 seconds
    a DDB backtrace is output to the console.
  
  * Count the number of contested events, short and long, via two sysctls:
    debug.spinlocks_contested1 and debug.spinlocks.contested2.
  
  * Add a sysctl to test the indefinite wait code: sysctl debug.spin_lock_test=1.
    (only if INVARIANTS is turned on).
  
  * If an indefinite wait occurs while the system is paniced, the spinlock
    code will hand the spinlock over to the requester after 1 second.  This
    should allow panics to proceed even if they occur at a bad point in the
    code.
  
  * lwkt_switch normally panics if spinlocks are held by the current thread
    (and it tries to switch).  Do not panic if the system is already in a
    panic.  This should allow the system to restabilize itself due to the
    indefinite wait panic handling code, well enough to generate a dump
    or enter into DDB, anyhow.
  
  Revision  Changes    Path
  1.3       +105 -2    src/sys/kern/kern_spinlock.c
  1.94      +3 -2      src/sys/kern/lwkt_thread.c


http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_spinlock.c.diff?r1=1.2&r2=1.3&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_thread.c.diff?r1=1.93&r2=1.94&f=u





More information about the Commits mailing list