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/yXMKqniw7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TGMgbUZSn+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);