From abaee3963d0b67d8eaf75ce280ba6d255dc9b3ca Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 19 Feb 2023 21:07:41 +0000 Subject: [PATCH 1/2] sparc64: Add missing LoadStore ordering for mutex_enter stub. XXX pullup-8 XXX pullup-9 XXX pullup-10 --- sys/arch/sparc64/sparc64/lock_stubs.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arch/sparc64/sparc64/lock_stubs.s b/sys/arch/sparc64/sparc64/lock_stubs.s index c4f2be6271a3..f0c0ed6f8de2 100644 --- a/sys/arch/sparc64/sparc64/lock_stubs.s +++ b/sys/arch/sparc64/sparc64/lock_stubs.s @@ -41,7 +41,7 @@ #define CURLWP (CPUINFO_VA+CI_CURLWP) #if defined(MULTIPROCESSOR) -#define MB_READ membar #LoadLoad +#define MB_READ membar #LoadLoad | #LoadStore #define MB_MEM membar #LoadStore | #StoreStore #else #define MB_READ /* nothing */ From 8d57b44e86d4cdae5e5e8f182e19da873acd381e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 19 Feb 2023 21:09:43 +0000 Subject: [PATCH 2/2] sparc64: Rename internal barrier macros to be clearer. No functional change intended. --- sys/arch/sparc64/sparc64/lock_stubs.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arch/sparc64/sparc64/lock_stubs.s b/sys/arch/sparc64/sparc64/lock_stubs.s index f0c0ed6f8de2..605bc1159b6b 100644 --- a/sys/arch/sparc64/sparc64/lock_stubs.s +++ b/sys/arch/sparc64/sparc64/lock_stubs.s @@ -41,11 +41,11 @@ #define CURLWP (CPUINFO_VA+CI_CURLWP) #if defined(MULTIPROCESSOR) -#define MB_READ membar #LoadLoad | #LoadStore -#define MB_MEM membar #LoadStore | #StoreStore +#define MB_ACQ membar #LoadLoad | #LoadStore +#define MB_REL membar #LoadStore | #StoreStore #else -#define MB_READ /* nothing */ -#define MB_MEM /* nothing */ +#define MB_ACQ /* nothing */ +#define MB_REL /* nothing */ #endif #if !defined(LOCKDEBUG) @@ -58,7 +58,7 @@ ENTRY(mutex_enter) sethi %hi(CURLWP), %o1 LDPTR [%o1 + %lo(CURLWP)], %o1 ! current thread CASPTR [%o0], %g0, %o1 ! compare-and-swap - MB_READ + MB_ACQ brnz,pn %o1, 1f ! lock was unowned? nop retl ! - yes, done @@ -76,7 +76,7 @@ ENTRY(mutex_exit) sethi %hi(CURLWP), %o1 LDPTR [%o1 + %lo(CURLWP)], %o1 ! current thread clr %o2 ! new value (0) - MB_MEM + MB_REL CASPTR [%o0], %o1, %o2 ! compare-and-swap cmp %o1, %o2 bne,pn CCCR, 1f ! nope, hard case