From: Peter Zijlstra Date: Thu, 13 Jun 2019 13:43:18 +0000 (+0200) Subject: mips/atomic: Fix cmpxchg64 barriers X-Git-Tag: v5.4-rc1~80^2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dfc8d8de855d566eb83a27e58a69741de42a90da;p=thirdparty%2Fkernel%2Flinux.git mips/atomic: Fix cmpxchg64 barriers There were no memory barriers on the 32bit implementation of cmpxchg64(). Fix this. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Paul Burton --- diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h index f345a873742d9..59cf5cbb38834 100644 --- a/arch/mips/include/asm/cmpxchg.h +++ b/arch/mips/include/asm/cmpxchg.h @@ -290,10 +290,13 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, * will cause a build error unless cpu_has_64bits is a \ * compile-time constant 1. \ */ \ - if (cpu_has_64bits && kernel_uses_llsc) \ + if (cpu_has_64bits && kernel_uses_llsc) { \ + smp_mb__before_llsc(); \ __res = __cmpxchg64((ptr), __old, __new); \ - else \ + smp_llsc_mb(); \ + } else { \ __res = __cmpxchg64_unsupported(); \ + } \ \ __res; \ })