Source-Changes-HG archive

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

[src/trunk]: src/sys Kill off kernel_lock_plug_leak(), and go back to droppin...



details:   https://anonhg.NetBSD.org/src/rev/68b90cb11939
branches:  trunk
changeset: 849626:68b90cb11939
user:      ad <ad%NetBSD.org@localhost>
date:      Sun Mar 08 15:05:18 2020 +0000

description:
Kill off kernel_lock_plug_leak(), and go back to dropping kernel_lock in
exit1(), since there seems little hope of finding the leaking code any
time soon.  Can still be caught with LOCKDEBUG.

diffstat:

 sys/kern/kern_exit.c    |  12 ++++++------
 sys/kern/kern_lock.c    |  24 ++----------------------
 sys/kern/kern_softint.c |   7 ++-----
 sys/sys/lock.h          |   4 +---
 4 files changed, 11 insertions(+), 36 deletions(-)

diffs (123 lines):

diff -r 7c9ff3b24146 -r 68b90cb11939 sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Sun Mar 08 15:01:50 2020 +0000
+++ b/sys/kern/kern_exit.c      Sun Mar 08 15:05:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $       */
+/*     $NetBSD: kern_exit.c,v 1.285 2020/03/08 15:05:18 ad Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.285 2020/03/08 15:05:18 ad Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -206,12 +206,12 @@
 
        p = l->l_proc;
 
-       /* XXX Temporary. */
-       kernel_lock_plug_leak();
-
        /* Verify that we hold no locks other than p->p_lock. */
        LOCKDEBUG_BARRIER(p->p_lock, 0);
-       KASSERTMSG(curcpu()->ci_biglock_count == 0, "kernel_lock leaked");
+
+       /* XXX Temporary: something is leaking kernel_lock. */
+       KERNEL_UNLOCK_ALL(l, NULL);
+
        KASSERT(mutex_owned(p->p_lock));
        KASSERT(p->p_vmspace != NULL);
 
diff -r 7c9ff3b24146 -r 68b90cb11939 sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c      Sun Mar 08 15:01:50 2020 +0000
+++ b/sys/kern/kern_lock.c      Sun Mar 08 15:05:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lock.c,v 1.169 2020/02/10 22:11:09 christos Exp $ */
+/*     $NetBSD: kern_lock.c,v 1.170 2020/03/08 15:05:18 ad Exp $       */
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.169 2020/02/10 22:11:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.170 2020/03/08 15:05:18 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lockdebug.h"
@@ -343,23 +343,3 @@
 {
        return __SIMPLELOCK_LOCKED_P(kernel_lock);
 }
-
-void
-kernel_lock_plug_leak(void)
-{
-#ifndef LOCKDEBUG
-# ifdef DIAGNOSTIC
-       int biglocks = 0;
-       KERNEL_UNLOCK_ALL(curlwp, &biglocks);
-       if (biglocks != 0) {
-               const char *sym = "(unknown)";
-               ksyms_getname(NULL, &sym, (vaddr_t)curlwp->l_ld_wanted,
-                   KSYMS_CLOSEST|KSYMS_PROC|KSYMS_ANY);
-               printf("kernel_lock leak detected. last acquired: %s / %p\n",
-                   sym, curlwp->l_ld_wanted);
-       }
-# else
-       KERNEL_UNLOCK_ALL(curlwp, NULL);
-# endif
-#endif
-}
diff -r 7c9ff3b24146 -r 68b90cb11939 sys/kern/kern_softint.c
--- a/sys/kern/kern_softint.c   Sun Mar 08 15:01:50 2020 +0000
+++ b/sys/kern/kern_softint.c   Sun Mar 08 15:05:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_softint.c,v 1.61 2020/02/17 21:44:42 ad Exp $     */
+/*     $NetBSD: kern_softint.c,v 1.62 2020/03/08 15:05:18 ad Exp $     */
 
 /*-
  * Copyright (c) 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.61 2020/02/17 21:44:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_softint.c,v 1.62 2020/03/08 15:05:18 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -890,9 +890,6 @@
                l->l_pflag &= ~LP_TIMEINTR;
        }
 
-       /* XXX temporary */
-       kernel_lock_plug_leak();
-
        /*
         * If we blocked while handling the interrupt, the pinned LWP is
         * gone so switch to the idle LWP.  It will select a new LWP to
diff -r 7c9ff3b24146 -r 68b90cb11939 sys/sys/lock.h
--- a/sys/sys/lock.h    Sun Mar 08 15:01:50 2020 +0000
+++ b/sys/sys/lock.h    Sun Mar 08 15:05:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.88 2020/01/27 21:05:43 ad Exp $     */
+/*     $NetBSD: lock.h,v 1.89 2020/03/08 15:05:18 ad Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -109,8 +109,6 @@
 
 extern __cpu_simple_lock_t kernel_lock[];
 
-void   kernel_lock_plug_leak(void);
-
 #endif /* _KERNEL */
 
 #endif /* _SYS_LOCK_H_ */



Home | Main Index | Thread Index | Old Index