diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-21 04:34:13 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-21 04:34:13 +0000 |
commit | e98d69b14dd08856abde29fb967f9eb1c845bb3a (patch) | |
tree | 944b112e2faa13021c7af6cb8e644090316911cf /sys/arch/m88k | |
parent | f2eeae2112eae0b48bcd954af6ff7d73a0e39ab1 (diff) |
Revert the ``remove the `skip splraise/splx for IPL_NONE mutexes' optimization''
change. It seems to have unexpected side effects, especially on MP systems,
and drahn@ disagrees with the way this change has been done and think there
is a better way to solve the original problem of msleep() fiddling with
mutex internals.
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r-- | sys/arch/m88k/m88k/mutex.S | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/arch/m88k/m88k/mutex.S b/sys/arch/m88k/m88k/mutex.S index 787efabe879..d6adb3708d8 100644 --- a/sys/arch/m88k/m88k/mutex.S +++ b/sys/arch/m88k/m88k/mutex.S @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.S,v 1.10 2011/04/03 18:46:40 miod Exp $ */ +/* $OpenBSD: mutex.S,v 1.11 2011/04/21 04:34:12 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -54,7 +54,9 @@ ENTRY(mtx_enter) st r2, r31, 0 /* save mtx */ enter_again: ld r2, r2, MTX_WANTIPL + bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ +1: ld r4, r31, 0 or r3, r0, 1 xmem r3, r4, r0 /* attempt to claim the lock, old */ @@ -74,6 +76,8 @@ enter_again: addu r31, r31, 8 enter_failed: /* the lock is not ours... */ + ld r3, r4, MTX_WANTIPL + bcnd eq0, r3, 2f bcnd ne0, r2, 1f /* splx(oldipl) */ bsr.n _C_LABEL(spl0) addu r1, r1, 2f - . - 4 @@ -107,7 +111,9 @@ enter_panic: st r2, r31, 0 /* save mtx */ ld r2, r2, MTX_WANTIPL + bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ +1: ld r4, r31, 0 ldcr r3, CPU st r3, r4, MTX_LOCK /* locked! */ @@ -141,7 +147,9 @@ ENTRY(mtx_enter_try) st r2, r31, 0 /* save mtx */ enter_try_again: ld r2, r2, MTX_WANTIPL + bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ +1: ld r4, r31, 0 or r3, r0, 1 xmem r3, r4, r0 /* attempt to claim the lock, old */ @@ -162,6 +170,8 @@ enter_try_again: addu r31, r31, 8 enter_try_failed: /* the lock is not ours... */ + ld r3, r4, MTX_WANTIPL + bcnd eq0, r3, 2f bcnd ne0, r2, 1f /* splx(oldipl) */ bsr.n _C_LABEL(spl0) addu r1, r1, 2f - . - 4 @@ -194,7 +204,9 @@ enter_try_panic: st r2, r31, 0 /* save mtx */ ld r2, r2, MTX_WANTIPL + bcnd eq0, r2, 1f bsr _C_LABEL(raiseipl) /* raiseipl(mtx->mtx_wantipl) */ +1: ld r4, r31, 0 ldcr r3, CPU st r3, r4, MTX_LOCK /* locked! */ @@ -222,6 +234,7 @@ enter_try_panic: */ ENTRY(mtx_leave) ld r3, r2, MTX_OLDIPL + ld r4, r2, MTX_WANTIPL #ifdef DIAGNOSTIC ld r5, r2, MTX_CPU ld r6, r5, CI_MUTEX_LEVEL @@ -229,10 +242,13 @@ ENTRY(mtx_leave) st r6, r5, CI_MUTEX_LEVEL #endif st r0, r2, MTX_CPU /* mtx->mtx_cpu = NULL */ - st r0, r2, MTX_LOCK /* mtx->mtx_lock = 0 */ + bcnd.n eq0, r4, 2f + st r0, r2, MTX_LOCK /* mtx->mtx_lock = 0 */ bcnd ne0, r3, 1f /* splx(mtx->mtx_oldipl) */ br _C_LABEL(spl0) 1: br.n _C_LABEL(setipl) or r2, r3, r0 +2: + jmp r1 |