ARC: cmpxchg/xchg: implement relaxed variants (LLSC config only)
authorVineet Gupta <vgupta@kernel.org>
Sat, 9 May 2020 07:15:36 +0000 (00:15 -0700)
committerVineet Gupta <vgupta@kernel.org>
Tue, 24 Aug 2021 21:25:47 +0000 (14:25 -0700)
It only makes sense to do this for the LLSC config

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
arch/arc/include/asm/cmpxchg.h

index 00deb07..e2ae0eb 100644 (file)
@@ -38,7 +38,7 @@
        _prev;                                                          \
 })
 
-#define arch_cmpxchg(ptr, old, new)                                    \
+#define arch_cmpxchg_relaxed(ptr, old, new)                            \
 ({                                                                     \
        __typeof__(ptr) _p_ = (ptr);                                    \
        __typeof__(*(ptr)) _o_ = (old);                                 \
                                                                        \
        switch(sizeof((_p_))) {                                         \
        case 4:                                                         \
-               /*                                                      \
-                * Explicit full memory barrier needed before/after     \
-                */                                                     \
-               smp_mb();                                               \
                _prev_ = __cmpxchg(_p_, _o_, _n_);                      \
-               smp_mb();                                               \
                break;                                                  \
        default:                                                        \
                BUILD_BUG();                                            \
        _val_;          /* get old value */                             \
 })
 
-#define arch_xchg(ptr, val)                                            \
+#define arch_xchg_relaxed(ptr, val)                                    \
 ({                                                                     \
        __typeof__(ptr) _p_ = (ptr);                                    \
        __typeof__(*(ptr)) _val_ = (val);                               \
                                                                        \
        switch(sizeof(*(_p_))) {                                        \
        case 4:                                                         \
-               smp_mb();                                               \
                _val_ = __xchg(_p_, _val_);                             \
-               smp_mb();                                               \
                break;                                                  \
        default:                                                        \
                BUILD_BUG();                                            \