Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Print the shared lock(s) before we panic, to aid wi...



details:   https://anonhg.NetBSD.org/src/rev/1f3a3b1bf770
branches:  trunk
changeset: 333964:1f3a3b1bf770
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Nov 24 02:36:31 2014 +0000

description:
Print the shared lock(s) before we panic, to aid with debugging.

diffstat:

 sys/kern/subr_lockdebug.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r e9cb0fcf4e4b -r 1f3a3b1bf770 sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Mon Nov 24 02:34:04 2014 +0000
+++ b/sys/kern/subr_lockdebug.c Mon Nov 24 02:36:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.51 2014/03/07 16:36:32 matt Exp $ */
+/*     $NetBSD: subr_lockdebug.c,v 1.52 2014/11/24 02:36:31 christos Exp $     */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.51 2014/03/07 16:36:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.52 2014/11/24 02:36:31 christos Exp $");
 
 #include "opt_ddb.h"
 
@@ -101,6 +101,8 @@
                                 const char *, bool);
 static int     lockdebug_more(int);
 static void    lockdebug_init(void);
+static void    lockdebug_dump(lockdebug_t *, void (*)(const char *, ...)
+    __printflike(1, 2));
 
 static signed int
 ld_rbto_compare_nodes(void *ctx, const void *n1, const void *n2)
@@ -663,8 +665,13 @@
        }
        splx(s);
        if (l->l_shlocks != 0) {
-               panic("lockdebug_barrier: holding %d shared locks",
-                   l->l_shlocks);
+               TAILQ_FOREACH(ld, &ld_all, ld_achain) {
+                       if (ld->ld_lockops->lo_type == LOCKOPS_CV)
+                               continue;
+                       if (ld->ld_lwp == l)
+                               lockdebug_dump(ld, printf);
+               }
+               panic("%s: holding %d shared locks", __func__, l->l_shlocks);
        }
 }
 



Home | Main Index | Thread Index | Old Index