locking/atomic: make ARCH_ATOMIC a Kconfig symbol
authorMark Rutland <mark.rutland@arm.com>
Tue, 25 May 2021 14:02:00 +0000 (15:02 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 26 May 2021 11:20:49 +0000 (13:20 +0200)
Subsequent patches will move architectures over to the ARCH_ATOMIC API,
after preparing the asm-generic atomic implementations to function with
or without ARCH_ATOMIC.

As some architectures use the asm-generic implementations exclusively
(and don't have a local atomic.h), and to avoid the risk that
ARCH_ATOMIC isn't defined in some cases we expect, let's make the
ARCH_ATOMIC macro a Kconfig symbol instead, so that we can guarantee it
is consistently available where needed.

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

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210525140232.53872-2-mark.rutland@arm.com
arch/Kconfig
arch/arm64/Kconfig
arch/arm64/include/asm/atomic.h
arch/s390/Kconfig
arch/s390/include/asm/atomic.h
arch/um/Kconfig
arch/x86/Kconfig
arch/x86/include/asm/atomic.h
include/linux/atomic.h

index c45b770d3579a3ef0ff9e482e452e88f40ade8b8..3fb3b12d4a958c6dbed70a664e4cb5c9c5204058 100644 (file)
@@ -11,6 +11,9 @@ source "arch/$(SRCARCH)/Kconfig"
 
 menu "General architecture-dependent options"
 
+config ARCH_ATOMIC
+       bool
+
 config CRASH_CORE
        bool
 
index 9f1d8566bbf95c9e56c2f284482edab5d9d92cb7..62ab429d1f42e6f33fc6f5274b5df3227bebd5cb 100644 (file)
@@ -9,6 +9,7 @@ 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
index b56a4b2bc24864081198bc104ab6f26d6855201c..c9979273d38981164bdfb6016760a9c77774f6aa 100644 (file)
@@ -223,6 +223,4 @@ static __always_inline long arch_atomic64_dec_if_positive(atomic64_t *v)
 
 #define arch_atomic64_dec_if_positive          arch_atomic64_dec_if_positive
 
-#define ARCH_ATOMIC
-
 #endif /* __ASM_ATOMIC_H */
index b4c7c34069f81a0e52e0cc4cefafbf381113fad5..85374a36c69e16ef0eaff127af64a921f622d180 100644 (file)
@@ -58,6 +58,7 @@ 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
index 7c93c6573524daad6f7122efc861467d3124feb4..7138d189cc420a2b4ca87b780503e7f4d53c9d7a 100644 (file)
@@ -147,6 +147,4 @@ ATOMIC64_OPS(xor)
 #define arch_atomic64_fetch_sub(_i, _v)  arch_atomic64_fetch_add(-(s64)(_i), _v)
 #define arch_atomic64_sub(_i, _v)       arch_atomic64_add(-(s64)(_i), _v)
 
-#define ARCH_ATOMIC
-
 #endif /* __ARCH_S390_ATOMIC__  */
index 57cfd9a1c082ee206bb96e64d330194cbf655edc..4370a9521ea4647061921ffdb52590a164939b7d 100644 (file)
@@ -5,6 +5,7 @@ menu "UML-specific options"
 config UML
        bool
        default y
+       select ARCH_ATOMIC
        select ARCH_EPHEMERAL_INODES
        select ARCH_HAS_KCOV
        select ARCH_NO_PREEMPT
index 0045e1b44190213e75a098390f18271c851d86ec..11a27563033dea07d49554f1fb8b30db06a91587 100644 (file)
@@ -58,6 +58,7 @@ 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
index f732741ad7c7252a63c811b62be6e4298d2a398c..5e754e89576719ae16f9b85fddedba830b1643b0 100644 (file)
@@ -269,6 +269,4 @@ static __always_inline int arch_atomic_fetch_xor(int i, atomic_t *v)
 # include <asm/atomic64_64.h>
 #endif
 
-#define ARCH_ATOMIC
-
 #endif /* _ASM_X86_ATOMIC_H */
index 571a11008ab5bb005bd7a4a8a9c727faee9aeffd..4f8d83f9e480a1c68e97480b2fcb04def3e4fcc7 100644 (file)
@@ -77,7 +77,7 @@
        __ret;                                                          \
 })
 
-#ifdef ARCH_ATOMIC
+#ifdef CONFIG_ARCH_ATOMIC
 #include <linux/atomic-arch-fallback.h>
 #include <asm-generic/atomic-instrumented.h>
 #else