Source-Changes-HG archive

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

[src/trunk]: src/sys/kern softint_execute: add assert which could catch locki...



details:   https://anonhg.NetBSD.org/src/rev/138f51036f60
branches:  trunk
changeset: 764113:138f51036f60
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Apr 11 19:13:54 2011 +0000

description:
softint_execute: add assert which could catch locking bugs in softint handlers.

diffstat:

 sys/kern/kern_softint.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 3cf209e1e2ac -r 138f51036f60 sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c   Mon Apr 11 19:11:08 2011 +0000
+++ b/sys/kern/kern_softint.c   Mon Apr 11 19:13:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_softint.c,v 1.33 2010/12/20 00:25:46 matt Exp $   */
+/*     $NetBSD: kern_softint.c,v 1.34 2011/04/11 19:13:54 rmind Exp $  */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -176,7 +176,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.33 2010/12/20 00:25:46 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.34 2011/04/11 19:13:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -539,6 +539,11 @@
                        havelock = true;
                }
                (*sh->sh_func)(sh->sh_arg);
+
+               /* Diagnostic: check that spin-locks have not leaked. */
+               KASSERTMSG(curcpu()->ci_mtx_count == 0,
+                   ("%s: ci_mtx_count (%d) != 0, sh_func %p\n",
+                   __func__, curcpu()->ci_mtx_count, sh->sh_func));
        
                (void)splhigh();
                KASSERT((sh->sh_flags & SOFTINT_ACTIVE) != 0);



Home | Main Index | Thread Index | Old Index