Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2006 14:42:33 -0400
From:      John Baldwin <john@baldwin.cx>
To:        src-committers@freebsd.org
Cc:        cvs-src@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/kern kern_lock.c kern_sx.c subr_turnstile.c src/sys/sys lockmgr.h sx.h
Message-ID:  <200608151442.34357.john@baldwin.cx>
In-Reply-To: <200608151829.k7FIT2Sx042038@repoman.freebsd.org>
References:  <200608151829.k7FIT2Sx042038@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 15 August 2006 14:29, John Baldwin wrote:
> jhb         2006-08-15 18:29:02 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/kern             kern_lock.c kern_sx.c subr_turnstile.c 
>     sys/sys              lockmgr.h sx.h 
>   Log:
>   Add a new 'show sleepchain' ddb command similar to 'show lockchain' except
>   that it operates on lockmgr and sx locks.  This can be useful for tracking
>   down vnode deadlocks in VFS for example.  Note that this command is a bit
>   more fragile than 'show lockchain' as we have to poke around at the
>   wait channel of a thread to see if it points to either a struct lock or
>   a condition variable inside of a struct sx.  If td_wchan points to
>   something unmapped, then this command will terminate early due to a fault,
>   but no harm will be done.

Some sample output:

sx cycle:

db> ps
  pid  ppid  pgrp   uid   state   wmesg     wchan    cmd
   46     0     0     0  SL      one      0xc49f25a4 [crash2: 3]
   45     0     0     0  SL      four     0xc49f2664 [crash2: 2]
   44     0     0     0  SL      three    0xc49f2624 [crash2: 1]
   43     0     0     0  SL      two      0xc49f25e4 [crash2: 0]
...
db> show sleepchain 43
thread 100047 (pid 43, crash2: 0) blocked on sx "two" XLOCK
thread 100046 (pid 44, crash2: 1) blocked on sx "three" XLOCK
thread 100045 (pid 45, crash2: 2) blocked on sx "four" XLOCK
thread 100044 (pid 46, crash2: 3) blocked on sx "one" XLOCK
thread 100047 (pid 43, crash2: 0) blocked on sx "two" XLOCK
thread 100046 (pid 44, crash2: 1) blocked on sx "three" XLOCK
thread 100045 (pid 45, crash2: 2) blocked on sx "four" XLOCK
...

mixed lockmgr and sx cycle:

db> ps
  pid  ppid  pgrp   uid   state   wmesg     wchan    cmd
   46     0     0     0  SL      fee      0xc4a3f6a0 [crash2: 3]
   45     0     0     0  SL      four     0xc4a3f678 [crash2: 2]
   44     0     0     0  SL      fo       0xc4a3f720 [crash2: 1]
   43     0     0     0  SL      two      0xc4a3f5f8 [crash2: 0]
...
db> show lockmgr fee
lock type: fee
state: EXCL (count 1) 0xc49c4d80 (tid 100073, pid 43, "crash2: 0")
waiters: 1
db> show sleepchain 46
thread 100070 (pid 46, crash2: 3) blocked on lk "fee" EXCL (count 1)
thread 100073 (pid 43, crash2: 0) blocked on sx "two" XLOCK
thread 100072 (pid 44, crash2: 1) blocked on lk "fo" EXCL (count 1)
thread 100071 (pid 45, crash2: 2) blocked on sx "four" XLOCK
thread 100070 (pid 46, crash2: 3) blocked on lk "fee" EXCL (count 1)
thread 100073 (pid 43, crash2: 0) blocked on sx "two" XLOCK
...

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608151442.34357.john>