From owner-cvs-all@FreeBSD.ORG Tue Aug 15 18:43:05 2006 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 129B816A4DD; Tue, 15 Aug 2006 18:43:05 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F3DC43D6A; Tue, 15 Aug 2006 18:42:55 +0000 (GMT) (envelope-from john@baldwin.cx) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k7FIgqvg029612; Tue, 15 Aug 2006 14:42:53 -0400 (EDT) (envelope-from john@baldwin.cx) From: John Baldwin To: src-committers@freebsd.org Date: Tue, 15 Aug 2006 14:42:33 -0400 User-Agent: KMail/1.9.1 References: <200608151829.k7FIT2Sx042038@repoman.freebsd.org> In-Reply-To: <200608151829.k7FIT2Sx042038@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608151442.34357.john@baldwin.cx> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 15 Aug 2006 14:42:53 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1664/Tue Aug 15 10:28:31 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx 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 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2006 18:43:05 -0000 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