From e1c5d1a976dcb70db107b05c7a39ec80c5ba4037 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 31 Mar 2022 02:42:27 +0000 Subject: [PATCH 44/49] 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. --- sys/kern/subr_ipi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/subr_ipi.c b/sys/kern/subr_ipi.c index 3d76d764a55c..1598df1cbf79 100644 --- a/sys/kern/subr_ipi.c +++ b/sys/kern/subr_ipi.c @@ -190,7 +190,7 @@ ipi_mark_pending(u_int ipi_id, struct cpu_info *ci) /* 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 @@ ipi_trigger_broadcast(u_int ipi_id, bool skip_self) /* * 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 @@ ipi_cpu_handler(void) } 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 @@ ipi_msg_cpu_handler(void *arg __unused) /* Ack the request. */ #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif atomic_dec_uint(&msg->_pending); } @@ -365,7 +365,7 @@ ipi_unicast(ipi_msg_t *msg, struct cpu_info *ci) msg->_pending = 1; #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif put_msg(&ipi_mboxes[id], msg); @@ -391,7 +391,7 @@ ipi_multicast(ipi_msg_t *msg, const kcpuset_t *target) 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 @@ ipi_broadcast(ipi_msg_t *msg, bool skip_self) msg->_pending = ncpu - 1; #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif /* Broadcast IPIs for remote CPUs. */ -- 2.33.0