Re: [PATCH 14/33] locking/atomic: arc: move to ARCH_ATOMIC

From: Mark Rutland
Date: Mon May 10 2021 - 11:00:20 EST


On Mon, May 10, 2021 at 10:37:34AM +0100, Mark Rutland wrote:
> We'd like all architectures to convert to ARCH_ATOMIC, as once all
> architectures are converted it will be possible to make significant
> cleanups to the atomics headers, and this will make it much easier to
> generically enable atomic functionality (e.g. debug logic in the
> instrumented wrappers).
>
> As a step towards that, this patch migrates arc to ARCH_ATOMIC. The arch
> code provides arch_{atomic,atomic64,xchg,cmpxchg}*(), and common code
> wraps these with optional instrumentation to provide the regular
> functions.
>
> Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Boqun Feng <boqun.feng@xxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> ---
> arch/arc/Kconfig | 1 +
> arch/arc/include/asm/atomic.h | 56 +++++++++++++++++++++---------------------
> arch/arc/include/asm/cmpxchg.h | 8 +++---
> 3 files changed, 33 insertions(+), 32 deletions(-)

I evidently missed atomic_xchg() in asm/cmpxchg.h, so the fixup below is
needed. I've pushed that to my branch on kernel.org for now.

Mark.

---->8----
diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 87666980b78a..d1781bdf6527 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -153,6 +153,6 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr,
* can't be clobbered by others. Thus no serialization required when
* atomic_xchg is involved.
*/
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
+#define arch_atomic_xchg(v, new) (arch_xchg(&((v)->counter), new))

#endif