summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-09-28 20:27:57 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-09-28 20:27:57 +0000
commit15969dfa68e37d305dd11968e20ca0a425d2092a (patch)
treeff5f69008da4bbcba278d383b53bb927776d4644 /sys/arch/hppa64
parent23487e0f53f72934a66dcf7e42b399ec6562e966 (diff)
Implement a per-cpu held mutex counter if DIAGNOSTIC on all non-x86 platforms,
to complete matthew@'s commit of a few days ago, and drop __HAVE_CPU_MUTEX_LEVEL define. With help from, and ok deraadt@.
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r--sys/arch/hppa64/hppa64/mutex.c11
-rw-r--r--sys/arch/hppa64/include/cpu.h5
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/hppa64/hppa64/mutex.c b/sys/arch/hppa64/hppa64/mutex.c
index 8f9d5ebf9a4..4f2c28b36fe 100644
--- a/sys/arch/hppa64/hppa64/mutex.c
+++ b/sys/arch/hppa64/hppa64/mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.c,v 1.4 2009/08/13 13:24:55 weingart Exp $ */
+/* $OpenBSD: mutex.c,v 1.5 2010/09/28 20:27:54 miod Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -52,6 +52,9 @@ mtx_enter(struct mutex *mtx)
mtx->mtx_oldipl = splraise(mtx->mtx_wantipl);
MUTEX_ASSERT_UNLOCKED(mtx);
mtx->mtx_lock = 1;
+#ifdef DIAGNOSTIC
+ curcpu()->ci_mutex_level++;
+#endif
}
int
@@ -61,6 +64,9 @@ mtx_enter_try(struct mutex *mtx)
mtx->mtx_oldipl = splraise(mtx->mtx_wantipl);
MUTEX_ASSERT_UNLOCKED(mtx);
mtx->mtx_lock = 1;
+#ifdef DIAGNOSTIC
+ curcpu()->ci_mutex_level++;
+#endif
return 1;
}
@@ -69,6 +75,9 @@ void
mtx_leave(struct mutex *mtx)
{
MUTEX_ASSERT_LOCKED(mtx);
+#ifdef DIAGNOSTIC
+ curcpu()->ci_mutex_level--;
+#endif
mtx->mtx_lock = 0;
if (mtx->mtx_wantipl != IPL_NONE)
splx(mtx->mtx_oldipl);
diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h
index 76bf2fca2a0..41da51b3fdf 100644
--- a/sys/arch/hppa64/include/cpu.h
+++ b/sys/arch/hppa64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.17 2010/07/24 21:27:57 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.18 2010/09/28 20:27:54 miod Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -137,6 +137,9 @@ struct cpu_info {
void *ci_initstack;
u_long ci_itmr;
+#ifdef DIAGNOSTIC
+ int ci_mutex_level;
+#endif
};
struct cpu_info *curcpu(void);