cvs commit: src/sys/kern kern_lock.c kern_sx.c subr_turnstile.c src/sys/sys lockmgr.h sx.h

John Baldwin john at baldwin.cx
Tue Aug 15 18:43:05 UTC 2006


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


More information about the cvs-src mailing list