summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-01-28 22:04:08 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-01-28 22:04:08 +0000
commit4a9eb7af4445690cf89ed1d3ad4723ecbec70e93 (patch)
tree045997fd4aa78d00d2808dbe14cfa277fa20b8e0 /sys/arch
parent8c65f1b34dd0777d068ce27cb39049526ef486af (diff)
In MUTEX_ASSERT_LOCKED, check we are the mutex owner if MULTIPROCESSOR.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/include/mutex.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/alpha/include/mutex.h b/sys/arch/alpha/include/mutex.h
index 0485ccb90ac..88a8cc95112 100644
--- a/sys/arch/alpha/include/mutex.h
+++ b/sys/arch/alpha/include/mutex.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.h,v 1.4 2014/01/26 17:40:11 miod Exp $ */
+/* $OpenBSD: mutex.h,v 1.5 2014/01/28 22:04:07 miod Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -40,10 +40,20 @@ void mtx_init(struct mutex *, int);
#define MUTEX_INITIALIZER(ipl) { 0, (ipl), IPL_NONE, NULL }
#ifdef DIAGNOSTIC
+#ifdef MULTIPROCESSOR
#define MUTEX_ASSERT_LOCKED(mtx) do { \
if ((mtx)->mtx_lock == 0) \
panic("mutex %p not held in %s", (mtx), __func__); \
+ if ((mtx)->mtx_owner != curcpu()) \
+ panic("mutex %p held by cpu %p in %s", \
+ (mtx), (mtx)->mtx_owner, __func__); \
} while (0)
+#else
+#define MUTEX_ASSERT_LOCKED(mtx) do { \
+ if ((mtx)->mtx_lock == 0) \
+ panic("mutex %p not held in %s", (mtx), __func__); \
+} while (0)
+#endif
#define MUTEX_ASSERT_UNLOCKED(mtx) do { \
if ((mtx)->mtx_lock != 0) \