lkml.org 
[lkml]   [2018]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCHv2 04/16] atomics/treewide: make atomic_fetch_add_unless() optional
From
On Tue, 29 May 2018 08:43:34 PDT (-0700), mark.rutland@arm.com wrote:
> Several architectures these have a near-identical implementation based
> on atomic_read() and atomic_cmpxchg() that we can instead define in
> <linux/atomic.h>, so let's do so, using something close to the existing
> x86 implementation with try_cmpxchg().
>
> Where an architecture provides its own atomic_fetch_add_unless(), it
> must define a preprocessor symbol for it. The instrumented atomics are
> updated accordingly.
>
> Note that arch/arc's existing atomic_fetch_add_unless() had redundant
> barriers, as these are already present in its atomic_cmpxchg()
> implementation.
>
> There should be no functional change as a result of this patch.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Boqun Feng <boqun.feng@gmail.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> ---
> arch/alpha/include/asm/atomic.h | 2 +-
> arch/arc/include/asm/atomic.h | 28 ----------------------------
> arch/arm/include/asm/atomic.h | 11 +----------
> arch/arm64/include/asm/atomic.h | 1 -
> arch/h8300/include/asm/atomic.h | 1 +
> arch/hexagon/include/asm/atomic.h | 1 +
> arch/ia64/include/asm/atomic.h | 16 ----------------
> arch/m68k/include/asm/atomic.h | 15 ---------------
> arch/mips/include/asm/atomic.h | 24 ------------------------
> arch/parisc/include/asm/atomic.h | 24 ------------------------
> arch/powerpc/include/asm/atomic.h | 1 +
> arch/riscv/include/asm/atomic.h | 1 +
> arch/s390/include/asm/atomic.h | 15 ---------------
> arch/sh/include/asm/atomic.h | 25 -------------------------
> arch/sparc/include/asm/atomic_32.h | 2 ++
> arch/sparc/include/asm/atomic_64.h | 15 ---------------
> arch/x86/include/asm/atomic.h | 21 ---------------------
> arch/xtensa/include/asm/atomic.h | 24 ------------------------
> include/asm-generic/atomic-instrumented.h | 4 +++-
> include/asm-generic/atomic.h | 11 -----------
> include/linux/atomic.h | 23 +++++++++++++++++++++++
> 21 files changed, 34 insertions(+), 231 deletions(-)
> [...]
> diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h
> index 18259e90f57e..5f161daefcd2 100644
> --- a/arch/riscv/include/asm/atomic.h
> +++ b/arch/riscv/include/asm/atomic.h
> @@ -349,6 +349,7 @@ static __always_inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
> : "memory");
> return prev;
> }
> +#define atomic_fetch_add_unless atomic_fetch_add_unless
>
> #ifndef CONFIG_GENERIC_ATOMIC64
> static __always_inline long __atomic64_add_unless(atomic64_t *v, long a, long u)

Acked-by: Palmer Dabbelt <palmer@sifive.com>

Thanks!

\
 
 \ /
  Last update: 2018-06-05 01:26    [W:0.167 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site