- KERNEL_LOCK_ASSERT_LOCKED: check cpu_biglock_count as well.

- implement KERNEL_LOCK_ASSERT_UNLOCKED.
This commit is contained in:
yamt 2006-09-30 11:59:37 +00:00
parent 3606cbeb14
commit 11ac1566d0
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_lock.c,v 1.99 2006/09/07 02:06:47 ad Exp $ */
/* $NetBSD: kern_lock.c,v 1.100 2006/09/30 11:59:37 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.99 2006/09/07 02:06:47 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.100 2006/09/30 11:59:37 yamt Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@ -1556,8 +1556,18 @@ _kernel_lock_acquire_count(int hold_count)
void
_kernel_lock_assert_locked()
{
KDASSERT(curcpu()->ci_data.cpu_biglock_count > 0);
simple_lock_assert_locked(&kernel_lock, "kernel_lock");
}
void
_kernel_lock_assert_unlocked()
{
KDASSERT(curcpu()->ci_data.cpu_biglock_count == 0);
simple_lock_assert_unlocked(&kernel_lock, "kernel_lock");
}
#endif
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: systm.h,v 1.189 2006/09/24 06:51:39 dogcow Exp $ */
/* $NetBSD: systm.h,v 1.190 2006/09/30 11:59:37 yamt Exp $ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
@ -498,9 +498,12 @@ void _kernel_lock_acquire_count(int);
#if defined(MULTIPROCESSOR) && 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
#endif /* !_SYS_SYSTM_H_ */