Commit ddc348c4 authored by Vineet Gupta's avatar Vineet Gupta

ARC: cmpxchg/xchg: implement relaxed variants (LLSC config only)

It only makes sense to do this for the LLSC config
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
parent e188f333
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
_prev; \ _prev; \
}) })
#define arch_cmpxchg(ptr, old, new) \ #define arch_cmpxchg_relaxed(ptr, old, new) \
({ \ ({ \
__typeof__(ptr) _p_ = (ptr); \ __typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _o_ = (old); \ __typeof__(*(ptr)) _o_ = (old); \
...@@ -47,12 +47,7 @@ ...@@ -47,12 +47,7 @@
\ \
switch(sizeof((_p_))) { \ switch(sizeof((_p_))) { \
case 4: \ case 4: \
/* \
* Explicit full memory barrier needed before/after \
*/ \
smp_mb(); \
_prev_ = __cmpxchg(_p_, _o_, _n_); \ _prev_ = __cmpxchg(_p_, _o_, _n_); \
smp_mb(); \
break; \ break; \
default: \ default: \
BUILD_BUG(); \ BUILD_BUG(); \
...@@ -108,16 +103,14 @@ ...@@ -108,16 +103,14 @@
_val_; /* get old value */ \ _val_; /* get old value */ \
}) })
#define arch_xchg(ptr, val) \ #define arch_xchg_relaxed(ptr, val) \
({ \ ({ \
__typeof__(ptr) _p_ = (ptr); \ __typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _val_ = (val); \ __typeof__(*(ptr)) _val_ = (val); \
\ \
switch(sizeof(*(_p_))) { \ switch(sizeof(*(_p_))) { \
case 4: \ case 4: \
smp_mb(); \
_val_ = __xchg(_p_, _val_); \ _val_ = __xchg(_p_, _val_); \
smp_mb(); \
break; \ break; \
default: \ default: \
BUILD_BUG(); \ BUILD_BUG(); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment