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/octeon | |
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/octeon')
-rw-r--r-- | sys/arch/octeon/octeon/mutex.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/arch/octeon/octeon/mutex.c b/sys/arch/octeon/octeon/mutex.c index e85f65a96b3..4135e53139f 100644 --- a/sys/arch/octeon/octeon/mutex.c +++ b/sys/arch/octeon/octeon/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.1 2010/09/20 06:32:30 syuu Exp $ */ +/* $OpenBSD: mutex.c,v 1.2 2010/09/28 20:27:55 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -76,6 +76,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) @@ -96,6 +99,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) @@ -107,6 +113,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); |