From patchwork Mon Jan 29 21:06:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536393 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BA18C47DA9 for ; Mon, 29 Jan 2024 21:06:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD63B6B0095; Mon, 29 Jan 2024 16:06:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A87246B0098; Mon, 29 Jan 2024 16:06:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94F6F6B0099; Mon, 29 Jan 2024 16:06:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 863486B0095 for ; Mon, 29 Jan 2024 16:06:52 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5A755120B07 for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) X-FDA: 81733583064.17.5AA1D89 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf05.hostedemail.com (Postfix) with ESMTP id A0F4910002B for ; Mon, 29 Jan 2024 21:06:50 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=cc6AJwaW; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf05.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562410; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4eglKSuP5hRMgJDtYBM8e3IeHgtqbXrVeDIAVtroytM=; b=76v7jbdUzF9m6FNOb0CivcOYzecenUhXEH+a5wly8T5bIde7Vh1AVuZ2Lw4mdHSYRcS5Rs bdio95BX9osGYZDCQfe/TNdPSgsJXH+NXNkECZUOFiiXwZ/RTLenRGAmEYRTu9+sqo+qsb 1P1Lt1J5oQBdg//4mGuWoNecE8sLfg8= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=cc6AJwaW; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf05.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562410; a=rsa-sha256; cv=none; b=Cyw58mX3gDZgZOQ2+lxEixoK5XYCYz59N1q8utYL2E2acAElAB+iA4DQ5MKDQGxA6OWkBu 0aPBlGJbPR655KuJjljAbUHmTVj4z5RG7imzoUMfQn38SVN8URxaPsM0kGr+IKk1eurY03 7uj0J8L4KfLGeud9NLyxlvreCtW2sRs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562409; bh=J/9xbvTV5OyXm1sKq5praOxLctUBdW1K5E3YjxgQCJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cc6AJwaW53TEJB1C0GzSIJUzCi5gxtxRJraR4hxkjY2GxsNHMVrz6uJxMLtQ1zned Ef7iRius/wZhslKg0oQywqcSmk3PGgBdxZ6oGNhuk6jdn6fcLfQujEzp+MVsRJYcUF uZmpH2/Ys3VNZHySEu2ZNYw6+XPlXE7A6OAufT+0Z0TfLAG4YNuhZg/kbKrmnO2n+p PwONvdsMk5OkCjaSh4FhYhYkWT++n20q/PymRiR4jJ+xTPBMtcSZ+gDyadMQZ/xQ5A noWAjPXRAugfKSLLGG14W5SJRQMfmB/jnZWHGL5PKMdfiqGwl2IpZboxy9HzJZhR8p q4TbPNIbozRyQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17s32c2zVYT; Mon, 29 Jan 2024 16:06:49 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Subject: [RFC PATCH 1/7] Introduce cache_is_aliasing() across all architectures Date: Mon, 29 Jan 2024 16:06:25 -0500 Message-Id: <20240129210631.193493-2-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A0F4910002B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: xuo6pk9gitmnzarsrwuxfcnzzwy4ryrk X-HE-Tag: 1706562410-580998 X-HE-Meta: U2FsdGVkX192ZBEWfEFoKbaL3lbBW4u9Ffuvl1j8C1ug1yrhsRFsMvsQsg/wuKJTdG+6xyymN1ERyDFYIaLwN3d3+/ij879UiDrS8O7EbWmjQAvgmFOYS/n/1/AgyeXS0urT+Io1R0XFuxZ0WjpWjWIJeRR7CNWLxLNYRrKnwvx+P/IXQ3qFaSPcAODjLWaPD9lh+tbl1rKrOhAydPxp4BvwAdsTAUC0Ije1+0g9Ks3FC7O9tsI2fguMYEj8ax4QCNwIksiaHNN9Ijk6ap9nNtyvJ8JONIbsoo6qFpWYfDMCCQzvToSgY4MR17wfnXUr9Nr+rXUUtz39TiDLw1PnhOuydC1Z2v+eMCsSoBcqEu/vsYtzixMnBNQZkgV5GrI1WIvg4N82yFDBU4ueEBWdlLY1fZY41Wq6+qLVrwCgssx2qBUqtlpEcmmI0qWxEc9bl5qQtqx2y+id7s970LkMgos3xML1iTYQ4dwXRHbeL35l4vVqD3ii+McO6rY9+FfD87XO8NfNrd76Un6ac/aFSYAs7jsgdOttS3cuhfQ/puugux9Ytpp/2cEVIiyFZVBh4rCL/NMaqz7MrSYi8dbiEFDoDRuwX8LRvekOk6I6TXO2rG9pOCrFexckqoUKwuWNS4YObrn7ihFYUubaGKqOPV6Z4Jk99Rfl0Ph8FWLABQnljHItFugD1XO36OjSLhm4du7fmvpkV/5lTEFw+MDeJb+YvrDRm5ayRhRShCY76nhKHPGhtAKbp2LQPJVGVBMuO6+RFpTMElT9a7DPrqdCRpPRw2TWitt0FoVKKVkTFlipXe7fE2Vg53/Pdad+Jyr4mbYhbaPx0SZnpmFJp7jV1CECHnnKWXYrKzQ+pPBD40eTFNmsIYUZSQSD4DBQOWSjm06s58grXJMox/5+PoVDsWo6XhiV/mT7iaLuZux8ml/ohSWqKWO1HsdU0hYs9kFPPP98bxNmnSpa+i+9S0r K4uMcAKB hkvVJmG7GmvIS+7lUiAJ1N5koQ6qWp9CkldN6pcKpnDtX2H5DM5nbW+9lcuE1lWQg9TgrpS6PMjCZ/ar0z0ce6Fw/RobhiIVXscJ6CJFEh/ReltPHW2XioNcaN4xyWQjmq6wSCXJLL+K+Nx+nu91DFMKuTD0UUm++mut8SBMDTVyM+BGsSA7vRNb1k/J1aJX+uSkmpml90q4EjUipGFuMdlgH+oZxYlu76t3MkIi6KlSDtKvi57pr3HZIQv8BKv4V8eSy8AOVb8xA6uC5s8lWini+FMXping3s4fgQSGRxnSJVcwW4v1hJs3Kre43z8Aw/6EvDAzZygU9w++N9L4uN/cSJimQdWaBF7fEHqKJkRFBNVTyio+Cw/xdPhthxqTtdQnLH9cPrXC76Npa29kaKwrK3djmyR00XwvbHQSIa019fWxMy1uzDII9gzVBsCgjZqayxVJBq5brHhZiu/1OHkT9F3OvvrN8nSQDbHr5XNs+YOZ00M+52UiNYC2c0kSzpsZ4oq9WOXIAA7Ckk0heHlwT0LYyP6bb6SHUyn7poeDkn5+naMs5Y6wK9DjCquCU8CX/YV1jQs6VFYDXsfie7OiL8tzOtl7mTSENe/rwomuUlJGCFK8RI7JHPV6Y5UwA2AYffNPcGExAwfA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Introduce a generic way to query whether the dcache is virtually aliased on all architectures. Its purpose is to ensure that subsystems which are incompatible with virtually aliased caches (e.g. FS_DAX) can reliably query this. For dcache aliasing, there are three scenarios dependending on the architecture. Here is a breakdown based on my understanding: A) The dcache is always aliasing: (ARCH_HAS_CACHE_ALIASING=y) * arm V4, V5 (CPU_CACHE_VIVT) * arc * csky * m68k (note: shared memory mappings are incoherent ? SHMLBA is missing there.) * sh * parisc B) The dcache aliasing depends on querying CPU state at runtime: (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y) * arm V6, V6K (CPU_CACHE_VIPT) (cache_is_vipt_aliasing()) * mips (cpu_has_dc_aliases) * nios2 (NIOS2_DCACHE_SIZE > PAGE_SIZE) * sparc32 (vac_cache_size > PAGE_SIZE) * sparc64 (L1DCACHE_SIZE > PAGE_SIZE) * xtensa (DCACHE_WAY_SIZE > PAGE_SIZE) C) The dcache is never aliasing: * arm V7, V7M (unless ARM V6 or V6K are also present) (CPU_CACHE_VIPT) * alpha * arm64 (aarch64) * hexagon * loongarch (but with incoherent write buffers, which are disabled since commit d23b7795 ("LoongArch: Change SHMLBA from SZ_64K to PAGE_SIZE")) * microblaze * openrisc * powerpc * riscv * s390 * um * x86 Link: https://lore.kernel.org/lkml/20030910210416.GA24258@mail.jlokier.co.uk/ Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev --- arch/arc/Kconfig | 1 + arch/arm/include/asm/cachetype.h | 3 +++ arch/arm/mm/Kconfig | 2 ++ arch/csky/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mips/include/asm/cachetype.h | 9 +++++++++ arch/nios2/Kconfig | 1 + arch/nios2/include/asm/cachetype.h | 10 ++++++++++ arch/parisc/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/sparc/include/asm/cachetype.h | 14 ++++++++++++++ arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/cachetype.h | 10 ++++++++++ include/linux/cacheinfo.h | 8 ++++++++ mm/Kconfig | 10 ++++++++++ 17 files changed, 75 insertions(+) create mode 100644 arch/mips/include/asm/cachetype.h create mode 100644 arch/nios2/include/asm/cachetype.h create mode 100644 arch/sparc/include/asm/cachetype.h create mode 100644 arch/xtensa/include/asm/cachetype.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 1b0483c51cc1..969e6740bcf7 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -6,6 +6,7 @@ config ARC def_bool y select ARC_TIMERS + select ARCH_HAS_CACHE_ALIASING select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DMA_PREP_COHERENT diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h index e8c30430be33..b03054b35c74 100644 --- a/arch/arm/include/asm/cachetype.h +++ b/arch/arm/include/asm/cachetype.h @@ -16,6 +16,9 @@ extern unsigned int cacheid; #define cache_is_vipt() cacheid_is(CACHEID_VIPT) #define cache_is_vipt_nonaliasing() cacheid_is(CACHEID_VIPT_NONALIASING) #define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING) +#ifdef CONFIG_ARCH_HAS_CACHE_ALIASING_DYNAMIC +#define cache_is_aliasing() cache_is_vipt_aliasing() +#endif #define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED) #define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) #define icache_is_pipt() cacheid_is(CACHEID_PIPT) diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index c164cde50243..23af93cdc03d 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -539,9 +539,11 @@ config CPU_CACHE_NOP bool config CPU_CACHE_VIVT + select ARCH_HAS_CACHE_ALIASING bool config CPU_CACHE_VIPT + select ARCH_HAS_CACHE_ALIASING_DYNAMIC if CPU_V6 || CPU_V6K bool config CPU_CACHE_FA diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index cf2a6fd7dff8..439d7640deb8 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -2,6 +2,7 @@ config CSKY def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CACHE_ALIASING select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 4b3e93cac723..216338704f0a 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -3,6 +3,7 @@ config M68K bool default y select ARCH_32BIT_OFF_T + select ARCH_HAS_CACHE_ALIASING select ARCH_HAS_BINFMT_FLAT select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 797ae590ebdb..46981c507ceb 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CACHE_ALIASING_DYNAMIC select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 140000 select ARCH_HAS_DEBUG_VIRTUAL if !64BIT diff --git a/arch/mips/include/asm/cachetype.h b/arch/mips/include/asm/cachetype.h new file mode 100644 index 000000000000..ce16ccde1841 --- /dev/null +++ b/arch/mips/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MIPS_CACHETYPE_H +#define __ASM_MIPS_CACHETYPE_H + +#include + +#define cache_is_aliasing() cpu_has_dc_aliases + +#endif diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index d54464021a61..949dcf99e147 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -2,6 +2,7 @@ config NIOS2 def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CACHE_ALIASING_DYNAMIC select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE diff --git a/arch/nios2/include/asm/cachetype.h b/arch/nios2/include/asm/cachetype.h new file mode 100644 index 000000000000..f52a16cdb496 --- /dev/null +++ b/arch/nios2/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_NIOS2_CACHETYPE_H +#define __ASM_NIOS2_CACHETYPE_H + +#include +#include + +#define cache_is_aliasing() (NIOS2_DCACHE_SIZE > PAGE_SIZE) + +#endif diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index d14ccc948a29..e8c217744d83 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -8,6 +8,7 @@ config PARISC select HAVE_FUNCTION_GRAPH_TRACER select HAVE_SYSCALL_TRACEPOINTS select ARCH_WANT_FRAME_POINTERS + select ARCH_HAS_CACHE_ALIASING select ARCH_HAS_DMA_ALLOC if PA11 select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_STRICT_KERNEL_RWX diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 7500521b2b98..6465ef80c055 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -2,6 +2,7 @@ config SUPERH def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CACHE_ALIASING select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM && MMU select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..a5edcbfaf6f8 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -13,6 +13,7 @@ config 64BIT config SPARC bool default y + select ARCH_HAS_CACHE_ALIASING_DYNAMIC select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI select ARCH_MIGHT_HAVE_PC_SERIO select DMA_OPS diff --git a/arch/sparc/include/asm/cachetype.h b/arch/sparc/include/asm/cachetype.h new file mode 100644 index 000000000000..8871e461cf23 --- /dev/null +++ b/arch/sparc/include/asm/cachetype.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SPARC_CACHETYPE_H +#define __ASM_SPARC_CACHETYPE_H + +#include + +#ifdef CONFIG_SPARC32 +extern int vac_cache_size; +#define cache_is_aliasing() (vac_cache_size > PAGE_SIZE) +#else +#define cache_is_aliasing() (L1DCACHE_SIZE > PAGE_SIZE) +#endif + +#endif diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 7d792077e5fd..ae99aa88595a 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -2,6 +2,7 @@ config XTENSA def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_CACHE_ALIASING_DYNAMIC select ARCH_HAS_BINFMT_FLAT if !MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VM_PGTABLE diff --git a/arch/xtensa/include/asm/cachetype.h b/arch/xtensa/include/asm/cachetype.h new file mode 100644 index 000000000000..4329c885fe5f --- /dev/null +++ b/arch/xtensa/include/asm/cachetype.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_XTENSA_CACHETYPE_H +#define __ASM_XTENSA_CACHETYPE_H + +#include +#include + +#define cache_is_aliasing() (DCACHE_WAY_SIZE > PAGE_SIZE) + +#endif diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index d504eb4b49ab..86f9a099fd5d 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -138,4 +138,12 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level) #define use_arch_cache_info() (false) #endif +#ifdef CONFIG_ARCH_HAS_CACHE_ALIASING +#define cache_is_aliasing() true +#elif defined(CONFIG_ARCH_HAS_CACHE_ALIASING_DYNAMIC) +#include +#else +#define cache_is_aliasing() false +#endif + #endif /* _LINUX_CACHEINFO_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 57cd378c73d6..08f6ca0b465a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1016,6 +1016,16 @@ config IDLE_PAGE_TRACKING See Documentation/admin-guide/mm/idle_page_tracking.rst for more details. +# Architectures which alias the data cache (VIVT or VIPT with dcache +# aliasing) need to select this. +config ARCH_HAS_CACHE_ALIASING + bool + +# Architectures which need to query at runtime whether the data cache is +# aliased need to select this. +config ARCH_HAS_CACHE_ALIASING_DYNAMIC + bool + config ARCH_HAS_CACHE_LINE_SIZE bool From patchwork Mon Jan 29 21:06:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B1DAC47DB3 for ; Mon, 29 Jan 2024 21:06:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 139156B009A; Mon, 29 Jan 2024 16:06:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EA886B0098; Mon, 29 Jan 2024 16:06:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF2806B009B; Mon, 29 Jan 2024 16:06:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E05516B0098 for ; Mon, 29 Jan 2024 16:06:52 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 83BA51605E5 for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) X-FDA: 81733583064.18.357BE5F Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf18.hostedemail.com (Postfix) with ESMTP id E66541C001D for ; Mon, 29 Jan 2024 21:06:50 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=IBO1D6SV; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf18.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562411; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4Ra1m/Cllt9w2XTndfbRVxnB7YwnV+8/KylZWJDugxc=; b=Sv03GagkoKJDfSJpE8c62qMMjrlC4gYHITMMwtlpWVc3ehGtFXA2KjRZrw1Eur83ONNRSu GqEABhLfg3T2iAxr49sn6tRSfjrsEdQ1bRq46sjvTYPuTeu4M2rN8+kRgPrrG91AWJadX8 u4VgbyA99zP4anxiz6bWwEkl2pvYhD8= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=IBO1D6SV; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf18.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562411; a=rsa-sha256; cv=none; b=gv/REDdYCytDcHuLcsm+Av8tLNl09aOLhOXHovn9ciiK7Z0vh2Z9JzPaus/pjFaguYx3Of M2KhV3K48E2N4ToVsM4G8GBym+roW6CGC2r5ReB1uACeJgV8NZIWz/ns4cp2Osc1vhw+v3 tl3672RRgngqk5ItFPzHQNHdHtUhHXc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562409; bh=DRZ2yg+8WAlTHni5bhZssW4ALgjBmA8zDamvFNbz2wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBO1D6SVr6kuOxDwo+YKtrvcGFP5ZQytUZIn9EMCouTRbD33DxR9fRucjWYWLtOcA q1NOIdMWb4jdTarPKYG/Zomn22fefTasueYm03yyeEsgTLeqMl8a0kcWVF5CGDsVIy w4GdLEoNCMHYe3S1DCGYpTFwtfTxFyZEpoqI1oQ8K3frsxpOMRCVqcuvMlmg/I9+Lk aGfw/mJ9DsZ/eGckf3GDMcJjSjuBCwWtVdohFSdwlZ1JcfggC8Pl0WiYA2JrUyJf3k vIsJxMxTzHqXCFtkZQZzfb6WjI1Oi4By1B+ZclaNc8bVhlIkMZvn53NltXfdGwu96q 68dFRT0YKIr4A== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17s53WCzVXV; Mon, 29 Jan 2024 16:06:49 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 2/7] dax: Fix incorrect list of cache aliasing architectures Date: Mon, 29 Jan 2024 16:06:26 -0500 Message-Id: <20240129210631.193493-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: s8rxwuakqbxwpwj1zh9z4fddmw3nqkbn X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E66541C001D X-HE-Tag: 1706562410-96226 X-HE-Meta: U2FsdGVkX19GMh3AFMrNqUjROwPPpN2Yzyvjx/drm9DCTExgv05sJhw7yocUnF/SKM4TLIWHb959w75SeF1Q1ACRy5nhjLarJN/wzqDtfROtbI5r0WDSLPXIpE+bRwaOZuagnWFUWKntnzosg26bhi4JyAv911DHwTfzCyoLx8+kiVso0mXmR2hMMbSk49ivCQnKe9yypDMV+nE2FyboU7cpHA2XidVZ6qWJBh3vqpzCy8TJJA9txk+p7DEoqX92dysiD3UH/bUo/3yHkE4tUu6YC9xj/yXMKqniw7xed2eOLruAyAvdmjoiR9HqccT1fWCtJnt/ClJSlkKr2p+7/O8OEPmbQwqYymr10xPA8y1oxFr3aGM51gMNFAAkPQtHieznKtovr+T5zPap5Bl3rXMVhOrPE59aYRmWa9daS2bLHeJsclltDPkhpaqe1q8YCGx7WKKlPbByS5bq5yUUfEfp/k4NfilsZK0sQwG7EHWGZW6ODzwr8ie13vFzAJ0zMMD2RvrsmOA2Q5MkAbBZkMGgHxaZX662ru/eb+UiywOZT5caE8jb49epGIeLNlQ9/oucoaID1t/ERl94+CmDAWOje990/hkKnTzZnc0p5RfAghK5BMnNf1EydyyMkEhKxwUQqyTkbwY6wFblfkQmlruvTNjvMhbIB0wbfZwhLbCJHN2o9oaMR6itoctHcTLFd8vsfRhXthEOiNFEgGAqzKmQ5mFuhL6KWtZ3kCK4VnNYxXC39RTYZFWE7Edp6u+nU0KO+cGXHZFBOLZuZyNFqSOdOFBq8PA/j2jh0d9BCBgKWgK+lDfHXcmxruAMeTmyurnwvPpCT6KX4EaKWv39hWPxD7ZNgHFAebxmNIw7RQ6shJ5S5Or4l7I0+Wn4aBRiejFL1WgNS8aoZ6ArzFIOzPeUTQq5zdr0vpQcxsMhPU+30xK/IZy6ESKMrRFFAiFrOOvPkxVtuMNDWBeEL3H CWkUOzhl BwdP7q5vGAf91/c9OWnYQLPu/OV9htX15ALJhQfac0DtkkL2S6iFvGD2UfXThHQG451i6nMvKFtC1Q1FU7f0gO6rhGmry+gUugnxG6nu93cMz5G69ekG3rpTZBPCFBLmGOWlWVLUGd0S1/A2nGZuOpjIw+P+F6ahq6QnQOF5ngZpiyOAS/8v5l40MHMk67dFXkLiMed22WFh4zwfCkRDSNO3ALRRIMD3VrErb6E9Rzh70X48ADFYf2tMGPMocAzWSzjlUCcsEyrBzFk23Vtb50oQewd326FdO42rPPQo3We61n7qqfFQusu/v8eXpUjpMo/RonSguUS7S6iC7OgPk5WT4KDEJfYgtRRjcsjI937zUpSXLNba0uB0S+8+JY8U3RLIOPj1wlTGMgbUZSn+eDUd7uMMTH5MGpB9Hm9p96T6kiYAi7lV8wjZ7YCVNLPDKFLpRgyToJ81oFIdQNVn7tS5Vhx3S5tfIBAvh+4ounqU2dKDtDnGU5aJw2Cdczq0McQ0oMYqVqh56SKg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: fs/Kconfig:FS_DAX prevents DAX from building on architectures with virtually aliased dcache with: depends on !(ARM || MIPS || SPARC) This check is too broad (e.g. recent ARMv7 don't have virtually aliased dcaches), and also misses many other architectures with virtually aliased dcache. This is a regression introduced in the v5.13 Linux kernel where the dax mount option is removed for 32-bit ARMv7 boards which have no dcache aliasing, and therefore should work fine with FS_DAX. Use this instead in Kconfig to prevent FS_DAX from being built on architectures with virtually aliased dcache: depends on !ARCH_HAS_CACHE_ALIASING For architectures which detect dcache aliasing at runtime, introduce a new dax_is_supported() static inline which uses "cache_is_aliasing()" to figure out whether the environment has aliasing dcaches. This new dax_is_supported() helper will be used in each filesystem supporting the dax mount option to validate whether dax is indeed supported. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/Kconfig | 2 +- include/linux/dax.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/Kconfig b/fs/Kconfig index 42837617a55b..6746fe403761 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -56,7 +56,7 @@ endif # BLOCK config FS_DAX bool "File system based Direct Access (DAX) support" depends on MMU - depends on !(ARM || MIPS || SPARC) + depends on !ARCH_HAS_CACHE_ALIASING depends on ZONE_DEVICE || FS_DAX_LIMITED select FS_IOMAP select DAX diff --git a/include/linux/dax.h b/include/linux/dax.h index b463502b16e1..8c595b04deeb 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -5,6 +5,7 @@ #include #include #include +#include typedef unsigned long dax_entry_t; @@ -78,6 +79,10 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, return false; return dax_synchronous(dax_dev); } +static inline bool dax_is_supported(void) +{ + return !cache_is_aliasing(); +} #else static inline void *dax_holder(struct dax_device *dax_dev) { @@ -122,6 +127,10 @@ static inline size_t dax_recovery_write(struct dax_device *dax_dev, { return 0; } +static inline bool dax_is_supported(void) +{ + return false; +} #endif void set_dax_nocache(struct dax_device *dax_dev); From patchwork Mon Jan 29 21:06:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D64BC47DB3 for ; Mon, 29 Jan 2024 21:07:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04E9B6B009B; Mon, 29 Jan 2024 16:06:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F42096B009C; Mon, 29 Jan 2024 16:06:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D94536B009D; Mon, 29 Jan 2024 16:06:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C268C6B009C for ; Mon, 29 Jan 2024 16:06:53 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8E4811406A6 for ; Mon, 29 Jan 2024 21:06:53 +0000 (UTC) X-FDA: 81733583106.10.317FE24 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf19.hostedemail.com (Postfix) with ESMTP id 013D01A001B for ; Mon, 29 Jan 2024 21:06:50 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=owLk9BdI; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf19.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562411; a=rsa-sha256; cv=none; b=7L4D8BwZp2GHaBfeqLpWpuac6eeulTZ3Xw1+Nma/TvVrzKJhCG/sLVCvZmxEXnpBKume9v icIzeYr3ZXay8kh2zI78ZB3rZY43+kASbJOSKa2OU6FqnLgRiZKBoB4iNLEEhGfdDyYfyk riDwOiwkQfqeu5mVENOXp1gI4Ui7B0M= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=owLk9BdI; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf19.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562411; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mfWIaSpCcPWqZBxniokIPkYJb2xdS5Fuw1IXd4cGGKg=; b=MFqLaxfZLJPQiizjkxsMt0RMaA7Xovxz8oM3vShpuydj+ys79s6CBzws2HviJNx481C6o8 Y8sVOKvvYuq+tdau6PxNTTh2Etg3jDCwelAWcI1uqbU+kWeWedrbxhVwUP82FFTI0dpthP 51qizx7mmnw3IKA8Ek80Ctuem39P3WI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562410; bh=/LtPwfaY3uvi/uQueiJk5XQ5+25aOGLyhq5zZA6ahe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=owLk9BdIvYMqzPMeQbF2d7yNSH3zTkRUuREg1aXHoA5/oKPsRDPqPidgGmIGg+ZMe uDiNO1/hYtcLl6AbcYMjONTAvJEsm6nwxQqyLcdJ/rEInjNK7h/7xuu18NXQG94k5M nDpyHDrTa9Es9c9pzOQ+TFHsELADk92a4djW5vooUTinmDn2l9YfYZTRGedTlpDb1b MI3xshUjIJfHBa1pLt/SmgLF6goBo2TIOsc/su8NScSwzwbLdoBVSgvIlqpOTOOubM FokMDNIjPddKGnlVW51N6DyLGp3GD1P7ThIgTTI/7EBNQcDz6UZ9lqZkBEx0WblNU7 uTSeb4zKuNrPw== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17t029YzVXW; Mon, 29 Jan 2024 16:06:49 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , linux-erofs@lists.ozlabs.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 3/7] erofs: Use dax_is_supported() Date: Mon, 29 Jan 2024 16:06:27 -0500 Message-Id: <20240129210631.193493-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 013D01A001B X-Stat-Signature: dcaoj1s4zdhkibyf6wqgyqa45qbxjocj X-HE-Tag: 1706562410-385090 X-HE-Meta: U2FsdGVkX1+QAWzTdB6XLjJHclb3W+8XkZCx67tzoNgrrnWrGgV3oYy/YuBa5CVGMTBq2LKXFBsn2Rm0a0maYtHgPH31KRUu1ZFoxB9vbb5b9p6AzRfvwOWgJOZpkdsn+fCC0y9mZEi26/cLDUxoHYTqJqurMcdjr1nUeNnGrRfL0xfnn05FCqWHWraQrQsxH42Y6vTSBnvIt/Z+p0ADn4DCnEbGEpedbXBOqRFNEXK9jGbG6TvyXiry5cNCVZsxhuMI359KD49OwtnUX+dEXbCeqHI1u9kDktcRym/iDLo5uWzwczRVXYECK2CRs2fcAQMUNAhtHsttZa9T2Gf9E89JV+9flWm8AtxDQ5AatsJfiAKw2/LtaSUXQeK31Qej4v0TWliyrAJ5uR4+gHwdARQU0y42X2EN1o/wjbPYunxA106fTOkVZBirzrihsNLtitxERR0X0QJiVko5TPeo6puoQyHSDGusjklo56Lq0ChEpmXEOOjp6CppkEsJ+UEuKa5ehVIK0wB10erljuJdhfrRAqbeUbfSgfkcMrUIMs8+6ShjS+HweYYlwQBIRh9T/XfwZg6X0ixsbd3mS38OuU7sqPsV/U+iEHnDnFL9/+X6D8posfKLyW+2pSX7YTkSoLm9PX0X2dD+MRDvf/6jC1PmxmUKol9L/bSAeTMWGiHLuDge9xBznag+Spi7gsUCSWkt9W3vg5H9I/xJd/O/EiNwLg07g5R6zbhBTWOQK0h7yy+UOXoZAkUNsppktysh24ESmrn8vA3q62MPOnuXNeMW5Ll62oMo5bE+i6nGOkz6KcCQUbVvweLEHAoHxazXnxKAMZI747+riNdZeiGG0y05hIJLJ1Ufb4XhH5lB000KJ5z2/+PCxc4dy5+sj+HjE26l7WPzhLT2iy3U9UuppP9djpZGe87JFb7czBJL7MSuYuLnycH2pu/PWcToxDPfP4JgpiKEGl46+9N+TN2 5xEMdD8L dr5CvtrkDQS8KvBpjBi32b2ZuR2W/bjjAC+viTQua31V26JbpIoxPlTWfXdEn76kTTq57fDjAq0oAeRsX+lv4VDMhaUYiryvlHR5FQM7C3k2WMqvy7O4p/E2nMLB39JbT9NEYaRvvItxSvEU9YJiSBwEnuXiKIcpr5Q73+pEJzs9xUY99u/JzJdNRCRDvpIr1weg9JFyP3VbrivGVCyoqFRtzr8M8Ny5Nh/G8xxWP8NUNyIGUQCzD7jJEz/JWm5Yr4/YrSWt+Panp1fNI/5zgGNDGGSftcOsr0Msi9vg4luOlihwRpBGAdCyvjDIVG9C0P+EQrGEx0JBMJjDeesITAlpzXHYT8JnqB3WEncJQi3XFXm/Rc/Vt9RXu9xtikwUOlg9b+ZgWII6ksvD2fp+cMTnx8lQ8uko18h+BEaEgLDavMZ79SRuKI2SEmPv1UmODUru3aiWGMCo/g1dJH94SYnLVxuBad/yOwp/64dw7QW9QXWpGXsy298YOwiDgP0eourzapgqo5t2VF5L9lyAt27fENnulg1vzpDsPKQ7oDTUC8KzO9EVjahzZjW+AX7kk01kd3aMDtL0rRg8+6KZUW2F2uZf6aNXMDTeznig0Wncg1MWWSiIYLrQxtPJdfjmQ7pHG5TS7DWh0f3/ZhvkF0CpLgQjK2DrVE+RoVO+yklAtMTVFzhTSFGaMJ+NBbhdLmy53 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use dax_is_supported() to validate whether the architecture has virtually aliased data caches at mount time. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Gao Xiang Cc: Chao Yu Cc: Yue Hu Cc: Jeffle Xu Cc: linux-erofs@lists.ozlabs.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/erofs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3789d6224513..bd88221f1ad7 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -419,9 +419,13 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = { static bool erofs_fc_set_dax_mode(struct fs_context *fc, unsigned int mode) { -#ifdef CONFIG_FS_DAX struct erofs_fs_context *ctx = fc->fs_private; + if (!dax_is_supported()) { + errorfc(fc, "dax options not supported"); + return false; + } + switch (mode) { case EROFS_MOUNT_DAX_ALWAYS: warnfc(fc, "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); @@ -436,10 +440,6 @@ static bool erofs_fc_set_dax_mode(struct fs_context *fc, unsigned int mode) DBG_BUGON(1); return false; } -#else - errorfc(fc, "dax options not supported"); - return false; -#endif } static int erofs_fc_parse_param(struct fs_context *fc, From patchwork Mon Jan 29 21:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9458C47DB3 for ; Mon, 29 Jan 2024 21:06:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31EC96B0098; Mon, 29 Jan 2024 16:06:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D38A6B009C; Mon, 29 Jan 2024 16:06:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 099386B0099; Mon, 29 Jan 2024 16:06:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E2A816B0099 for ; Mon, 29 Jan 2024 16:06:52 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B5667160786 for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) X-FDA: 81733583064.18.E93A9FD Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf11.hostedemail.com (Postfix) with ESMTP id 36EA340017 for ; Mon, 29 Jan 2024 21:06:51 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=ZWoyjvOU; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf11.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562411; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dypInAl1n7QK+131yjCz8IF0LXkByyP7w+CtsaKfsNo=; b=JIN2VsU8GyuwMgqJANYDOtO0shXr2xL0/PLa5GwPr3368+P6J3VX3frRbwb9EM7+vSHlHv AJWRnRG88NJN/GstXIFGubsG1gIbG8AWcQbp7Lwd22WlSMk4/wqoJtCtGewN6bFQqzFSoE nfNS8c1pK9/4d3nBJ7ZrDW8V4g+zntA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=ZWoyjvOU; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf11.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562411; a=rsa-sha256; cv=none; b=CbQWgVQjjoXfk8Mz3xX3Q2JooLi3z6YUZY/2viA9zfYioSRhvWY5/80J9vSNBg3pdrW8Ob DPp7QLZo6YRX5GNAH8T6Uyu7bLhxmWgv9wsZXcA0kyt5k7svdPKfeidNDzF5TmTUEmsnuV oRyUuvvTm5JisgwRfcSu/Qm7a3WgLtM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562410; bh=huTRzi08F0C7MipcdwWe4Ussu/u99HDe6usjofLClk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZWoyjvOUAKRorOkBf1VRCuUe3muZT9Jazkxz9NgPX6vA5tHzdv9fZAMvOwYQUQFS/ ykyGlVWSZVdQ0AmTeMSrDjJkEHWdN1z2Rkg+mdr/4zNt3mUu8G59Y1UA3dQ176ZmpR XNnmvuPAdpd+gxgklREaTW4KM1V+5TYa9+K78amLQzWaxBqWfXKQpPUZi200cIw2Ld Z3msxyPrO6jmtz8APzkLg3rQ9tiibW5MVa2+hL9owNVSrTbGjPvM2VkNg7OI3Jte1b FXwljb10nWNnW/XdQvOwCcgvrIynWSjuNs5CGDe0uL9fagDqdafBZW/LVhSU2RA7Ha tXwBGOdG23nsA== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17t2bfzzVJ6; Mon, 29 Jan 2024 16:06:50 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Jan Kara , linux-ext4@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 4/7] ext2: Use dax_is_supported() Date: Mon, 29 Jan 2024 16:06:28 -0500 Message-Id: <20240129210631.193493-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 36EA340017 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ecikaht8o6m6b9cp9wttu8zw58qmedm8 X-HE-Tag: 1706562411-567289 X-HE-Meta: U2FsdGVkX1/B/RlXKtMci8tN1hDTTOoxePQoCBReqE+F078NfxothRpz0KBs/rc60PaxuvmIJX+bTHq0dsc3XxTeVyjtcCVnfZOS7m5d8+06j7rGZ7/HPfYu9b4Ph1veGHNG+3PAJHnet1tPjhJfOHGLtNnvukOffgg9fu2vWwb6jO03kf8W1/I0lcGpxtiu+Tp77skh/8sA4DH3Iqex1XJ6A+AekkeP0fAJyHSj1F2XJrv/Bx9X+lKEyjQwojEpliPGZIgNIJ5MeMlVKWfvscy/XIcMnJ2TBAb6TchV/USYDQhXfrqyyz0bnsewNwlKftXmQPRzrtMdGGJ3AIxv9fQ2KO/7EsC+BIW2SknM/Y4s8bpnMZTlL8IJq33Xm1PE0fkk3wf6aJhUc2Fvi8G5P79jHxSzHNUfuzxC1HjCqF4KaE1hRbjgZ0w/77G/yp+Io+P/aOlyPPndPaHmILFeAjftVt2LAIdpWu9F9U04AgkZlqcY5KHuPZp7ba2FF8HiaYPqIdPHOxSkXuLdI2+ONBXw8ZGl+SNQ6L4E9Q9mc4S6/LABO3075llCDgEXFbX5lYlJgzvTXV+G/MJ5BiTfIWCFKjSgb1buhID2pLsUM6bsT0pBHgOBgqX9paWzl91j4RPdxKAoagdpkyaRFfAiXBa/G7qDyJmAHqROVWmmQO7EmOJrinHCx8xh4Uqmy0xLBQpdz+ee5f6g7kf5/PM4p7DxzPl3P9kUc+Mdi8rAYgPQE8zL5DSERFgnRYduL5UsNRkgVPHmZZeDr9+QxKqxrGTGEOo4hmMVl1Zz/5zhW0nNiOpREB3LRQmWrBSJoGZ4rlBXq6wv1F+vxQA32LvrBLdml+d5J1BqADN1Ih6Bipnh4hgwQlMnJAojM/BB+0lEx6UrtW371w3cZ6prYz91Yczz9GjyQYFm2y+7iPoJu9+aeJaOzzLu8seCD5pfKkPUnIycuD6dtWyM7BciI09 h93vYyaF 7tbLIWTIARJKj/HMJNkcPrJpMVy8ks+jaBycPudZKYlCuIEnpnnBy5ue3PCaZbeJF8YRVU5oqy02ifIxa+eBIKWBkoMrj2gghbPUFkYyASOyaGETIKtuf5z0Gw4kRN8SYt9uXGwJbIpd8PXRbVyaEBHr8Zg5vBhm0HD+hyOofV4BaUHSCPzjyCXizqRWUwotaZkq0QQQfJMXduL/P453R8GHf095w+IwGma0i38tUZ+E9ASVtn6Ky/06rBKDZvQ3ju9XfF9qeLmwixuoigD4ayXea9CrDOKpEFXnJi0+c5/IrWFyV4P2bkyGjfat21S5P9JGFUScNOtAos7hb5seSm5MwBbIyQx+LkfrfalP0P1xd5Tf2+aKsF/EypP0vtt7+Gs/hXjT+B3ICftg5i0Nhkwfww5Pcx4HEfjXH8rhwkaRfYzVt0rIyT84mMAsWgKWa/U6v2m0JF3gwxrRoo8Wcrs2djRx5s6LoQY0ntrxPQvzf1f8ODNaNKj4Hb/ypZELo6M7nZS8SAUr4DXqj/CPEo/YM5l/clE6k6Dgb0vjZsIxB5I1yp22kL1RiAc+WznWd+ifRqad6jWvUy4gcSLrPmgPTL1eu2GdRpqUzGY5nFKMbubk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use dax_is_supported() to validate whether the architecture has virtually aliased caches at mount time. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Acked-by: Jan Kara --- fs/ext2/super.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 01f9addc8b1f..0398e7a90eb6 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -585,13 +585,13 @@ static int parse_options(char *options, struct super_block *sb, set_opt(opts->s_mount_opt, XIP); fallthrough; case Opt_dax: -#ifdef CONFIG_FS_DAX - ext2_msg(sb, KERN_WARNING, - "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); - set_opt(opts->s_mount_opt, DAX); -#else - ext2_msg(sb, KERN_INFO, "dax option not supported"); -#endif + if (dax_is_supported()) { + ext2_msg(sb, KERN_WARNING, + "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); + set_opt(opts->s_mount_opt, DAX); + } else { + ext2_msg(sb, KERN_INFO, "dax option not supported"); + } break; #if defined(CONFIG_QUOTA) From patchwork Mon Jan 29 21:06:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0C15C47DB3 for ; Mon, 29 Jan 2024 21:07:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEED66B009F; Mon, 29 Jan 2024 16:06:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B4B0B6B00A2; Mon, 29 Jan 2024 16:06:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99E066B009F; Mon, 29 Jan 2024 16:06:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 814DE6B009C for ; Mon, 29 Jan 2024 16:06:54 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 641D21A0AE7 for ; Mon, 29 Jan 2024 21:06:54 +0000 (UTC) X-FDA: 81733583148.27.6FF70F5 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf02.hostedemail.com (Postfix) with ESMTP id C4E2780027 for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tKXBPkUC; spf=pass (imf02.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562412; a=rsa-sha256; cv=none; b=IVYOEMXlscqrEyh1wXShzU6l3C38X6YaKssei5K7jPcOkS0YbYyHGo720Fl03BXF6EBEH5 2TIpzf0vo6P6xjQxnIBo0tLg88747PeACsFvf4PWwytYOHCNXOXBMAoxtAtF49ur5lZK8s rN7k0tTGOqMS2Zf6JbCAQ+sipKq/3Lg= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tKXBPkUC; spf=pass (imf02.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562412; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ccax4+tRpSP7QOIA6T2K6a0Oaxx0rZWM8kMN95JROEw=; b=LrSTFb7SnmsXwSZujJ+tauTEG0ljywZaCN2QnulVvhPrq3MrVzuYy8u6v7QzWJE1+dpshL xFqAhc/s6lVfX+tiXo0NyTxsfmh0X5HyUEL5nxRHHodBighmivQZTUrsiYodDhs4j5/euE qdzYhbO3+rUkdARxNwtJZR37kjzZPxk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562410; bh=PA2bNaQGUroOCG4PbvCJuxBIvden1XyXhOeNSYG6Pc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKXBPkUCiGqFx3UJT68UfJtfsZvo9lzQSlEslbntl3bHG2N68r4Lg/D78jIgJDYa5 mKyvpwpcXLdU721AkT9t5A65cL9pS2PxkKh8Fqsl5nrw7+xrZmhxODO2+ZETuH9BbJ fDx6jE3SERSeIc4yM77HcMOgHXxE+lcWi4Ya/iAB8zY2JS8yCgdYb0NWKbr3VG+rXO 5EXvs71nWGiOpNbObd5zHkTG22F3cC3Un8ScMy7nRmxFtw6ivamNeQeeFdbFBuwGQy D9mHV02DMJsL15eKEnMFvo3u8CAMg9Tjc8pioep5x28rnNCaNJ/z68wTPZKQA2v0SR mi8tFk2/icD4g== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17t4mGTzVXX; Mon, 29 Jan 2024 16:06:50 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 5/7] ext4: Use dax_is_supported() Date: Mon, 29 Jan 2024 16:06:29 -0500 Message-Id: <20240129210631.193493-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C4E2780027 X-Stat-Signature: ri7zu3w84bzyacgo6hqapndhd5c99jtp X-Rspam-User: X-HE-Tag: 1706562412-180856 X-HE-Meta: U2FsdGVkX1//N0bRKGa2JqYS6EoztUYpchj7ZszOatkl62lvmlvD5oQFPVueKFEQaWFhYm0sjHDTJTykzztuW+NqfMnSxzxSFVDvRiOyK+vL17gkd/2x4QkgpPiCqVdVZfh3mOaw/3c922NdMBsNBbbI/l+hPFLsoxNy5+7vyZYL9/clMkaMqSxgruldwkiXwq0+dFktiumag1VrqDPqvx+fZL6LcafC2iOZqHVRpWBZpwEVei2VLLVpI+Sod7oc4MCevAUvQthke8L7QuNutTnvXCOO/7VJYZdxsgWcpEyILpMNdOonhYRGtwnCn2B5CV07hARyP7Moe604GpPnK0b83fjPLhUWOEnKLn5ZcFqp/GImV0TGqGyiQD/8f3/379JpypRBt/uVZY4AlGVibPPCc8Kkm0dIErxotEc0pBMSmSBj3d5bL4lVz6noF2uX/od7uZ7xYctTUlqInnp9yJhg8y2jlh2LkTEMiBOObdo7pjM31HFperu9r4CN93LMHAF/DBtOSzhLh8K/4kgqM/g0hQYvv3P2KYf4JTUmIDtQ+JN/q+rELu27PaadNoAun3yX7B9CKa0VRacEp4BKjyLrqLyhVDx0KX98Ln7REAdxIQ5rTl0SNVZoVRF8KYT25MWWAVONB/Ho+E7beuHN2mlvBvxj4WBkFb32UdPxpPEdRWEvqBSxUNHbfFNCt7YYfH4nWLjQUf87UYlCIdkUTxvfdHXwsJwZqes/vEAiKN8lnKZngCS/UJW/fyrQkvGiQs5RnlFmaLuikaliR0ZvT/vrkJeDM55pXG64vdTQ0/bLtM6hVsbuzL5PMpTmehJMT3S521J3+4yAcd5tl60y4CoJO9mKbXopBMfx0Abx4Q8/o3uThfilbCPOdbjIoC4B/4hlxhFupIzeReyd2D9uSNnHk1dUn8TJeKAibH9qaIAIr+GHUCi7TpGQ9ifeGYvN5TihmdKb0pUCplTzacA s5wvgCM1 6exnftLpOVC3pVRu9cHpRY56w32Z/24ZjIA9qsyFwxSVNxIK97wbcp1U1Sl41STzuQAPDZXDnz9nIF9E9dT4kULQu3+v1oLzcFFBFSJRhxYuFShBobLz+8FJIGBaTe17qyrXlT2mE2pJXQ/JJAtCIWbnVFEhHZ7hGg83Fyas6dl0hOmPL9GIQzWM7bLm88L+6KXyjKajofhlQ8nRUnV35ESwE33nfgZalUCjiJmZAaAZ8I9i8xhaC86Vzuj19fu3a5N1mxkrRKd28SuQmDDHi92FyIIJJUWwtd079QfS2rNszJCQwALzl0oZlPQtE4eJoRL0mB2higMQATNqv+kufiac4wXmfMeySvxc8YfKBVSvUjQhZyrGkhF5eNOiDakIcmPwL7RdvFetv3wTcsQKmEyZ6JFnK8JThWvulsWK+VsKsIY4pGays9M7nKJNSflfjEWZ/NRjo1C5c6hqGCzHqQuAgxqpVj36YbZgMMK57aRd6cEr99y7+xA1sQrtaF27Fcv5sd0lPrM1Ts/temrdlg18zofqbXnlL9TugBOV51d52t0nnQVK68Wn4cGUxs+XSqRdOwW6olf98p753y7Dm1wlsRmxYv7PboGDE+KlyE9YIT+c= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use dax_is_supported() to validate whether the architecture has virtually aliased caches at mount time. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/ext4/super.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c5fcf377ab1f..9e0606289239 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2359,34 +2359,32 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) return ext4_parse_test_dummy_encryption(param, ctx); case Opt_dax: case Opt_dax_type: -#ifdef CONFIG_FS_DAX - { - int type = (token == Opt_dax) ? - Opt_dax : result.uint_32; - - switch (type) { - case Opt_dax: - case Opt_dax_always: - ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - break; - case Opt_dax_never: - ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - break; - case Opt_dax_inode: - ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - /* Strictly for printing options */ - ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE); - break; + if (dax_is_supported()) { + int type = (token == Opt_dax) ? + Opt_dax : result.uint_32; + + switch (type) { + case Opt_dax: + case Opt_dax_always: + ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + break; + case Opt_dax_never: + ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + break; + case Opt_dax_inode: + ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + /* Strictly for printing options */ + ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE); + break; + } + return 0; + } else { + ext4_msg(NULL, KERN_INFO, "dax option not supported"); + return -EINVAL; } - return 0; - } -#else - ext4_msg(NULL, KERN_INFO, "dax option not supported"); - return -EINVAL; -#endif case Opt_data_err: if (result.uint_32 == Opt_data_err_abort) ctx_set_mount_opt(ctx, m->mount_opt); From patchwork Mon Jan 29 21:06:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DA58C47DB3 for ; Mon, 29 Jan 2024 21:07:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14F386B009D; Mon, 29 Jan 2024 16:06:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 076656B00A0; Mon, 29 Jan 2024 16:06:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE6636B009D; Mon, 29 Jan 2024 16:06:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8DCA06B009D for ; Mon, 29 Jan 2024 16:06:54 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 683FB120695 for ; Mon, 29 Jan 2024 21:06:54 +0000 (UTC) X-FDA: 81733583148.27.662624E Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf05.hostedemail.com (Postfix) with ESMTP id C4E0F100021 for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Or9KKQbE; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf05.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562412; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ky+lCyzDge5OH74kS9vjXopzUiz2nH47LN5bR/8Pwh0=; b=Bqbfuk+05dqM9pyGkoo7CHEliE0Jzsdf1/mlkskeg0W3TFZEnOC5Wtj24kSamiWGaKeG+P hzCdhyKcEsUEdNqzT1kXsU8JNVZjhojS99BcwwQkzXuZ9yLUvr6fi2tMTGti1q+nB7ZSgr MSJ0i/ua7ei9slB6A3fLNt9bccRLaxQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Or9KKQbE; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf05.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562412; a=rsa-sha256; cv=none; b=B/xgV7nlqzl04H+imzQaGMoSM3CSwageU0RISSOEH36vov6isXALn3CLVs5fnjwNuV0DML 9ea4ko3HeZmGnIFrlPCpbUJwsjOkmlJwemlC8KEl37MsJyQNrfFDYRPVfSxEt+XS3HQ3/s MnNgfsIPs4spVaMTlF3H+VjhDkV3HvI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562411; bh=qE6d84dw/RHBezptIMoCUSoZjf7hEPQsPy+jBZ/P/F4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Or9KKQbE01DFHpcvYQEjceuM4WZSaWEOvWctam+nWYmhRaiKWaY7y4HtQ+LAL/ra6 WnhCkdYwWZj1fXClvt1jc4U9MGLixIqC+hCRIm0pnM+eeQFIiNsW9gPQLzahPKQZip vRvFUs1OQNbZHK4eqX9cfuOZsbhSkZk4y/WO9vHGSkKQ21R8iTopGgKUiPYn3cVKKy NY2XTs9e84eCiZRaD6C5ObMVDsbSWAz48qTfj2g5hx+kNTA/IE6wmKHn6763C2ptlI DRA6nvmFJIFA0Neet56IfoOGTJ7CVKcNye2U8woci47wLQIqX7JopQB0ezWkW1cJQy Ap1Rsna8wszfQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17v02t7zVfq; Mon, 29 Jan 2024 16:06:50 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Miklos Szeredi , linux-fsdevel@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 6/7] fuse: Introduce fuse_dax_is_supported() Date: Mon, 29 Jan 2024 16:06:30 -0500 Message-Id: <20240129210631.193493-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C4E0F100021 X-Stat-Signature: ijcoin8p6461eto5ujnrfytr4ad4yzbx X-HE-Tag: 1706562412-695272 X-HE-Meta: U2FsdGVkX1+hNJ9NtADtVWBZglga++rXwqkcSdPRBBqWAQC0A7xUOsE9cMxUCsXhZKDFAmGgCKOw9wfQA1iX9YfiZYsYif7cVSPM3+pc52PWDJ2uTxuQ72OXsQSi2Ca18ot2b18x1WddIiKds6Fq+f13A/3C0iKoFz/unmzBWjK/Bpfcr3SRsJm9Kdzv1D8sPrdXXd7Ox7f6/aX/BRJhfnUifnr7RlLIvW7Vmg64L+WoMvq9oWZqYA1/jq3XVWphtWhXtESrRYOFHRPB97+KXT4cFELBY4QyAzudSiCpCnQeOKO78NRlFSnmaylriU3dbMU2bKsRo6Iu9JPL08bIo/X2TS4pUbg57l/tfAFaNZTvK1UdBUTaH1bhkUIvPr3jgqqdkMTDuSK5T79jB6V9W3b+QAVjJ84IrH+VCrMTj7RUNC4tgz8jQTDJwGIn1DpFcF4YlmDQrWs1TnBVwP3uzjZZgg4+nDIFffux/+2LN6m/OeajbZrAnmwM1ICZ4cBTAVqEGA0dwsJZ67BTpsv7FBRXgznfVfjP4hp/OQL/bMdX6HSDLLXqKo7i5R46AhSCp4e02ww9T+WJfrTNYq6HN4srM/Ugoq1LOZy3Y5+F1UjxdyF/N6yZ8NK7hHvftVtHTCygheam7fk/KnqCidtYWuqZzl7cdVYWdKl/ZAtSr5guIBYF4a/qVSoEtyygNqjchwR9cflJTA9fbzf03GnmlAlL+W2UR3qKVVlCKUn1iUxPjHhf/agbWyLA4aL71NQ6oIPEy39UbJCJW/78h1zaTfHfj/50Q3vDGtXuYLNjJnDJYZtm/eF3Lj3MeBxYNo6qkq2ktIYrI1BLVF4NGGOKWi3xeCRQJii9+dPpHiy/fVzYfxPX4vtt/Od9CC7ufHvW1OBhZG6/4G/K9SCcunYfCmrhFTdZFpAkSVDfBAljYp5Io+2o/A7h2gkEyaz2axhULetfHqJXSi0uUrXl/cg 4PJ6oO5E m4dDq8fZU1ektwKgJPRSRALZjw4Y2JxgjdF7qlGtQ9MhCf0qkdWyq4vRfWGIcEGWGpANJHguNzPgCog5mfk4iAiDKPBnhMHFRWiuMAW3Z/iDBSfvW+bCNoBUZ0UW0X7sayj6+t09E/lkN+tqMe8pCylWfHPIrUW3UhInX3hbmXCJSuhmmipE8ccrHimDc2GWwzOjK+MgQzNIcXlI3XjcdWIaFHyGQ9IOINmAz5tNufLewuL3aOzAYMWVzx5UQkWq/viw3iHFh/vkANcdzeUXVvJ6kV8vEl/p3eJ4i3hLW4NHpYZxyHwOuTjFpEYURdBQ277KRcAkOBub7HBSrH50kgBb1aqs4hmKXT/j86uDMRAeSnBhJ0x86y1Uy1VGIl6Q+fRN9ygqtiTdaIzineLDKFTdZCQk8MNZrBCFLW4zq+zbWigtYOktaWxuPSv1YMcdrsTFQAgb8iJDaIhuaBsjoq4yfCE+ClFXE9XaC4WaEwQa2png62+10DZVO6zUjSKZEtezgrExC7shAOzINGdJkSWQURU9ZNB8fPYYc9LhjoqRHQFwkdBGj0pesCA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use dax_is_supported() in addition to IS_ENABLED(CONFIG_FUSE_DAX) to validate whether CONFIG_FUSE_DAX is enabled and the architecture does not have virtually aliased caches. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/fuse/file.c | 2 +- fs/fuse/fuse_i.h | 36 +++++++++++++++++++++++++++++++++- fs/fuse/inode.c | 47 +++++++++++++++++++++++---------------------- fs/fuse/virtio_fs.c | 4 ++-- 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a660f1f21540..133ac8524064 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3247,6 +3247,6 @@ void fuse_init_file_inode(struct inode *inode, unsigned int flags) init_waitqueue_head(&fi->page_waitq); fi->writepages = RB_ROOT; - if (IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) fuse_dax_inode_init(inode, flags); } diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 1df83eebda92..1cbe37106669 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -31,6 +31,7 @@ #include #include #include +#include /** Default max number of pages that can be used in a single read request */ #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32 @@ -979,6 +980,38 @@ static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket) rcu_read_unlock(); } +#ifdef CONFIG_FUSE_DAX +static inline struct fuse_inode_dax *fuse_inode_get_dax(struct fuse_inode *inode) +{ + return inode->dax; +} + +static inline enum fuse_dax_mode fuse_conn_get_dax_mode(struct fuse_conn *fc) +{ + return fc->dax_mode; +} + +static inline struct fuse_conn_dax *fuse_conn_get_dax(struct fuse_conn *fc) +{ + return fc->dax; +} +#else +static inline struct fuse_inode_dax *fuse_inode_get_dax(struct fuse_inode *inode) +{ + return NULL; +} + +static inline enum fuse_dax_mode fuse_conn_get_dax_mode(struct fuse_conn *fc) +{ + return FUSE_DAX_INODE_DEFAULT; +} + +static inline struct fuse_conn_dax *fuse_conn_get_dax(struct fuse_conn *fc) +{ + return NULL; +} +#endif + /** Device operations */ extern const struct file_operations fuse_dev_operations; @@ -1324,7 +1357,8 @@ void fuse_free_conn(struct fuse_conn *fc); /* dax.c */ -#define FUSE_IS_DAX(inode) (IS_ENABLED(CONFIG_FUSE_DAX) && IS_DAX(inode)) +#define fuse_dax_is_supported() (IS_ENABLED(CONFIG_FUSE_DAX) && dax_is_supported()) +#define FUSE_IS_DAX(inode) (fuse_dax_is_supported() && IS_DAX(inode)) ssize_t fuse_dax_read_iter(struct kiocb *iocb, struct iov_iter *to); ssize_t fuse_dax_write_iter(struct kiocb *iocb, struct iov_iter *from); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 2a6d44f91729..030e6ce5486d 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -108,7 +108,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb) if (!fi->forget) goto out_free; - if (IS_ENABLED(CONFIG_FUSE_DAX) && !fuse_dax_inode_alloc(sb, fi)) + if (fuse_dax_is_supported() && !fuse_dax_inode_alloc(sb, fi)) goto out_free_forget; return &fi->inode; @@ -126,9 +126,8 @@ static void fuse_free_inode(struct inode *inode) mutex_destroy(&fi->mutex); kfree(fi->forget); -#ifdef CONFIG_FUSE_DAX - kfree(fi->dax); -#endif + if (fuse_dax_is_supported()) + kfree(fuse_inode_get_dax(fi)); kmem_cache_free(fuse_inode_cachep, fi); } @@ -361,7 +360,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, invalidate_inode_pages2(inode->i_mapping); } - if (IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) fuse_dax_dontcache(inode, attr->flags); } @@ -856,14 +855,16 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root) if (sb->s_bdev && sb->s_blocksize != FUSE_DEFAULT_BLKSIZE) seq_printf(m, ",blksize=%lu", sb->s_blocksize); } -#ifdef CONFIG_FUSE_DAX - if (fc->dax_mode == FUSE_DAX_ALWAYS) - seq_puts(m, ",dax=always"); - else if (fc->dax_mode == FUSE_DAX_NEVER) - seq_puts(m, ",dax=never"); - else if (fc->dax_mode == FUSE_DAX_INODE_USER) - seq_puts(m, ",dax=inode"); -#endif + if (fuse_dax_is_supported()) { + enum fuse_dax_mode dax_mode = fuse_conn_get_dax_mode(fc); + + if (dax_mode == FUSE_DAX_ALWAYS) + seq_puts(m, ",dax=always"); + else if (dax_mode == FUSE_DAX_NEVER) + seq_puts(m, ",dax=never"); + else if (dax_mode == FUSE_DAX_INODE_USER) + seq_puts(m, ",dax=inode"); + } return 0; } @@ -936,7 +937,7 @@ void fuse_conn_put(struct fuse_conn *fc) struct fuse_iqueue *fiq = &fc->iq; struct fuse_sync_bucket *bucket; - if (IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) fuse_dax_conn_free(fc); if (fiq->ops->release) fiq->ops->release(fiq); @@ -1264,7 +1265,7 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args, min_t(unsigned int, fc->max_pages_limit, max_t(unsigned int, arg->max_pages, 1)); } - if (IS_ENABLED(CONFIG_FUSE_DAX)) { + if (fuse_dax_is_supported()) { if (flags & FUSE_MAP_ALIGNMENT && !fuse_dax_check_alignment(fc, arg->map_alignment)) { ok = false; @@ -1331,12 +1332,12 @@ void fuse_send_init(struct fuse_mount *fm) FUSE_HANDLE_KILLPRIV_V2 | FUSE_SETXATTR_EXT | FUSE_INIT_EXT | FUSE_SECURITY_CTX | FUSE_CREATE_SUPP_GROUP | FUSE_HAS_EXPIRE_ONLY | FUSE_DIRECT_IO_ALLOW_MMAP; -#ifdef CONFIG_FUSE_DAX - if (fm->fc->dax) - flags |= FUSE_MAP_ALIGNMENT; - if (fuse_is_inode_dax_mode(fm->fc->dax_mode)) - flags |= FUSE_HAS_INODE_DAX; -#endif + if (fuse_dax_is_supported()) { + if (fuse_conn_get_dax(fm->fc)) + flags |= FUSE_MAP_ALIGNMENT; + if (fuse_is_inode_dax_mode(fuse_conn_get_dax_mode(fm->fc))) + flags |= FUSE_HAS_INODE_DAX; + } if (fm->fc->auto_submounts) flags |= FUSE_SUBMOUNTS; @@ -1643,7 +1644,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) sb->s_subtype = ctx->subtype; ctx->subtype = NULL; - if (IS_ENABLED(CONFIG_FUSE_DAX)) { + if (fuse_dax_is_supported()) { err = fuse_dax_conn_alloc(fc, ctx->dax_mode, ctx->dax_dev); if (err) goto err; @@ -1709,7 +1710,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) if (fud) fuse_dev_free(fud); err_free_dax: - if (IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) fuse_dax_conn_free(fc); err: return err; diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 5f1be1da92ce..99f8f2a18ee4 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -801,7 +801,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) struct dev_pagemap *pgmap; bool have_cache; - if (!IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) return 0; /* Get cache region */ @@ -1366,7 +1366,7 @@ static void virtio_fs_conn_destroy(struct fuse_mount *fm) /* Stop dax worker. Soon evict_inodes() will be called which * will free all memory ranges belonging to all inodes. */ - if (IS_ENABLED(CONFIG_FUSE_DAX)) + if (fuse_dax_is_supported()) fuse_dax_cancel_work(fc); /* Stop forget queue. Soon destroy will be sent */ From patchwork Mon Jan 29 21:06:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13536400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A14BC47DA9 for ; Mon, 29 Jan 2024 21:07:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D2326B009C; Mon, 29 Jan 2024 16:06:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 206FB6B00A2; Mon, 29 Jan 2024 16:06:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D95816B009C; Mon, 29 Jan 2024 16:06:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ADB986B009E for ; Mon, 29 Jan 2024 16:06:54 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 89785C02D5 for ; Mon, 29 Jan 2024 21:06:54 +0000 (UTC) X-FDA: 81733583148.26.70D81E6 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf10.hostedemail.com (Postfix) with ESMTP id 007F9C001E for ; Mon, 29 Jan 2024 21:06:52 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=CcOYTXBC; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf10.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706562413; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h7fxtm6Dz7MxzniRp8UbYNumQbLRlmJV1CMVtnUarkc=; b=67B1Ko5+jdwUm4JyqxRon9YkCQmGLnWZpJ9AbF2sgXx7F+VzaH+L1FQJn8oZk9IWTJ5GGt MGCMg8vgu1/xrh+JRSAuxET8qt9e1qqb15pEtblrXrvKgYWN1GB5Rr0UM62rxvu3rXYCHt ddtU2ba6MX4NjmP8UZxZGrg6Yn/9OpQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=CcOYTXBC; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf10.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706562413; a=rsa-sha256; cv=none; b=T5K5YAJpsdwKlJwxTPihSxpBMrmDCdnxwAOxvXemYzWpNx+MBskXkYxPwc6Z/dSoRLpJZa oWacJVXyDRtL9pdvQk96NK9Og1ePlXleKwQPsIdHK7pdA7CtT7DF19a1E7weJii6vvjHww lhbFM2PzEidQwz7Owf9Mjbimc3oobqY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562411; bh=+9KVNYBLuRYpTotbk2zGsoJXymuo5SYIdtEsNtMMAo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcOYTXBC+giecQFAnLXwCTdIA57noQj2OFLZSCDKOIqpDr07dTVy1a8yJ3JryQJFV 2W5WB4QDkxTlNWbKpDcCfDCV1Yk9/dIKfFXxGJuTQcgowNhMsO3Yukg02bjPIMQFRv /baVDZYZtLVEz5A+3KUgQ0PgbI8sFNR5jmvB/7Vj1O8CCBTsO3bSZG9kBumQzDZiac Bm8evVOKtcBoj9wUdK5Wg/PiFVXjpfyrc41vpv1g5ItzalsHpw3MmQJYQPi57b1jWs DvIBjtghpS+h8EJifX32P3NqBz5VyeY9kNGlqU4+zvabpczDg6wWwsmvAwIDe9N3Eq k/288u39p8m6w== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17v2W6RzVfr; Mon, 29 Jan 2024 16:06:51 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Chandan Babu R , "Darrick J . Wong" , linux-xfs@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 7/7] xfs: Use dax_is_supported() Date: Mon, 29 Jan 2024 16:06:31 -0500 Message-Id: <20240129210631.193493-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: h739tgum4g1zgpi1y4ifdxisz4gmz1ed X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 007F9C001E X-HE-Tag: 1706562412-418494 X-HE-Meta: U2FsdGVkX1+bBrpoyOYTdO5urg4XSJc9WDAoGiVWk/arP3EmMn3Oq2wGRQlJ+XuE+JXRPrE31J1xMA62kSVD9RcUnxx9s4ItCZsHoTUP7Hl8Q+YGiEiPrqnB2GzzvEZ5YvzD3R9lcyxV6ReCL5RMzemiLPfo2rQ4qA+AmKwXjsmu5rifghbX8cS45+i0iuzOX6vAz6elhaWzYfRGOFDGvE+AwhTVTemub66Z2QHxmXXBcUk3AEcKk19nwbpQjlUlJaAQ0P5CWYJ4R3tWjO69LfdALjBj8aXpr17JkKO+nu0Vycdsccmdr6gsh+D5RCsuv8vNbRJFXn8yho2s/7F7tv0SpO4OKILmTE2RPHD+piUkyXUqS2Rv2x/2OJCfHQBNzOO9PA5uQ97wZ2PJ/RyUXAaqr5U85GcuUb4KK0kQX7QsJNEBjzst73RdHrWl7V/Lg4HNDceZZQgZO0iyKE0X99LrjIeOHIY9cYDn0p+LNm25x0KpLOa6q+wfsa2vQXnpUzusyfCeFJhxePN6bzI8QNF3xZyIHnS43vXtOV3Wx6da6GwEwjDGz/35qnRNAPbhN+685iXojM2wgplM+kkfeXsvT6D7NuI01m03bAonNYaF+PF0gaJ0yAmZrCEMDqbzRkoM9ciC4kZ7DHcWMZrTYh09UhuznDIzoFuQ4tqiMTlA6jkXUU4JfB0llSE9unmmDROgkl1cXuCbsQ2JVAuHA3XdJWJHhIpk1VdAm5pW/ByZXK5nWgRg1InxCRxlbi0i73GQrU+2SqWIPPpug+gv5A1uet4QFNtP8cxYwndAdpBcWl1CJa47hHzHO+O/WteHYR4zr7YZgFlQRS3FSk8CCBKi9bs5FMe3D+UwHXaHyCltmZXYeO3sugf/ReIGIOkNy3kneJ3vDJprFk5gTWt24FQUeV9ZMHvnQPQmNJN/i4sy8LcMJ3GSHbx981u8fCr/uoMlJGZ2J6ylxTceCVe fAdL95Jt u6dCASdUcYuSb3mDA1CUAUtUDVaFoGJAx67xnjEa8OcawqQ7Cg5DafpyLKdH+0LgR4THY9GGouHhXUESqEjm7efXFu2EamDXvlMzrPufjLA+N3ZiI1GhG7hLztROYrOIIK5zoFj82aHothajM3SUyt0mMkGCMJO2g4k7IT23aCNF9eg+WxABGyiRuAVfkA5BWs1M1N91grvAPteyJ6qJbU1Dqwb9YK8D6+hSAEq2D6OqGXFThUe5XDLDw4T22mncLRpM93bk3nAP59RnvUZltsLgnQ7Lp9tdMqihNrKEKoXg4YBAoHNK40C9bTzhBOSaPW2H32zi8fdYpfM3tOGUMq+B4lODuC2Q8uPE9Ha69WQ2dD+BcG+CuZEk7NKuEYSVX/SOicL657nesr1rgwdNqJmR8+KQOt1LhePUCMkPKlvJXAcNAxsjlw/nZdhfYXsK6ILU8iJEIWco9rs3kuWtJu0EwHPk43cjM7r5SqrtLUAIeUdjUncYNh6Wk04Vx30IqMIKi2NQl7kxR053NgzpxEWjOMNKtlljnSwVUCUSnID6tYaTjqZsTQlPdMKeyTY+X3dahI+nXji2zQK8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use dax_is_supported() to validate whether the architecture has virtually aliased caches at mount time. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: Chandan Babu R Cc: Darrick J. Wong Cc: linux-xfs@vger.kernel.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/xfs/xfs_super.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 764304595e8b..b27ecb11db66 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1376,14 +1376,22 @@ xfs_fs_parse_param( case Opt_nodiscard: parsing_mp->m_features &= ~XFS_FEAT_DISCARD; return 0; -#ifdef CONFIG_FS_DAX case Opt_dax: - xfs_mount_set_dax_mode(parsing_mp, XFS_DAX_ALWAYS); - return 0; + if (dax_is_supported()) { + xfs_mount_set_dax_mode(parsing_mp, XFS_DAX_ALWAYS); + return 0; + } else { + xfs_warn(parsing_mp, "dax option not supported."); + return -EINVAL; + } case Opt_dax_enum: - xfs_mount_set_dax_mode(parsing_mp, result.uint_32); - return 0; -#endif + if (dax_is_supported()) { + xfs_mount_set_dax_mode(parsing_mp, result.uint_32); + return 0; + } else { + xfs_warn(parsing_mp, "dax option not supported."); + return -EINVAL; + } /* Following mount options will be removed in September 2025 */ case Opt_ikeep: xfs_fs_warn_deprecated(fc, param, XFS_FEAT_IKEEP, true);