Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/linux linux: Convert various API shi...



details:   https://anonhg.NetBSD.org/src/rev/18f99e56ca51
branches:  trunk
changeset: 365158:18f99e56ca51
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 23:43:30 2022 +0000

description:
linux: Convert various API shims to use membar_release/acquire.

diffstat:

 sys/external/bsd/common/include/asm/barrier.h    |   6 ++--
 sys/external/bsd/common/include/linux/compiler.h |   4 +-
 sys/external/bsd/common/linux/linux_tasklet.c    |  32 ++++++++++++------------
 sys/external/bsd/common/linux/linux_work.c       |   8 +++---
 4 files changed, 25 insertions(+), 25 deletions(-)

diffs (185 lines):

diff -r 859ccdcbbe1d -r 18f99e56ca51 sys/external/bsd/common/include/asm/barrier.h
--- a/sys/external/bsd/common/include/asm/barrier.h     Sat Apr 09 23:43:20 2022 +0000
+++ b/sys/external/bsd/common/include/asm/barrier.h     Sat Apr 09 23:43:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: barrier.h,v 1.12 2021/12/27 10:41:57 riastradh Exp $   */
+/*     $NetBSD: barrier.h,v 1.13 2022/04/09 23:43:30 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -68,8 +68,8 @@
 #endif
 
 #if defined(MULTIPROCESSOR) && !defined(__HAVE_ATOMIC_AS_MEMBAR)
-#  define      smp_mb__before_atomic()         membar_exit()
-#  define      smp_mb__after_atomic()          membar_sync() /* XXX acquire */
+#  define      smp_mb__before_atomic()         membar_release()
+#  define      smp_mb__after_atomic()          membar_acquire()
 #else
 #  define      smp_mb__before_atomic()         __insn_barrier()
 #  define      smp_mb__after_atomic()          __insn_barrier()
diff -r 859ccdcbbe1d -r 18f99e56ca51 sys/external/bsd/common/include/linux/compiler.h
--- a/sys/external/bsd/common/include/linux/compiler.h  Sat Apr 09 23:43:20 2022 +0000
+++ b/sys/external/bsd/common/include/linux/compiler.h  Sat Apr 09 23:43:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compiler.h,v 1.7 2022/02/17 01:21:02 riastradh Exp $   */
+/*     $NetBSD: compiler.h,v 1.8 2022/04/09 23:43:31 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
 
 #define        smp_store_release(X, V) do {                                          \
        typeof(X) __smp_store_release_tmp = (V);                              \
-       membar_exit();                                                        \
+       membar_release();                                                     \
        (X) = __write_once_tmp;                                               \
 } while (0)
 
diff -r 859ccdcbbe1d -r 18f99e56ca51 sys/external/bsd/common/linux/linux_tasklet.c
--- a/sys/external/bsd/common/linux/linux_tasklet.c     Sat Apr 09 23:43:20 2022 +0000
+++ b/sys/external/bsd/common/linux/linux_tasklet.c     Sat Apr 09 23:43:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_tasklet.c,v 1.10 2021/12/27 14:57:30 riastradh Exp $     */
+/*     $NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2018, 2020, 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.10 2021/12/27 14:57:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_tasklet.c,v 1.11 2022/04/09 23:43:31 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -245,7 +245,7 @@
                /*
                 * Check whether it's currently disabled.
                 *
-                * Pairs with membar_exit in __tasklet_enable.
+                * Pairs with membar_release in __tasklet_enable.
                 */
                if (atomic_load_acquire(&tasklet->tl_disablecount)) {
                        /*
@@ -394,9 +394,9 @@
        KASSERT(disablecount < UINT_MAX);
        KASSERT(disablecount != 0);
 
-       /* Pairs with membar_exit in __tasklet_enable.  */
+       /* Pairs with membar_release in __tasklet_enable.  */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_enter();
+       membar_acquire();
 #endif
 }
 
@@ -514,9 +514,9 @@
        } while (atomic_cas_uint(&tasklet->tl_state, state,
                state | TASKLET_RUNNING) != state);
 
-       /* Pairs with membar_exit in tasklet_unlock.  */
+       /* Pairs with membar_release in tasklet_unlock.  */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_enter();
+       membar_acquire();
 #endif
 
        return true;
@@ -536,11 +536,11 @@
        KASSERT(atomic_load_relaxed(&tasklet->tl_state) & TASKLET_RUNNING);
 
        /*
-        * Pairs with membar_enter in tasklet_trylock and with
+        * Pairs with membar_acquire in tasklet_trylock and with
         * atomic_load_acquire in tasklet_unlock_wait.
         */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
        atomic_and_uint(&tasklet->tl_state, ~TASKLET_RUNNING);
 }
@@ -556,7 +556,7 @@
 tasklet_unlock_wait(const struct tasklet_struct *tasklet)
 {
 
-       /* Pairs with membar_exit in tasklet_unlock.  */
+       /* Pairs with membar_release in tasklet_unlock.  */
        while (atomic_load_acquire(&tasklet->tl_state) & TASKLET_RUNNING)
                SPINLOCK_BACKOFF_HOOK;
 }
@@ -589,9 +589,9 @@
        KASSERT(disablecount < UINT_MAX);
        KASSERT(disablecount != 0);
 
-       /* Pairs with membar_exit in __tasklet_enable_sync_once.  */
+       /* Pairs with membar_release in __tasklet_enable_sync_once.  */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_enter();
+       membar_acquire();
 #endif
 
        /*
@@ -613,9 +613,9 @@
 {
        unsigned int disablecount;
 
-       /* Pairs with membar_enter in __tasklet_disable_sync_once.  */
+       /* Pairs with membar_acquire in __tasklet_disable_sync_once.  */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
 
        /* Decrement the disable count.  */
@@ -681,10 +681,10 @@
         * decrementing the disable count.
         *
         * Pairs with atomic_load_acquire in tasklet_softintr and with
-        * membar_enter in tasklet_disable.
+        * membar_acquire in tasklet_disable.
         */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
 
        /* Decrement the disable count.  */
diff -r 859ccdcbbe1d -r 18f99e56ca51 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c        Sat Apr 09 23:43:20 2022 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c        Sat Apr 09 23:43:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $        */
+/*     $NetBSD: linux_work.c,v 1.61 2022/04/09 23:43:31 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.60 2021/12/31 14:30:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.61 2022/04/09 23:43:31 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -639,7 +639,7 @@
            owner0);
 
        KASSERT(work_queue(work) == wq);
-       membar_enter();
+       membar_acquire();
        SDT_PROBE2(sdt, linux, work, acquire,  work, wq);
        return true;
 }
@@ -660,7 +660,7 @@
        KASSERT(mutex_owned(&wq->wq_lock));
 
        SDT_PROBE2(sdt, linux, work, release,  work, wq);
-       membar_exit();
+       membar_release();
 
        /*
         * Non-interlocked r/m/w is safe here because nobody else can



Home | Main Index | Thread Index | Old Index