From patchwork Tue May 15 22:51:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10402247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C2BF601E9 for ; Tue, 15 May 2018 22:52:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CB3228622 for ; Tue, 15 May 2018 22:52:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EE9F28687; Tue, 15 May 2018 22:52:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FBF628622 for ; Tue, 15 May 2018 22:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbeEOWwv (ORCPT ); Tue, 15 May 2018 18:52:51 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:12445 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbeEOWvb (ORCPT ); Tue, 15 May 2018 18:51:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1526424692; x=1557960692; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=XRfJ/sRwSz1jT9sM9j69/T/dSyve2rMPrOtiKK6XnXE=; b=AxBoW9249Y1Qz8GhId16yoVWEk5wv7diyQqlk3l6xfyKgxeOYoVvSC7/ ei+j0/aM93sP520kmikr8oZKXKu8FygPSjvjDiMYSb0nkLmRoTnDcNXK3 lrr5NWjorADjCOtRp8wGJHfeZnZsio1NCAQHabcdPiLoKhnh3qdZKIMb3 wODM5UUIMc8ZM1N4DZkY9EpjM4CAyiiKFYr9MEosML6T2Pr2qSwN/hniA YPIji+E5Ih46eNgBZCzUGNl8m5ghpThlhnAvzqWlLTV135TIJwFV67gqp 7poY51iiUHqtINYXmCMiUYJoXxta+VnZQdxKwVM03DThxl2yKz0tAyFRe w==; X-IronPort-AV: E=Sophos;i="5.49,404,1520870400"; d="scan'208";a="78256993" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 16 May 2018 06:51:31 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 15 May 2018 15:42:37 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.70.1]) by uls-op-cesaip01.wdc.com with ESMTP; 15 May 2018 15:51:31 -0700 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Geert Uytterhoeven , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Martin Schwidefsky , Heiko Carstens , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Chris Zankel , Max Filippov , Arnd Bergmann , Jonathan Corbet Subject: [PATCH v10 1/2] arch/*: Add CONFIG_ARCH_HAVE_CMPXCHG64 Date: Tue, 15 May 2018 15:51:20 -0700 Message-Id: <20180515225124.20428-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180515225124.20428-1-bart.vanassche@wdc.com> References: <20180515225124.20428-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The next patch in this series introduces a call to cmpxchg64() in the block layer core for those architectures on which this functionality is available. Make it possible to test whether cmpxchg64() is available by introducing CONFIG_ARCH_HAVE_CMPXCHG64. Signed-off-by: Bart Van Assche Cc: Catalin Marinas Cc: Will Deacon Cc: Tony Luck Cc: Fenghua Yu Cc: Geert Uytterhoeven Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: David S. Miller Cc: Thomas Gleixner Cc: Ingo Molnar Cc: H. Peter Anvin Cc: Chris Zankel Cc: Max Filippov Cc: Arnd Bergmann Cc: Jonathan Corbet Acked-by: Michael Ellerman (powerpc) --- .../features/locking/cmpxchg64/arch-support.txt | 33 ++++++++++++++++++++++ arch/Kconfig | 3 ++ arch/alpha/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/riscv/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/xtensa/Kconfig | 1 + 15 files changed, 49 insertions(+) create mode 100644 Documentation/features/locking/cmpxchg64/arch-support.txt diff --git a/Documentation/features/locking/cmpxchg64/arch-support.txt b/Documentation/features/locking/cmpxchg64/arch-support.txt new file mode 100644 index 000000000000..84bfef7242b2 --- /dev/null +++ b/Documentation/features/locking/cmpxchg64/arch-support.txt @@ -0,0 +1,33 @@ +# +# Feature name: cmpxchg64 +# Kconfig: ARCH_HAVE_CMPXCHG64 +# description: arch supports the cmpxchg64() API +# + ----------------------- + | arch |status| + ----------------------- + | alpha: | ok | + | arc: | .. | + | arm: | ok | + | arm64: | ok | + | c6x: | .. | + | h8300: | .. | + | hexagon: | .. | + | ia64: | ok | + | m68k: | ok | + | microblaze: | .. | + | mips: | ok | + | nds32: | .. | + | nios2: | .. | + | openrisc: | .. | + | parisc: | ok | + | powerpc: | ok | + | riscv: | ok | + | s390: | ok | + | sh: | .. | + | sparc: | ok | + | um: | .. | + | unicore32: | .. | + | x86: | ok | + | xtensa: | ok | + ----------------------- diff --git a/arch/Kconfig b/arch/Kconfig index 8e0d665c8d53..bd54eb125b15 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -358,6 +358,9 @@ config HAVE_ALIGNED_STRUCT_PAGE on a struct page for better performance. However selecting this might increase the size of a struct page by a word. +config ARCH_HAVE_CMPXCHG64 + bool + config HAVE_CMPXCHG_LOCAL bool diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index b2022885ced8..583bd32c90a7 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig @@ -15,6 +15,7 @@ config ALPHA select AUTO_IRQ_AFFINITY if SMP select GENERIC_IRQ_SHOW select ARCH_WANT_IPC_PARSE_VERSION + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select AUDIT_ARCH select GENERIC_CLOCKEVENTS diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a7f8e7f4b88f..02c75697176e 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -13,6 +13,7 @@ config ARM select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL select ARCH_HAS_STRICT_MODULE_RWX if MMU select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAVE_CMPXCHG64 if !THUMB2_KERNEL select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_MIGHT_HAVE_PC_PARPORT diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index eb2cf4938f6d..dd18d7ca38fa 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -22,6 +22,7 @@ config ARM64 select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_INLINE_READ_LOCK if !PREEMPT select ARCH_INLINE_READ_LOCK_BH if !PREEMPT diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index bbe12a038d21..31c49e1482e2 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -41,6 +41,7 @@ config IA64 select GENERIC_PENDING_IRQ if SMP select GENERIC_IRQ_SHOW select GENERIC_IRQ_LEGACY + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_IOMAP select GENERIC_SMP_IDLE_THREAD diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 785612b576f7..7b87cda3bbed 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -11,6 +11,7 @@ config M68K select GENERIC_ATOMIC64 select HAVE_UID16 select VIRT_TO_BUS + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS select GENERIC_CPU_DEVICES select GENERIC_IOMAP diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 225c95da23ce..088bca0fd9f2 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -7,6 +7,7 @@ config MIPS select ARCH_DISCARD_MEMBLOCK select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAVE_CMPXCHG64 if 64BIT select ARCH_SUPPORTS_UPROBES select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_CMPXCHG_LOCKREF if 64BIT diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index fc5a574c3482..166c30865255 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -30,6 +30,7 @@ config PARISC select GENERIC_ATOMIC64 if !64BIT select GENERIC_IRQ_PROBE select GENERIC_PCI_IOMAP + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select GENERIC_SMP_IDLE_THREAD select GENERIC_CPU_DEVICES diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c32a181a7cbb..901365d12dcd 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -149,6 +149,7 @@ config PPC select ARCH_HAS_UACCESS_FLUSHCACHE if PPC64 select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64 + select ARCH_HAVE_CMPXCHG64 if PPC64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index cd4fd85fde84..4f886a055ff6 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -8,6 +8,7 @@ config RISCV select OF select OF_EARLY_FLATTREE select OF_IRQ + select ARCH_HAVE_CMPXCHG64 select ARCH_WANT_FRAME_POINTERS select CLONE_BACKWARDS select COMMON_CLK diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 199ac3e4da1d..f05f7a76ba73 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -73,6 +73,7 @@ config S390 select ARCH_HAS_STRICT_KERNEL_RWX select ARCH_HAS_STRICT_MODULE_RWX select ARCH_HAS_UBSAN_SANITIZE_ALL + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_INLINE_READ_LOCK select ARCH_INLINE_READ_LOCK_BH diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 8767e45f1b2b..e3429b78c491 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -75,6 +75,7 @@ config SPARC64 select HAVE_PERF_EVENTS select PERF_USE_VMALLOC select IRQ_PREFLOW_FASTEOI + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select HAVE_C_RECORDMCOUNT select NO_BOOTMEM diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c07f492b871a..1721fcda9822 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -67,6 +67,7 @@ config X86 select ARCH_HAS_SYNC_CORE_BEFORE_USERMODE select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_ZONE_DEVICE if X86_64 + select ARCH_HAVE_CMPXCHG64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI select ARCH_MIGHT_HAVE_PC_PARPORT diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index c921e8bccdc8..0e5c77958fa3 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -4,6 +4,7 @@ config ZONE_DMA config XTENSA def_bool y + select ARCH_HAVE_CMPXCHG64 select ARCH_NO_COHERENT_DMA_MMAP if !MMU select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_IPC_PARSE_VERSION