summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2014-07-10 12:14:49 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2014-07-10 12:14:49 +0000
commitad6731aec6a359c2c2ad68a6399d92cecad155cc (patch)
tree402049e22e91863b5f9400d37a8e58cbcbe38663 /sys
parentda0925a2447e3b1ffedb2aedd8eb0f96659af9df (diff)
fix some errors in lockdebug code. not enabled by default.
ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/lock_machdep.c9
-rw-r--r--sys/arch/i386/i386/lock_machdep.c6
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/arch/amd64/amd64/lock_machdep.c b/sys/arch/amd64/amd64/lock_machdep.c
index 3afdf49e8f5..1f1d847fccd 100644
--- a/sys/arch/amd64/amd64/lock_machdep.c
+++ b/sys/arch/amd64/amd64/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.5 2014/03/14 02:08:57 dlg Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.6 2014/07/10 12:14:48 mlarkin Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
@@ -57,7 +57,7 @@ __mp_lock_spin(struct __mp_lock *mpl, u_int me)
SPINLOCK_SPIN_HOOK;
if (ticks == 0) {
- db_printf("__mp_lock(0x%x): lock spun out", mpl);
+ db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
#endif
@@ -95,7 +95,7 @@ __mp_unlock(struct __mp_lock *mpl)
long rf = read_rflags();
#ifdef MP_LOCKDEBUG
- if (mpl->mpl_cpu != curcpu()) {
+ if (!__mp_lock_held(mpl)) {
db_printf("__mp_unlock(%p): not held lock\n", mpl);
Debugger();
}
@@ -130,7 +130,7 @@ __mp_release_all_but_one(struct __mp_lock *mpl)
int rv = cpu->mplc_depth - 1;
#ifdef MP_LOCKDEBUG
- if (mpl->mpl_cpu != curcpu()) {
+ if (!__mp_lock_held(mpl)) {
db_printf("__mp_release_all_but_one(%p): not held lock\n", mpl);
Debugger();
}
@@ -155,4 +155,3 @@ __mp_lock_held(struct __mp_lock *mpl)
return (cpu->mplc_ticket == mpl->mpl_ticket && cpu->mplc_depth > 0);
}
-
diff --git a/sys/arch/i386/i386/lock_machdep.c b/sys/arch/i386/i386/lock_machdep.c
index 32cfc2ee6f4..4f597327f86 100644
--- a/sys/arch/i386/i386/lock_machdep.c
+++ b/sys/arch/i386/i386/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.14 2014/03/14 03:01:38 dlg Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.15 2014/07/10 12:14:48 mlarkin Exp $ */
/* $NetBSD: lock_machdep.c,v 1.1.2.3 2000/05/03 14:40:30 sommerfeld Exp $ */
/*-
@@ -97,7 +97,7 @@ __mp_lock_spin(struct __mp_lock *mpl, u_int me)
SPINLOCK_SPIN_HOOK;
if (ticks == 0) {
- db_printf("__mp_lock(0x%x): lock spun out", mpl);
+ db_printf("__mp_lock(%p): lock spun out", mpl);
Debugger();
}
#endif
@@ -124,7 +124,7 @@ __mp_unlock(struct __mp_lock *mpl)
int ef = read_eflags();
#ifdef MP_LOCKDEBUG
- if (mpl->mpl_cpu != curcpu()) {
+ if (!__mp_lock_held(mpl)) {
db_printf("__mp_unlock(%p): not held lock\n", mpl);
Debugger();
}