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.
This commit is contained in:
ad 2020-03-08 15:05:18 +00:00
parent 9d385320b0
commit d05ef83dfb
4 changed files with 11 additions and 36 deletions

View File

@ -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 @@ exit1(struct lwp *l, int exitcode, int signo)
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);

View File

@ -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 @@ _kernel_locked_p(void)
{
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
}

View File

@ -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 @@ softint_dispatch(lwp_t *pinned, int s)
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

View File

@ -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 @@ do { \
extern __cpu_simple_lock_t kernel_lock[];
void kernel_lock_plug_leak(void);
#endif /* _KERNEL */
#endif /* _SYS_LOCK_H_ */