summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include/mutex.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-09-13 18:28:14 +0000
committerjhb <jhb@FreeBSD.org>2000-09-13 18:28:14 +0000
commit2bef2cffd4590e0d732ee9af20c3fc37217d6b52 (patch)
tree346d9e404adde168584928f15003fa13a00d970f /sys/powerpc/include/mutex.h
parent2eb0243bb6af11723c1662bb587531f2e7095362 (diff)
downloadFreeBSD-src-2bef2cffd4590e0d732ee9af20c3fc37217d6b52.zip
FreeBSD-src-2bef2cffd4590e0d732ee9af20c3fc37217d6b52.tar.gz
- Fix spinlock exiting to handle recursion properly and only enable
interrupts at the proper time. - Remove an uneeded test and just always set the MTX_RECURSE bit when recursing on a sleep lock.
Diffstat (limited to 'sys/powerpc/include/mutex.h')
-rw-r--r--sys/powerpc/include/mutex.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/powerpc/include/mutex.h b/sys/powerpc/include/mutex.h
index a6aad99..ae4b5bb 100644
--- a/sys/powerpc/include/mutex.h
+++ b/sys/powerpc/include/mutex.h
@@ -312,8 +312,7 @@ void witness_restore(mtx_t *, const char *, int);
if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
else { \
- if (((mp)->mtx_lock & MTX_RECURSE) == 0) \
- atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
+ atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
(mp)->mtx_recurse++; \
} \
} else { \
@@ -379,12 +378,15 @@ void witness_restore(mtx_t *, const char *, int);
*/
#define _exitlock_spin(mp) do { \
- int _ipl = (mp)->mtx_saveipl; \
alpha_mb(); \
- if ((mp)->mtx_recurse == 0 || (--(mp)->mtx_recurse) == 0) \
+ if ((mp)->mtx_recurse == 0) { \
+ int _ipl = (mp)->mtx_saveipl; \
atomic_cmpset_64(&(mp)->mtx_lock, (mp)->mtx_lock, \
MTX_UNOWNED); \
- alpha_pal_swpipl(_ipl); \
+ alpha_pal_swpipl(_ipl); \
+ } else { \
+ (mp)->mtx_recurse--; \
+ } \
} while (0)
/*
OpenPOWER on IntegriCloud