Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys atomic_loadstore(9): Use membar_acquire/release.



details:   https://anonhg.NetBSD.org/src/rev/34439c114539
branches:  trunk
changeset: 365145:34439c114539
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 23:34:30 2022 +0000

description:
atomic_loadstore(9): Use membar_acquire/release.

diffstat:

 sys/sys/atomic.h |  12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diffs (38 lines):

diff -r 7be4679c82e5 -r 34439c114539 sys/sys/atomic.h
--- a/sys/sys/atomic.h  Sat Apr 09 23:32:51 2022 +0000
+++ b/sys/sys/atomic.h  Sat Apr 09 23:34:30 2022 +0000
@@ -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 @@
        __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 @@
        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);                                \
 })
 



Home | Main Index | Thread Index | Old Index