riscv: atomic: Clean up unnecessary acquire and release definitions
Subsystems (3)
PATCH 1/1 riscv: atomic: Clean up unnecessary acquire and release definitions
From: Guo Ren <[email protected]>
Clean up unnecessary xchg_acquire, xchg_release, and cmpxchg_release custom definitions, because the generic implementation is the same as the riscv custom implementation.
Before the patch:000000000000024e <.LBB238>:
ops = xchg_acquire(pending_ipis, 0); 24e: 089937af amoswap.d a5,s1,(s2) 252: 0230000f fence r,rw
0000000000000256 <.LBB243>:
ops = xchg_release(pending_ipis, 0); 256: 0310000f fence rw,w 25a: 089934af amoswap.d s1,s1,(s2)
After the patch:000000000000026e <.LBB245>:
ops = xchg_acquire(pending_ipis, 0);
26e: 089937af amoswap.d a5,s1,(s2)
0000000000000272 <.LBE247>:
272: 0230000f fence r,rw
0000000000000276 <.LBB249>:
ops = xchg_release(pending_ipis, 0);
276: 0310000f fence rw,w
000000000000027a <.LBB251>:
27a: 089934af amoswap.d s1,s1,(s2)
Only cmpxchg_acquire is necessary (It prevents unnecessary acquire ordering when the value from lr is different from old).
--- arch/riscv/include/asm/atomic.h | 19 ----- arch/riscv/include/asm/cmpxchg.h | 116 ------------------------------- 2 files changed, 135 deletions(-)
arch/riscv/include/asm/atomic.h +0 -19
@@ -249,16 +249,6 @@ c_t arch_atomic##prefix##_xchg_relaxed(atomic##prefix##_t *v, c_t n) \return __xchg_relaxed (&(v->counter), n, size); \ } \ static __always_inline \ -c_t arch_atomic##prefix##_xchg_acquire(atomic##prefix##_t *v, c_t n) \ -{ \ - return __xchg_acquire(&(v->counter), n, size); \ -} \ -static __always_inline \ -c_t arch_atomic##prefix##_xchg_release(atomic##prefix##_t *v, c_t n) \ -{ \ - return __xchg_release(&(v->counter), n, size); \ -} \ -static __always_inline \ c_t arch_atomic##prefix##_xchg(atomic##prefix##_t *v, c_t n) \ { \ return __xchg(&(v->counter), n, size); \
@@ -276,12 +266,6 @@ c_t arch_atomic##prefix##_cmpxchg_acquire(atomic##prefix##_t *v, \return __cmpxchg_acquire (&(v->counter), o, n, size); \ } \ static __always_inline \ -c_t arch_atomic##prefix##_cmpxchg_release(atomic##prefix##_t *v, \ - c_t o, c_t n) \ -{ \ - return __cmpxchg_release(&(v->counter), o, n, size); \ -} \ -static __always_inline \ c_t arch_atomic##prefix##_cmpxchg(atomic##prefix##_t *v, c_t o, c_t n) \ { \ return __cmpxchg(&(v->counter), o, n, size); \
@@ -299,12 +283,9 @@ c_t arch_atomic##prefix##_cmpxchg(atomic##prefix##_t *v, c_t o, c_t n) \ ATOMIC_OPS()#define arch_atomic_xchg_relaxed arch_atomic_xchg_relaxed -#define arch_atomic_xchg_acquire arch_atomic_xchg_acquire -#define arch_atomic_xchg_release arch_atomic_xchg_release#define arch_atomic_xchg arch_atomic_xchg#define arch_atomic_cmpxchg_relaxed arch_atomic_cmpxchg_relaxed#define arch_atomic_cmpxchg_acquire arch_atomic_cmpxchg_acquire -#define arch_atomic_cmpxchg_release arch_atomic_cmpxchg_release#define arch_atomic_cmpxchg arch_atomic_cmpxchg#undef ATOMIC_OPS
arch/riscv/include/asm/cmpxchg.h +0 -116
128 lines not on this page · raw message
Signature · 1 line
2.36.1