Re: [RFC][PATCH 05/12] arch: Introduce arch_{,try_}_cmpxchg128{,_local}()
- From
- Peter Zijlstra <peterz@infradead.org>
- Date
- 2023-01-12 10:44:31
- Also in
- linux-arch, linux-crypto, linux-iommu, linux-mm, linux-s390, lkml
- Reply to
- Mark Rutland, 2023-01-09
On Mon, Jan 09, 2023 at 06:50:24PM +0000, Mark Rutland wrote:
Similarly, I'd suggest:
| #define __CMPXCHG128(name, mb, cl...) \
| static __always_inline u128 \
| __lse__cmpxchg128##name(volatile u128 *ptr, u128 old, u128 new) \
| { \
| asm volatile( \
| __LSE_PREAMBLE \
| " casp" #mb "\t%[old], %H[old], %[new], %H[new], %[v]\n" \
| : [old] "+&r" (old), \
| [v] "+Q" (*(u128 *)ptr) \
| : [new] "r" (new) \
| : cl); \
| \
| return old; \
| }
|
| __CMPXCHG128( , )
| __CMPXCHG128(_mb, al, "memory")
|
| #undef __CMPXCHG128
clang-16 seems to hate on this like:
arch/arm64/include/asm/atomic_lse.h:342:1: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
arch/arm64/include/asm/atomic_lse.h:334:17: note: expanded from macro '__CMPXCHG128'
: [old] "+&r" (old), \
^
(much the same for the ll_sc version; if you want the full build thing,
holler and I'll bounce you the robot mail).