Module Name: src
Committed By: riastradh
Date: Sat Apr 9 23:34:30 UTC 2022
Modified Files:
src/sys/sys: atomic.h
Log Message:
atomic_loadstore(9): Use membar_acquire/release.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/atomic.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/atomic.h
diff -u src/sys/sys/atomic.h:1.23 src/sys/sys/atomic.h:1.24
--- src/sys/sys/atomic.h:1.23 Sat Apr 9 23:32:53 2022
+++ src/sys/sys/atomic.h Sat Apr 9 23:34:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.23 2022/04/09 23:32:53 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.24 2022/04/09 23:34:30 riastradh Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -454,18 +454,12 @@ void kcsan_atomic_store(volatile void *,
__END_ATOMIC_LOAD(__al_val); \
})
-/*
- * We want {loads}-before-{loads,stores}. It is tempting to use
- * membar_enter, but that provides {stores}-before-{loads,stores},
- * which may not help. So we must use membar_sync, which does the
- * slightly stronger {loads,stores}-before-{loads,stores}.
- */
#define atomic_load_acquire(p) \
({ \
const volatile __typeof__(*(p)) *__al_ptr = (p); \
__ATOMIC_PTR_CHECK(__al_ptr); \
__BEGIN_ATOMIC_LOAD(__al_ptr, __al_val); \
- membar_sync(); \
+ membar_acquire(); \
__END_ATOMIC_LOAD(__al_val); \
})
@@ -482,7 +476,7 @@ void kcsan_atomic_store(volatile void *,
volatile __typeof__(*(p)) *__as_ptr = (p); \
__typeof__(*(p)) __as_val = (v); \
__ATOMIC_PTR_CHECK(__as_ptr); \
- membar_exit(); \
+ membar_release(); \
__DO_ATOMIC_STORE(__as_ptr, __as_val); \
})