diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-09-28 20:27:57 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-09-28 20:27:57 +0000 |
commit | 15969dfa68e37d305dd11968e20ca0a425d2092a (patch) | |
tree | ff5f69008da4bbcba278d383b53bb927776d4644 /sys/arch/hppa | |
parent | 23487e0f53f72934a66dcf7e42b399ec6562e966 (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/hppa')
-rw-r--r-- | sys/arch/hppa/hppa/mutex.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/include/cpu.h | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/hppa/hppa/mutex.c b/sys/arch/hppa/hppa/mutex.c index 66005b13ffd..2710cfb8d13 100644 --- a/sys/arch/hppa/hppa/mutex.c +++ b/sys/arch/hppa/hppa/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.8 2010/06/26 00:45:05 jsing Exp $ */ +/* $OpenBSD: mutex.c,v 1.9 2010/09/28 20:27:54 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -72,6 +72,9 @@ mtx_enter(struct mutex *mtx) if (mtx->mtx_wantipl != IPL_NONE) mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); +#ifdef DIAGNOSTIC + curcpu()->ci_mutex_level++; +#endif return; } if (mtx->mtx_wantipl != IPL_NONE) @@ -90,6 +93,9 @@ mtx_enter_try(struct mutex *mtx) if (mtx->mtx_wantipl != IPL_NONE) mtx->mtx_oldipl = s; mtx->mtx_owner = curcpu(); +#ifdef DIAGNOSTIC + curcpu()->ci_mutex_level++; +#endif return 1; } if (mtx->mtx_wantipl != IPL_NONE) @@ -105,6 +111,9 @@ mtx_leave(struct mutex *mtx) MUTEX_ASSERT_LOCKED(mtx); +#ifdef DIAGNOSTIC + curcpu()->ci_mutex_level--; +#endif s = mtx->mtx_oldipl; mtx->mtx_owner = NULL; diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h index 07868e52f3e..6e362534089 100644 --- a/sys/arch/hppa/include/cpu.h +++ b/sys/arch/hppa/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.75 2010/06/29 00:50:40 jsing Exp $ */ +/* $OpenBSD: cpu.h,v 1.76 2010/09/28 20:27:54 miod Exp $ */ /* * Copyright (c) 2000-2004 Michael Shalayeff @@ -100,6 +100,9 @@ struct cpu_info { struct schedstate_percpu ci_schedstate; u_int32_t ci_randseed; +#ifdef DIAGNOSTIC + int ci_mutex_level; +#endif } __attribute__((__aligned__(64))); #define CPUF_RUNNING 0x0001 /* CPU is running. */ |