diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-04 12:30:05 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2017-04-04 12:30:05 +0000 |
commit | 323dd69be8bf7c78e8e0917f41d2553596037a6a (patch) | |
tree | 276b6518608a9f685511bd86097bf31e15d309ca | |
parent | ac7de934695abf399b3753f1bae40da1b4079b4b (diff) |
Issue memory barrier before lock release, not after. This ensures
the release write becomes globally visible only after any writes
of the critical section are globally visible. In practice, the
reordering has not happened because the kernel runs in the total
store order mode.
Tested by and OK kettenis@
-rw-r--r-- | sys/arch/sparc64/sparc64/lock_machdep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/sparc64/sparc64/lock_machdep.c b/sys/arch/sparc64/sparc64/lock_machdep.c index 58470886e59..0cb1d16b66e 100644 --- a/sys/arch/sparc64/sparc64/lock_machdep.c +++ b/sys/arch/sparc64/sparc64/lock_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lock_machdep.c,v 1.12 2017/03/07 14:41:57 visa Exp $ */ +/* $OpenBSD: lock_machdep.c,v 1.13 2017/04/04 12:30:04 visa Exp $ */ /* * Copyright (c) 2007 Artur Grabowski <art@openbsd.org> @@ -130,8 +130,8 @@ __mp_unlock(struct __mp_lock *mpl) s = intr_disable(); if (--cpu->mplc_depth == 0) { - mpl->mpl_ticket++; sparc_membar(StoreStore | LoadStore); + mpl->mpl_ticket++; } intr_restore(s); } @@ -146,8 +146,8 @@ __mp_release_all(struct __mp_lock *mpl) s = intr_disable(); rv = cpu->mplc_depth; cpu->mplc_depth = 0; - mpl->mpl_ticket++; sparc_membar(StoreStore | LoadStore); + mpl->mpl_ticket++; intr_restore(s); return (rv); |