Source-Changes-HG archive

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

[src/trunk]: src/sys/kern rearrange some common code in lockdebug_unlocked.



details:   https://anonhg.NetBSD.org/src/rev/a2929c65853d
branches:  trunk
changeset: 764228:a2929c65853d
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Apr 14 06:12:02 2011 +0000

description:
rearrange some common code in lockdebug_unlocked.
When printing a lockdebug error, add a '*' to indicate whether lock or
unlock was performed.

diffstat:

 sys/kern/subr_lockdebug.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (62 lines):

diff -r ae9748820e81 -r a2929c65853d sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Thu Apr 14 05:54:24 2011 +0000
+++ b/sys/kern/subr_lockdebug.c Thu Apr 14 06:12:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $ */
+/*     $NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt 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.43 2010/09/25 01:42:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -572,9 +572,6 @@
                                    "not held by current LWP", true);
                                return;
                        }
-                       ld->ld_flags &= ~LD_LOCKED;
-                       ld->ld_unlocked = where;
-                       ld->ld_lwp = NULL;
                        TAILQ_REMOVE(&l->l_ld_locks, ld, ld_chain);
                } else {
                        if (ld->ld_cpu != (uint16_t)cpu_index(curcpu())) {
@@ -582,12 +579,12 @@
                                    "not held by current CPU", true);
                                return;
                        }
-                       ld->ld_flags &= ~LD_LOCKED;
-                       ld->ld_unlocked = where;                
-                       ld->ld_lwp = NULL;
                        TAILQ_REMOVE(&curcpu()->ci_data.cpu_ld_locks, ld,
                            ld_chain);
                }
+               ld->ld_flags &= ~LD_LOCKED;
+               ld->ld_unlocked = where;                
+               ld->ld_lwp = NULL;
        }
        __cpu_simple_unlock(&ld->ld_spinlock);
        splx(s);
@@ -733,12 +730,15 @@
                    "shares wanted: %18u exclusive: %18u\n"
                    "current cpu  : %18u last held: %18u\n"
                    "current lwp  : %#018lx last held: %#018lx\n"
-                   "last locked  : %#018lx unlocked : %#018lx\n",
+                   "last locked%c : %#018lx unlocked%c: %#018lx\n",
                    (unsigned)ld->ld_shares, ((ld->ld_flags & LD_LOCKED) != 0),
                    (unsigned)ld->ld_shwant, (unsigned)ld->ld_exwant,
                    (unsigned)cpu_index(curcpu()), (unsigned)ld->ld_cpu,
                    (long)curlwp, (long)ld->ld_lwp,
-                   (long)ld->ld_locked, (long)ld->ld_unlocked);
+                   ((ld->ld_flags & LD_LOCKED) ? '*' : ' '),
+                   (long)ld->ld_locked,
+                   ((ld->ld_flags & LD_LOCKED) ? ' ' : '*'),
+                   (long)ld->ld_unlocked);
        }
 
        if (ld->ld_lockops->lo_dump != NULL)



Home | Main Index | Thread Index | Old Index