Skip to content

Commit

Permalink
locking/atomic: delete !ARCH_ATOMIC remnants
Browse files Browse the repository at this point in the history
Now that all architectures implement ARCH_ATOMIC, we can make it
mandatory, removing the Kconfig symbol and logic for !ARCH_ATOMIC.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Will Deacon <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
Mark Rutland authored and Peter Zijlstra committed May 26, 2021
1 parent b9b1297 commit 3c18851
Show file tree
Hide file tree
Showing 31 changed files with 3 additions and 2,718 deletions.
3 changes: 0 additions & 3 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ source "arch/$(SRCARCH)/Kconfig"

menu "General architecture-dependent options"

config ARCH_ATOMIC
bool

config CRASH_CORE
bool

Expand Down
1 change: 0 additions & 1 deletion arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config ALPHA
bool
default y
select ARCH_ATOMIC
select ARCH_32BIT_USTAT_F_TINODE
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
Expand Down
1 change: 0 additions & 1 deletion arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
config ARC
def_bool y
select ARC_TIMERS
select ARCH_ATOMIC
select ARCH_HAS_CACHE_LINE_SIZE
select ARCH_HAS_DEBUG_VM_PGTABLE
select ARCH_HAS_DMA_PREP_COHERENT
Expand Down
1 change: 0 additions & 1 deletion arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ config ARM
bool
default y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_BINFMT_FLAT
select ARCH_HAS_DEBUG_VIRTUAL if MMU
select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ config ARM64
select ACPI_MCFG if (ACPI && PCI)
select ACPI_SPCR_TABLE if ACPI
select ACPI_PPTT if ACPI
select ARCH_ATOMIC
select ARCH_HAS_DEBUG_WX
select ARCH_BINFMT_ELF_STATE
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
Expand Down
1 change: 0 additions & 1 deletion arch/csky/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config CSKY
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_SYNC_DMA_FOR_CPU
Expand Down
1 change: 0 additions & 1 deletion arch/h8300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config H8300
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_BINFMT_FLAT
select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
select BINFMT_FLAT_OLD_ALWAYS_RAM
Expand Down
1 change: 0 additions & 1 deletion arch/hexagon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ comment "Linux Kernel Configuration for Hexagon"
config HEXAGON
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
select ARCH_NO_PREEMPT
# Other pending projects/to-do items.
Expand Down
1 change: 0 additions & 1 deletion arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ menu "Processor type and features"

config IA64
bool
select ARCH_ATOMIC
select ARCH_HAS_DMA_MARK_CLEAN
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ config M68K
bool
default y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_BINFMT_FLAT
select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config MICROBLAZE
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_NO_SWAP
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_GCOV_PROFILE_ALL
Expand Down
1 change: 0 additions & 1 deletion arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ config MIPS
bool
default y
select ARCH_32BIT_OFF_T if !64BIT
select ARCH_ATOMIC
select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
select ARCH_HAS_DEBUG_VIRTUAL if !64BIT
select ARCH_HAS_FORTIFY_SOURCE
Expand Down
1 change: 0 additions & 1 deletion arch/nds32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
config NDS32
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
Expand Down
1 change: 0 additions & 1 deletion arch/nios2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config NIOS2
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_SYNC_DMA_FOR_CPU
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
config OPENRISC
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_DMA_SET_UNCACHED
select ARCH_HAS_DMA_CLEAR_UNCACHED
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
Expand Down
1 change: 0 additions & 1 deletion arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config PARISC
def_bool y
select ARCH_32BIT_OFF_T if !64BIT
select ARCH_ATOMIC
select ARCH_MIGHT_HAVE_PC_PARPORT
select HAVE_IDE
select HAVE_FUNCTION_TRACER
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ config PPC
# Please keep this list sorted alphabetically.
#
select ARCH_32BIT_OFF_T if PPC32
select ARCH_ATOMIC
select ARCH_ENABLE_MEMORY_HOTPLUG
select ARCH_ENABLE_MEMORY_HOTREMOVE
select ARCH_HAS_COPY_MC if PPC64
Expand Down
1 change: 0 additions & 1 deletion arch/riscv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ config 32BIT

config RISCV
def_bool y
select ARCH_ATOMIC
select ARCH_CLOCKSOURCE_INIT
select ARCH_SUPPORTS_ATOMIC_RMW
select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU
Expand Down
1 change: 0 additions & 1 deletion arch/s390/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ config S390
# Note: keep this list sorted alphabetically
#
imply IMA_SECURE_AND_OR_TRUSTED_BOOT
select ARCH_ATOMIC
select ARCH_32BIT_USTAT_F_TINODE
select ARCH_BINFMT_ELF_STATE
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
Expand Down
1 change: 0 additions & 1 deletion arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config SUPERH
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM && MMU
select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU
select ARCH_HAVE_CUSTOM_GPIO_H
Expand Down
1 change: 0 additions & 1 deletion arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config 64BIT
config SPARC
bool
default y
select ARCH_ATOMIC
select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
select ARCH_MIGHT_HAVE_PC_SERIO
select DMA_OPS
Expand Down
1 change: 0 additions & 1 deletion arch/um/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ menu "UML-specific options"
config UML
bool
default y
select ARCH_ATOMIC
select ARCH_EPHEMERAL_INODES
select ARCH_HAS_KCOV
select ARCH_NO_PREEMPT
Expand Down
1 change: 0 additions & 1 deletion arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ config X86
#
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ARCH_ATOMIC
select ARCH_32BIT_OFF_T if X86_32
select ARCH_CLOCKSOURCE_INIT
select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION
Expand Down
1 change: 0 additions & 1 deletion arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
config XTENSA
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_ATOMIC
select ARCH_HAS_BINFMT_FLAT if !MMU
select ARCH_HAS_DMA_PREP_COHERENT if MMU
select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
Expand Down
44 changes: 3 additions & 41 deletions include/asm-generic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
#include <asm/cmpxchg.h>
#include <asm/barrier.h>

#ifdef CONFIG_ARCH_ATOMIC
#define __ga_cmpxchg arch_cmpxchg
#define __ga_xchg arch_xchg
#else
#define __ga_cmpxchg cmpxchg
#define __ga_xchg xchg
#endif

#ifdef CONFIG_SMP

/* we can build all atomic primitives from cmpxchg */
Expand All @@ -30,7 +22,7 @@ static inline void generic_atomic_##op(int i, atomic_t *v) \
int c, old; \
\
c = v->counter; \
while ((old = __ga_cmpxchg(&v->counter, c, c c_op i)) != c) \
while ((old = arch_cmpxchg(&v->counter, c, c c_op i)) != c) \
c = old; \
}

Expand All @@ -40,7 +32,7 @@ static inline int generic_atomic_##op##_return(int i, atomic_t *v) \
int c, old; \
\
c = v->counter; \
while ((old = __ga_cmpxchg(&v->counter, c, c c_op i)) != c) \
while ((old = arch_cmpxchg(&v->counter, c, c c_op i)) != c) \
c = old; \
\
return c c_op i; \
Expand All @@ -52,7 +44,7 @@ static inline int generic_atomic_fetch_##op(int i, atomic_t *v) \
int c, old; \
\
c = v->counter; \
while ((old = __ga_cmpxchg(&v->counter, c, c c_op i)) != c) \
while ((old = arch_cmpxchg(&v->counter, c, c c_op i)) != c) \
c = old; \
\
return c; \
Expand Down Expand Up @@ -120,11 +112,6 @@ ATOMIC_OP(xor, ^)
#undef ATOMIC_OP_RETURN
#undef ATOMIC_OP

#undef __ga_cmpxchg
#undef __ga_xchg

#ifdef CONFIG_ARCH_ATOMIC

#define arch_atomic_add_return generic_atomic_add_return
#define arch_atomic_sub_return generic_atomic_sub_return

Expand All @@ -146,29 +133,4 @@ ATOMIC_OP(xor, ^)
#define arch_atomic_xchg(ptr, v) (arch_xchg(&(ptr)->counter, (v)))
#define arch_atomic_cmpxchg(v, old, new) (arch_cmpxchg(&((v)->counter), (old), (new)))

#else /* CONFIG_ARCH_ATOMIC */

#define atomic_add_return generic_atomic_add_return
#define atomic_sub_return generic_atomic_sub_return

#define atomic_fetch_add generic_atomic_fetch_add
#define atomic_fetch_sub generic_atomic_fetch_sub
#define atomic_fetch_and generic_atomic_fetch_and
#define atomic_fetch_or generic_atomic_fetch_or
#define atomic_fetch_xor generic_atomic_fetch_xor

#define atomic_add generic_atomic_add
#define atomic_sub generic_atomic_sub
#define atomic_and generic_atomic_and
#define atomic_or generic_atomic_or
#define atomic_xor generic_atomic_xor

#define atomic_read(v) READ_ONCE((v)->counter)
#define atomic_set(v, i) WRITE_ONCE(((v)->counter), (i))

#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))

#endif /* CONFIG_ARCH_ATOMIC */

#endif /* __ASM_GENERIC_ATOMIC_H */
29 changes: 0 additions & 29 deletions include/asm-generic/atomic64.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ extern s64 generic_atomic64_cmpxchg(atomic64_t *v, s64 o, s64 n);
extern s64 generic_atomic64_xchg(atomic64_t *v, s64 new);
extern s64 generic_atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u);

#ifdef CONFIG_ARCH_ATOMIC

#define arch_atomic64_read generic_atomic64_read
#define arch_atomic64_set generic_atomic64_set
#define arch_atomic64_set_release generic_atomic64_set
Expand All @@ -74,31 +72,4 @@ extern s64 generic_atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u);
#define arch_atomic64_xchg generic_atomic64_xchg
#define arch_atomic64_fetch_add_unless generic_atomic64_fetch_add_unless

#else /* CONFIG_ARCH_ATOMIC */

#define atomic64_read generic_atomic64_read
#define atomic64_set generic_atomic64_set
#define atomic64_set_release generic_atomic64_set

#define atomic64_add generic_atomic64_add
#define atomic64_add_return generic_atomic64_add_return
#define atomic64_fetch_add generic_atomic64_fetch_add
#define atomic64_sub generic_atomic64_sub
#define atomic64_sub_return generic_atomic64_sub_return
#define atomic64_fetch_sub generic_atomic64_fetch_sub

#define atomic64_and generic_atomic64_and
#define atomic64_fetch_and generic_atomic64_fetch_and
#define atomic64_or generic_atomic64_or
#define atomic64_fetch_or generic_atomic64_fetch_or
#define atomic64_xor generic_atomic64_xor
#define atomic64_fetch_xor generic_atomic64_fetch_xor

#define atomic64_dec_if_positive generic_atomic64_dec_if_positive
#define atomic64_cmpxchg generic_atomic64_cmpxchg
#define atomic64_xchg generic_atomic64_xchg
#define atomic64_fetch_add_unless generic_atomic64_fetch_add_unless

#endif /* CONFIG_ARCH_ATOMIC */

#endif /* _ASM_GENERIC_ATOMIC64_H */
21 changes: 0 additions & 21 deletions include/asm-generic/cmpxchg.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size)
__generic_cmpxchg64_local((ptr), (o), (n))


#ifdef CONFIG_ARCH_ATOMIC

#ifndef arch_xchg
#define arch_xchg generic_xchg
#endif
Expand All @@ -114,23 +112,4 @@ unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size)
#define arch_cmpxchg arch_cmpxchg_local
#define arch_cmpxchg64 arch_cmpxchg64_local

#else /* CONFIG_ARCH_ATOMIC */

#ifndef xchg
#define xchg generic_xchg
#endif

#ifndef cmpxchg_local
#define cmpxchg_local generic_cmpxchg_local
#endif

#ifndef cmpxchg64_local
#define cmpxchg64_local generic_cmpxchg64_local
#endif

#define cmpxchg cmpxchg_local
#define cmpxchg64 cmpxchg64_local

#endif /* CONFIG_ARCH_ATOMIC */

#endif /* __ASM_GENERIC_CMPXCHG_H */
Loading

0 comments on commit 3c18851

Please sign in to comment.