Re: [PATCHv2 11/11] arm64: use instrumented atomics

From: Will Deacon
Date: Wed Jul 04 2018 - 11:23:49 EST


On Mon, Jun 25, 2018 at 11:59:52AM +0100, Mark Rutland wrote:
> Now that the generic atomic headers provide instrumented wrappers of all
> the atomics implemented by arm64, let's migrate arm64 over to these.
>
> The additional instrumentation will help to find bugs (e.g. when fuzzing
> with Syzkaller).
>
> Mostly this change involes adding an arch_ prefix to a number of
> function names and macro definitions. Due to the way we call the LL/SC
> atomics via the LSE atomic wrappers, this requires adding an arch_
> prefix to some arm64-specific atomic primitives.
>
> Some unusual whitespace in the cmpxchg wrappers is fixed up as part of
> the change.
>
> Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Will Deacon <will.deacon@xxxxxxx>
> ---
> arch/arm64/include/asm/atomic.h | 237 ++++++++++++++++++-----------------
> arch/arm64/include/asm/atomic_lse.h | 51 ++++----
> arch/arm64/include/asm/cmpxchg.h | 106 ++++++++--------
> arch/arm64/include/asm/lse.h | 2 +-
> arch/arm64/include/asm/sync_bitops.h | 16 +--
> 5 files changed, 212 insertions(+), 200 deletions(-)

This is mostly straightforward, but the cmpxchg/cmpxchg_double cases grow
an 'arch' prefix which suggests that they're part of the API with the core
atomics and also makes them horribly ugly. This just looks to be an artifact
of __LL_SC_CALL pasting that in. Can you drop that auto pasting of 'arch',
and instead change the non-cmpxchg-case callers of the macro to include the
arch prefix instead, please?

Will