Source-Changes-HG archive

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

[src/trunk]: src/sys/kern ipi(9): Convert membar_exit/enter to membar_release...



details:   https://anonhg.NetBSD.org/src/rev/a3dcfa40521f
branches:  trunk
changeset: 365172:a3dcfa40521f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 23:51:22 2022 +0000

description:
ipi(9): Convert membar_exit/enter to membar_release/acquire.

No store-before-load ordering needed here, just need to ensure that
in

        A, ipi_send, ipi receive, B,

memory operations in A happen-before memory operations in B.

diffstat:

 sys/kern/subr_ipi.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r 62b18bafb23a -r a3dcfa40521f sys/kern/subr_ipi.c
--- a/sys/kern/subr_ipi.c       Sat Apr 09 23:51:09 2022 +0000
+++ b/sys/kern/subr_ipi.c       Sat Apr 09 23:51:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_ipi.c,v 1.9 2020/11/27 20:11:33 riastradh Exp $   */
+/*     $NetBSD: subr_ipi.c,v 1.10 2022/04/09 23:51:22 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.9 2020/11/27 20:11:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.10 2022/04/09 23:51:22 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -190,7 +190,7 @@
        /* Mark as pending and return true if not previously marked. */
        if ((atomic_load_acquire(&ci->ci_ipipend[i]) & bitm) == 0) {
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-               membar_exit();
+               membar_release();
 #endif
                atomic_or_32(&ci->ci_ipipend[i], bitm);
                return true;
@@ -265,7 +265,7 @@
 /*
  * put_msg: insert message into the mailbox.
  *
- * Caller is responsible for issuing membar_exit first.
+ * Caller is responsible for issuing membar_release first.
  */
 static inline void
 put_msg(ipi_mbox_t *mbox, ipi_msg_t *msg)
@@ -304,7 +304,7 @@
                }
                pending = atomic_swap_32(&ci->ci_ipipend[i], 0);
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-               membar_enter();
+               membar_acquire();
 #endif
                while ((bit = ffs(pending)) != 0) {
                        const u_int ipi_id = (i << IPI_BITW_SHIFT) | --bit;
@@ -342,7 +342,7 @@
 
                /* Ack the request. */
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-               membar_exit();
+               membar_release();
 #endif
                atomic_dec_uint(&msg->_pending);
        }
@@ -365,7 +365,7 @@
 
        msg->_pending = 1;
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
 
        put_msg(&ipi_mboxes[id], msg);
@@ -391,7 +391,7 @@
        local = !!kcpuset_isset(target, cpu_index(self));
        msg->_pending = kcpuset_countset(target) - local;
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
 
        for (CPU_INFO_FOREACH(cii, ci)) {
@@ -429,7 +429,7 @@
 
        msg->_pending = ncpu - 1;
 #ifndef __HAVE_ATOMIC_AS_MEMBAR
-       membar_exit();
+       membar_release();
 #endif
 
        /* Broadcast IPIs for remote CPUs. */



Home | Main Index | Thread Index | Old Index