Remove KERNEL_LOCK_ASSERT_LOCKED, KERNEL_LOCK_ASSERT_UNLOCKED since the

kernel_lock functions can be patched out at runtime now. Assertions are
provided by the existing functions and by LOCKDEBUG_BARRIER.
This commit is contained in:
ad 2007-11-13 22:14:34 +00:00
parent dbe854de34
commit dbd3ed7b2a
3 changed files with 5 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_idle.c,v 1.7 2007/11/06 00:42:41 ad Exp $ */
/* $NetBSD: kern_idle.c,v 1.8 2007/11/13 22:14:35 ad Exp $ */
/*-
* Copyright (c)2002, 2006, 2007 YAMAMOTO Takashi,
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.7 2007/11/06 00:42:41 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.8 2007/11/13 22:14:35 ad Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@ -53,7 +53,6 @@ idle_loop(void *dummy)
KERNEL_UNLOCK_ALL(l, NULL);
l->l_stat = LSONPROC;
while (1 /* CONSTCOND */) {
KERNEL_LOCK_ASSERT_UNLOCKED();
LOCKDEBUG_BARRIER(NULL, 0);
KASSERT((l->l_flag & LW_IDLE) != 0);
KASSERT(ci == curcpu());

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_lock.c,v 1.125 2007/11/06 00:42:41 ad Exp $ */
/* $NetBSD: kern_lock.c,v 1.126 2007/11/13 22:14:35 ad Exp $ */
/*-
* Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.125 2007/11/06 00:42:41 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.126 2007/11/13 22:14:35 ad Exp $");
#include "opt_multiprocessor.h"
@ -887,26 +887,4 @@ _kernel_unlock(int nlocks, struct lwp *l, int *countp)
if (countp != NULL)
*countp = olocks;
}
#if defined(DEBUG)
/*
* Assert that the kernel lock is held.
*/
void
_kernel_lock_assert_locked(void)
{
if (!__SIMPLELOCK_LOCKED_P(&kernel_lock) ||
curcpu()->ci_biglock_count == 0)
_KERNEL_LOCK_ABORT("not locked");
}
void
_kernel_lock_assert_unlocked()
{
if (curcpu()->ci_biglock_count != 0)
_KERNEL_LOCK_ABORT("locked");
}
#endif
#endif /* !_RUMPKERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: systm.h,v 1.201 2007/11/09 14:54:13 dsl Exp $ */
/* $NetBSD: systm.h,v 1.202 2007/11/13 22:14:34 ad Exp $ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
@ -493,16 +493,6 @@ do { \
#define KERNEL_UNLOCK(all, lwp, ptr) /* nothing */
#endif
#if defined(DEBUG)
#define KERNEL_LOCK_ASSERT_LOCKED() _kernel_lock_assert_locked()
#define KERNEL_LOCK_ASSERT_UNLOCKED() _kernel_lock_assert_unlocked()
void _kernel_lock_assert_locked(void);
void _kernel_lock_assert_unlocked(void);
#else
#define KERNEL_LOCK_ASSERT_LOCKED() /* nothing */
#define KERNEL_LOCK_ASSERT_UNLOCKED() /* nothing */
#endif
#define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL)
#define KERNEL_UNLOCK_ALL(l, p) KERNEL_UNLOCK(0, (l), (p))
#define KERNEL_UNLOCK_ONE(l) KERNEL_UNLOCK(1, (l), NULL)