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

Matthew Dillon dillon at
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 
  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
  * 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

More information about the Commits mailing list