diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-09-21 06:23:04 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-09-21 06:23:04 +0000 |
commit | 663851d5614d352491896f12c6a67f1fc13f0651 (patch) | |
tree | 799f13de091be0fa9a74e979ec7653e569ed583a /sys | |
parent | a7cfa4c53e7a3674129abbdeeffb602d734925da (diff) |
Fix membar positioning in mtx_enter_try() and (critically!) mtx_leave()
Same diff as guenther@ committed for alpha.
ok guenther@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mips64/mips64/mutex.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/mips64/mips64/mutex.c b/sys/arch/mips64/mips64/mutex.c index 90ed8452124..1709bff6d1b 100644 --- a/sys/arch/mips64/mips64/mutex.c +++ b/sys/arch/mips64/mips64/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.1 2015/07/08 13:37:31 dlg Exp $ */ +/* $OpenBSD: mutex.c,v 1.2 2015/09/21 06:23:03 kettenis Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -64,12 +64,12 @@ mtx_enter_try(struct mutex *mtx) panic("mtx %p: locking against myself", mtx); #endif if (owner == NULL) { + membar_enter(); if (mtx->mtx_wantipl != IPL_NONE) mtx->mtx_oldipl = s; #ifdef DIAGNOSTIC ci->ci_mutex_level++; #endif - membar_enter(); return (1); } @@ -114,14 +114,14 @@ mtx_leave(struct mutex *mtx) MUTEX_ASSERT_LOCKED(mtx); -#ifdef MULTIPROCESSOR - membar_exit(); -#endif #ifdef DIAGNOSTIC curcpu()->ci_mutex_level--; #endif s = mtx->mtx_oldipl; +#ifdef MULTIPROCESSOR + membar_exit(); +#endif mtx->mtx_owner = NULL; if (mtx->mtx_wantipl != IPL_NONE) splx(s); |