-current lockup (how to diagnose?)

Jun Kuriyama kuriyama at imgsrc.co.jp
Mon Dec 1 23:07:59 PST 2003


At Tue, 2 Dec 2003 01:45:43 -0500 (EST),
Robert Watson wrote:
> Could you try compiling in DEBUG_LOCKS into your kernel and doing "show
> lockedvnods" with that?

Okay. I'll use new kernel with DEBUG_LOCKS.

> Unfortunately, someone removed the pid from the
> output of that command, but didn't add the thread pointer to the DDB ps
> output, so you'll probably need to modify the lockmgr_printinfo() function
> in vfs_subr.c to print out lkp->lk_lockholder->td_proc->p_pid as well for
> exclusive locks.

I don't understand what it means, but I'll try with this modification.

Index: kern_lock.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_lock.c,v
retrieving revision 1.70
diff -u -r1.70 kern_lock.c
--- kern_lock.c	16 Jul 2003 01:00:38 -0000	1.70
+++ kern_lock.c	2 Dec 2003 07:04:49 -0000
@@ -611,8 +611,8 @@
 		printf(" lock type %s: SHARED (count %d)", lkp->lk_wmesg,
 		    lkp->lk_sharecount);
 	else if (lkp->lk_flags & LK_HAVE_EXCL)
-		printf(" lock type %s: EXCL (count %d) by thread %p",
-		    lkp->lk_wmesg, lkp->lk_exclusivecount, lkp->lk_lockholder);
+		printf(" lock type %s: EXCL (count %d) by thread %p (pid:%d)",
+		    lkp->lk_wmesg, lkp->lk_exclusivecount, lkp->lk_lockholder, lkp->lk_lockholder->td_proc->p_pid);
 	if (lkp->lk_waitcount > 0)
 		printf(" with %d pending", lkp->lk_waitcount);
 }


> It looks like maybe something isn't releasing a vnode
> lock before returning to userspace.  I have some patches to assert that no
> lockmgr locks are held on the return to userspace, but I'll have to dig
> them up tomorrow and send them to you.  Basically, it adds a per-thread
> lockmgr lock count in a thread-local variable, incrementing for each lock,
> and decrementing for each release, and then KASSERT()'s in userret that
> the variable is 0.

Thanks!  I'm waiting for your patch.


-- 
Jun Kuriyama <kuriyama at imgsrc.co.jp> // IMG SRC, Inc.
             <kuriyama at FreeBSD.org> // FreeBSD Project


More information about the freebsd-current mailing list