From b346731bff648fd15e9fc524ab5247713dac296b Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastradh@NetBSD.org>
Date: Thu, 31 Mar 2022 02:05:19 +0000
Subject: [PATCH 26/50] alpha: Convert ipifuncs.c to membar_release/acquire.

---
 sys/arch/alpha/alpha/ipifuncs.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/arch/alpha/alpha/ipifuncs.c b/sys/arch/alpha/alpha/ipifuncs.c
index 39a049020166..79d28595b21f 100644
--- a/sys/arch/alpha/alpha/ipifuncs.c
+++ b/sys/arch/alpha/alpha/ipifuncs.c
@@ -127,10 +127,11 @@ alpha_ipi_process(struct cpu_info *ci, struct trapframe *framep)
 
 	while ((pending_ipis = atomic_swap_ulong(&ci->ci_ipis, 0)) != 0) {
 		/*
-		 * Ensure the atomic swap is globally visible before
-		 * we do any of the work.
+		 * Ensure everything before setting ci_ipis
+		 * happens-before everything after swapping ci_ipis so
+		 * we're not working on stale inputs.
 		 */
-		membar_enter();
+		membar_acquire();
 
 		sc->sc_evcnt_ipi.ev_count++;
 
@@ -159,7 +160,7 @@ alpha_send_ipi(u_long const cpu_id, u_long const ipimask)
 	 * alpha_send_ipi() have completed before informing
 	 * the CPU of the work we are asking it to do.
 	 */
-	membar_exit();
+	membar_release();
 	atomic_or_ulong(&cpu_info[cpu_id]->ci_ipis, ipimask);
 
 	/*