From patchwork Tue Jan 30 16:52:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537739 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 C2951C46CD2 for ; Tue, 30 Jan 2024 16:53:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F1D56B009E; Tue, 30 Jan 2024 11:53:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A1796B009F; Tue, 30 Jan 2024 11:53:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26C616B00A0; Tue, 30 Jan 2024 11:53:06 -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 160D96B009E for ; Tue, 30 Jan 2024 11:53:06 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 99F55120874 for ; Tue, 30 Jan 2024 16:53:05 +0000 (UTC) X-FDA: 81736572330.12.404B10F Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf15.hostedemail.com (Postfix) with ESMTP id 01D64A0019 for ; Tue, 30 Jan 2024 16:53:03 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vgbjUBoC; spf=pass (imf15.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=1706633584; a=rsa-sha256; cv=none; b=5aIH11VkS8ocKNN+HFQo1rzCtT88Ih5Nu//vi+LXAoSWDf+g3wt3fK9N2IFxUh6kDczWLy IuEwI7iiUIB1cAhIHrVGy3oi0T96GDdM+0FYLBThwGYw2zaHX8BwCqhJvAldXRKz8+HcrG HbVYg1aCHJiHEvdf13X+abTCHefQ1w0= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vgbjUBoC; spf=pass (imf15.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=1706633584; 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=XsGwYVoIL2p17hZN8IAvz/FHhHmi8wuXgYvwpNE3TAw=; b=z2koEOZgkG5xZvubY6yZro/uOqDSZVsgX3WJ6L47hgB6JF4Tw8tX1jJ561g/7z0ULXaqyv eEp8zLKSD1AiuPO64M6xIoK+K+xFtnc8MoszNZ63TblHgO4S9XIshEjky/Wx/cQbR1bWyA wujxSUFKqeMdtEvW/wLQPfavU6w3yNw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633582; bh=kONcCPsuyI5WQYSGBCSYy4QvFvi3USH7Uw/j5x6yQS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vgbjUBoCsBWslMcltBfdpWSeMuBJh9vagVsOzVBCsYPflmZF21l/oXX1Ba/PO3mLt IAo6tDBPixabdyL82vFyeZRM4K5gXSlF3AcHSkts4ATD0jK0r54h3KWd9BfSuB2vq3 5ncl3QmDBgaRucDB6G9aoZY9wcKTZ8lNMpVD2BB6c/pWaO6TWZJpNAP6qpjr4lp/QH Xrf1q2e9OeLafet9cmHN9zLTm4hViwA6TMJFVknG1455my5qsCaRlgKhoJB5AHSqBX z7oR+SBvEguwEdLQu5X8pytv05SsqgN3NUYNRzNrZcjomR6+XC1ZyjdraSUi/geEb6 in89aPEvh0XWw== 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 4TPWSZ4m37zVCR; Tue, 30 Jan 2024 11:53:02 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 1/8] dax: Introduce dax_is_supported() Date: Tue, 30 Jan 2024 11:52:48 -0500 Message-Id: <20240130165255.212591-2-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 01D64A0019 X-Stat-Signature: 8nspb5ri7aaehugcdpk65cjy41yigo3b X-Rspam-User: X-HE-Tag: 1706633583-144198 X-HE-Meta: U2FsdGVkX19ZgUb0uBZWSVMbxJGZ/RCxwbrD+ebgaBZA7obKc6PIKlorA8J/icKfbi2AWsUgJ8g39yNphzz6ip5h0C+FfXNmcagKEXc+DHr7a0eiXsxbovgwxCv7l+3nYpTcqe2pxHRjxM2WBAy/qmHinz/konXklOMC366Peukb9NS29E68XRYoAcXuuSVh6VltR3n3cgj5wuS5+yrTCu4O+qMost6qjhuryE245aQXZ+LHBuYrRhHicTnYumptzi2qprjiWcO8xDX+DUyEzfSZXXlyXd2DK5xIxUDv2kq20F3y96R2OpPxtDn7O9PbADxOgQnzUHzeIO8gyPpy5zkQ83i9H6GDLbyUBwT5qpyTiAn+JE1FcJCl+7uZzWG7yGpt1qmmOKg85Xk88+RGKnh+TDWfZLEXySpSElY291rcOTfeXqQBSteBuwkDb0hn7Xhc7GL01DI5cm9ASUHnk3HgVypKjEtYvINjeNWE1uJGsM+Fx4C4VhuvFlzMMlYMyY//BZPE2L0bGHMpkxjoDfd3c/5IGMZMP4R7l7CfWFqUGbo4zgH35oNMqOxaJy6vq+o+kIKtwS8DPg4YkfKNzs/QvC5GH4+QRCv2NeqmeNgWmHexyXWBSZ/HirpC5c0sqLIX8UiTO3ZWXQoa8e+9L2K0Ph+aA33D4bXA+JivJkOvZwH7WRJbdofqvGe5PhbwcWxwifBYE56VodSPGF5yd7pQC/DabUBpCv2zt349FlVqpJR2lML0mK6hv0UN3qUIU33QWb6qzpcq0s5iKu5wIINrQa6O3kRQyuH3BdbWFb1tytUXBel626Ch1XehbqbKi7cXUvvznuoHPUzEaOtC/oWwxpYw6EET8mGNpefESXvTmwvFuFpblSBwmMdIc5b4VUs6bs1k7hoDXdhPMkRGG0sxvQGkJN+DluDNshfDOMPH2ex6vpCsLhdjFJYTA9Ec+4WuuH14jtGkgAyrD1F JddJiUnz ZpO3gVQRJZAdHG8cyZCJzeW9myy9d3pQ7/dcybzPSUdBir6JeROxoJ7McWegW94NCkEgr90tBP06wVWb/sJY6Bfk7KNU0b3MRlydOax3g13bsPt1zrgB9CEaw+GvP02gOvm56YoOvwdfbpqk+iA0zeATaO0Y786VAlel/iqWIb7K28Q4w+FftUB6heu6vYd+8vQ34uOvnL7vyTRfNKaqRa6dqUc7MELd6PET3Kz9uP2Hi1XTYvQChe4JXgAJWqNO84B6pCoEP5uZfkCcNPVzy+lS6vW/Z2B9KwDzLOveXHK1Pp4O69hFHp5WKi70TLNMdl15mZaM8S9ggsV8dxAWDH0vI093NuHB4WCUkNMlQ8xg7FT9Boqw0T6q9MYoSYcil6R7Qt5BcECeecim1XtB/WMeVs0pLqQV/kMt7uNWuFL4ISkcFaMgJ05FOco/SZ16gkU9+B0D1LPZJWBNZYUPajWgsuEFq83wRhwC0+onyuZe33UtXXrj1A4LXSDcKnxk4oUqMRgVg7V9g7o9yEsY1Xt2dKs5R5CASnEklaVLH19cqmIDZYMa1SBVKGcmVtIVF8Pv8+HYZ9Bycf4X1QTQC1NWgxy3uyEcm2k5ywiZorG9yo8jbfaIRVZk4WQ== 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 new dax_is_supported() static inline to check whether the architecture supports DAX. This replaces the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) This is done in preparation for its use by each filesystem supporting the dax mount option to validate whether dax is indeed supported. This is done in preparation for using dcache_is_aliasing() in a following change which will properly support architectures which detect dcache aliasing at runtime. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org --- fs/Kconfig | 1 - include/linux/dax.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/Kconfig b/fs/Kconfig index 42837617a55b..e5efdb3b276b 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -56,7 +56,6 @@ endif # BLOCK config FS_DAX bool "File system based Direct Access (DAX) support" depends on MMU - depends on !(ARM || MIPS || SPARC) 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..cfc8cd4a3eae 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -78,6 +78,12 @@ 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 !IS_ENABLED(CONFIG_ARM) && + !IS_ENABLED(CONFIG_MIPS) && + !IS_ENABLED(CONFIG_SPARC); +} #else static inline void *dax_holder(struct dax_device *dax_dev) { @@ -122,6 +128,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 Tue Jan 30 16:52:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537741 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 D9AB8C46CD2 for ; Tue, 30 Jan 2024 16:53:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07E626B00A0; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3CA56B00A1; Tue, 30 Jan 2024 11:53:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8D9A6B00A2; Tue, 30 Jan 2024 11:53:06 -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 C973E6B00A0 for ; Tue, 30 Jan 2024 11:53:06 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A663AA09AA for ; Tue, 30 Jan 2024 16:53:06 +0000 (UTC) X-FDA: 81736572372.04.C988C29 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf22.hostedemail.com (Postfix) with ESMTP id 0F071C001A for ; Tue, 30 Jan 2024 16:53:03 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vUW+mrCc; spf=pass (imf22.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=1706633584; a=rsa-sha256; cv=none; b=QaSyqrG1KPVC4tS2FLS5Bjz4UxmE3kdIHI5bESXCZxa0JZcHgKYvaek9PVUInEn2BErsIK gsMA9TLHHtgrkp5XEaptV/r1xdsyrlx9ihCWl29JNZFjqS8bvPVVjiz334H7JYNPGgd3Rk EYYUv1o5LuprVs/4eupSA7sO7TYnRY0= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=vUW+mrCc; spf=pass (imf22.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=1706633584; 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=XkDGYWTI60Abcy5+ZI1sU6Hpo9MTJxKHGwT6DDETt4w=; b=WrV2jrd8UahnOE/n+fK/ZFepMI1a2ivxQvMfMqg/g8bXcMb0B0Rwfuxs2/jrswFRJMol3i l//ZJWteJbgtpSMKHzRKMeGyreBludt7fZjZWvtsiykRVWDDCTITtVTSjwdUJKhBTPlcLu LzlcA1LPcpB0PKyQ5TGWMvGrqZgrhWw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633583; bh=0PS85pgqYkHDjLA73cFZbQVUmxCMDRqh5f6aZ/uoEXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vUW+mrCcZJ4dUccJT29E29VuA+qTOl+8e3elS1H8wklVOGgzACBmHhdGQO2dr9wFc NzmKK48zJopQYpmyMRRoNzkvbAyZ9Dx2h6XNt9IiA2jyvMzy6nKiCz8WIP+Drq289Q /v/bHSswSZ3L7qe0ZvMi36Ncgfgj9O/uvrnAoVZmMH/ijRtHijayBfYRa9WEMZjCDs fxJd4WCacVrY0N8Y5MFgIjKCQ/yblMFig4tScU2lcNuoZD+S3w4o6Bd2GdmM6XTzYq fRa79UV4L+X0luZ8p+mn5pmw7UK7or0yOzymRPjVduus21EeKbDkDW2l34EAE3oBYG VELmh3Q36mSVA== 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 4TPWSZ75XdzVCS; Tue, 30 Jan 2024 11:53:02 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 2/8] erofs: Use dax_is_supported() Date: Tue, 30 Jan 2024 11:52:49 -0500 Message-Id: <20240130165255.212591-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0F071C001A X-Stat-Signature: foudit4t9886r8r5g4et5wob78ya4ofr X-Rspam-User: X-HE-Tag: 1706633583-789357 X-HE-Meta: U2FsdGVkX18ZGdpt2JkI0lOTvLoA6z96TpoLN/5ZMh9Gxs/92sczgEE1XyoPeGGcsxCXJd4Wi9NrR1r0oKwyD/IsyzD7ny1L9WTbHUxZKiJIz1Sn5sWiaaLBXL3evv+NOUILhJMiwC3cQzKB7oiTTIh8m61nlPo+/XcT2F/LfZqdqqEvIbq0/UH+7bTcgEfjYQEQswfL+fONsTd3lFj+5njpHTLUNPWBRbG8gx7pxDcqHnBrMXbmKyiYV6DwMbe7C0giRqUjpUic288Bh1DKE2CzXJg9pPOFg2U9J6UGH+dSCDFr9jbzcsZZfCIWZjxRNm3xEgVFiT5uMrPI+ljKwRB4odyHh7K9I5DTpvjAvO55Q4GhwG+JLejn23/nLUzuylcYCRs2YEU7y9HcpfpB1cMtq9RjR0HXnomY8ARRoz5NQxJ+kyXnmrTl8czB5EX/DUS35wO70S+iEZB5Njm4p8NNYq5CP8HFgDm/hwbA5hEVHekXZy9IekF3DScRA0Dj7Z+Bmo5szvR55KzLnOjKb6UnxG0W9PAiRegii/hfzrwRDZIN0D51ONIl8QP08qphS5nKbODEHPjKZ/NfdHYUbE/5bAF13+yo3VDabcbFH+8G82Lm9nj9bBhRFQtmw/H+vN4jtfCH3joO2rZPTx3ktQCeJ/wg/kA1T/mCdCdK2oxvzReWXc8x6O67cglvO+ovjVr/W7P3TtFaESwqgfISB43g1tNhuX7xWol2MT/S2fMHj21BWMolWeOpFV33aEGsEyEudqNAXiJXxSJP3q9C7Hg7I0tGbSlLNA7G8rOQGGEDZNUZDuApzbe3onBxM/eX2TuCu//VrqJexAxO1ot7uOfar5iLxswc7D43dMKJYPMfvc5FfXbvRh3HoEAihYtxiwJ2TVtMIsgWBvGefbghhVXJZsqC11RmghxgST78d7jB5NFlMOpZFQ+jig0n5B2OWQpm09c47d5u5JJ9/Xs gsoY7Qd6 QpJNgnfo6Ix44/Cim6F0oFXyp9gy0N4pH+YpYKxkCbs2M5GnIp2TJBYD0bguyF2qedoZkpQ9StHmilormip5OOn7p88xNPJsVSN/T0o5UgJW0g2PMSI5kpgnOTqDBDPPxLQT0rgjzzehqiXkGsNEPf/+ImZxkGnVBqrJJiJLvshEx+nkV1D8eqmMk4htuChIUuLugd7Y4uuEic9iFhWnR6xEw77TLNtBcvelOUGNSx4sjWuo4Qhz0jlLaWBq6V5f0CrLyjWP4c1W6OFWKjOBr1DIqAOgYXRMFD5gSjLuL5hR8xlT0ZJRiP8OW3ytN+a908fVsYUGxlJ5GsVePfCm0xUFh+ooRzjuBGxOK7rOvkIhuuQnjALXxd1vNw0H5CghwTkWNsTR9TvCigtfa2AqxTNiKaWwZ7XM74vG+QOn+v6ufiNhxrxVN9BgXngo5d3RokA5sPpmxCT8uoQbRAdZhEAe4tPf2m2+5/ESMXwIGFcAvVJvRwGAyAfGBEpED92r5f1Q7FtxwbXOyt2UV9t+qMPw2zBdE3qlXUj87NPBzLh6G6cnz59GTqGsAQIAZupb1eRe0PQ6WZe7w/OjhNzGeeDoXyTH4iew0gaaCOxE3lqtpf6calHctKixX7PIMNYIiG4Lj5WwB7zcIXtyQRKEuJd01z+8y1RntbvB9Vso+TNG3Pe9K6A5+wznuLVxEFULAdlgTNeFQyUeEnQ6qGPNDkUEyHSioO4VO9oRSRb0An+koXcNTwZiLoTtDaqeQx3GAxubn 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. Print an error and disable DAX if dax=always is requested as a mount option on an architecture which does not support DAX. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org --- fs/erofs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 3789d6224513..82e569bd5889 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -644,7 +644,10 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) } if (test_opt(&sbi->opt, DAX_ALWAYS)) { - if (!sbi->dax_dev) { + if (!dax_is_supported()) { + errorfc(fc, "DAX unsupported by architecture. Turning off DAX."); + clear_opt(&sbi->opt, DAX_ALWAYS); + } else if (!sbi->dax_dev) { errorfc(fc, "DAX unsupported by block device. Turning off DAX."); clear_opt(&sbi->opt, DAX_ALWAYS); } else if (sbi->blkszbits != PAGE_SHIFT) { From patchwork Tue Jan 30 16:52:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537742 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 94CBDC46CD2 for ; Tue, 30 Jan 2024 16:53:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5C546B00A1; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A0AA16B00A3; Tue, 30 Jan 2024 11:53:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 835CC6B00A4; Tue, 30 Jan 2024 11:53:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5F06F6B00A1 for ; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 3179FA0C1B for ; Tue, 30 Jan 2024 16:53:07 +0000 (UTC) X-FDA: 81736572414.26.4053410 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf03.hostedemail.com (Postfix) with ESMTP id 603AA20016 for ; Tue, 30 Jan 2024 16:53:04 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Wcnaeton; spf=pass (imf03.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=1706633584; 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=/Ywp2OzIEO3UrKlV5UlZxaaKEM3XQLGE456Lr/j78Ws=; b=yJrAE7PBECqHm7OV9xoAG+ygXALvTVAMf2NzQXrrvS4TuSxhrzU/Aw6ZJmhA8n9lCoJjui Z09krDjcceU68szWGBu7Hdvtq0hvIilAvdaZhKSZJK000eekj8UWVboU7bI3b1ZrJPljS0 HijSgdIxFMH0snNWuBWsnD7THNEhS4Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706633584; a=rsa-sha256; cv=none; b=xOMKwB4ynCbx82iYdzZSiLM/3hXpCNoHeI+GIfxU+8a9FVssR/Ge6gPV23WpyOuZk0Zmhf y6TgCw/jLJRLbIcNuP2uWo22tCCBceowJ0sht8pky4ty/Sd/ePl9a+exM64iO/pFCtSHaV u6OrLyJEYtjYSMFP5d17Scrg+S18/eE= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Wcnaeton; spf=pass (imf03.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633583; bh=uiS0GJbwiYIsdO+sIgYuUHJda29PtI1SD0eG+t25LF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WcnaetonRB2ptA6rH20S85ZN2YuQ+85XKCChqN/hPetKt9hQMa6MYuz0WYUDKu0dk TRGXuMhSd/MORPXaikKViQvSex0XCt4qww89GEbtegcsxugJg/8FWVmU0KleFZRdCg URgK6HV/mhdB93faG1hohYtpg/CFikQ89UPVO2+6YBcInuB/TQTAvO+CrRwLUkoP7T z7OOTR2aZt+IPrulE57GALlHaC/QeSShs+vFVabk0vuwHLfQxrsFjCnepf8ePGwLlQ RlY0xR0urzM2jWXOR+egACe18PkdIYEzPUmiqu3yKbeMxFrG6CdDKqTLmZedfeFS5e mXznuQ/oV967A== 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 4TPWSb2qKWzVlT; Tue, 30 Jan 2024 11:53:03 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 3/8] ext2: Use dax_is_supported() Date: Tue, 30 Jan 2024 11:52:50 -0500 Message-Id: <20240130165255.212591-4-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 603AA20016 X-Rspam-User: X-Stat-Signature: hc5u9refs5brr7k9y6rkyibqquf89u1x X-Rspamd-Server: rspam03 X-HE-Tag: 1706633584-858955 X-HE-Meta: U2FsdGVkX19e+GGs2QeGbcNZCYFlQj5yPv4GhpZzl+tKX7Em2ubCfeD1362xFAHyajhq/zeYEAghcsFOLQY/2fSq6bwV7yxpaNJYZaBOzFSm4X49wB4L2ie/jPWv/qD+nqF7w+f1t9QcPYzfeRITiw3gP6pWiTZT2C1cU3f7HYgLfI5Akw6/wg9zBs/7+pKtWvaZBJU+nDgYykMxvUTtrG/dVob5wpQOS3SLb7zut5Zrr9Kinb5qVJxzPWYqmsQ/ZT6OCMlDz2QHGXzA80IIGyMNtBeUpDQLmUddMIitiT/6fA8GD3HTmBsUO8bfwgkwqd7rm5wUQJSHCuziBldYRM1BdhD558gqEhlcqxfV/4ip3GTjJSvn5l8jGTWZHNwvjI6YHH8Wst5Gs60iau6jqyGap/UKWdpggmJT5nAlZLGfMi9bpkr9w2guN0N9NCdvAgYNxnwHoRuZ9jo5ZRQYjLlKOL6L58rKFFRMtwbhImd9SVdFkEPZA3zKbtSOg6IfyrT3jOx/Cdz2Hi6b5w32YTERcFygA0ZL7o5XHs3ooc+kesgxk2VCo1jKCft8OHlOJ5gS7lYiTYlTYBdDWoFcVsqsfL9Cai9zrckJASYM+agDdX7fv68SAQ8wIIJ4EuqnjLqxw7b8QdwlKhT1IahOmU0k8IucfDorfy+r2pKOPrbc/ehRHlH9qlXxU1IdVLL2PEgwwCc+Bp4wxxXQoJuTCI0CFg+eAcLPr1s7YPDvMrCtIv74BsCDPefHlbv055D19C5RnZg7N5J+Xpy/vq+LAuGSZLNBeKUekgH/a1o9ESIqYeybF+OmapcxSDEeeb8GXNW3ykV8EHMdJyjy7igXpy2TG6yfn3LmO217hxe0TTVp/9iTftFuUMS6ZOOPP3sdT3Nhcn6bSnGAfcXwehZzZQ9Upxcb5Fsv4EpEFnzchPZlmimUc0fqlfXO2HSIX3IbdPtCfocA6TnirbiF7NB j29LuYDi nhYd8EF/IXg6MABhiPeAVpZY3Zax2zTxGGNRB53YJ+bjh9+CyZrV4t1mveFw2YeqoSsVfT1InCQYKaD8Vbbp44rrgT5BgRux0PsDUyw9V5EsqZ6Rvr10gFKaoVgMsqgCJUnfCG2lvC/u6aBlpdfZVw0F614qI4EtZ/U6dtkROwwVa5ldfLqHFvq0flZOw8DAMn8TcDb5O9pbcup38s8MVfYoTOaX0//KwSZNvlQ27h68am1DHbEqJCIHMOAGpJNn0gP6yYJ7PCSBTb8Bk6CkLdK+yQB7ybDUyWXn2qEz+QuiGGb41kiEVAJGXDN81/ur0AP1vXAx5VWztSvc9Mix1Dvdm501DjIDYPGes7H5OJny162MTUQdBjZwf1RCvchcXMzPbnO7J5SDFgxAPsCmw+e1eB/LO2i/BBL/9yqJEVVkejuLiGObLRUaHZ0d006jrZrTYR9mXVBwXUdeYoiV4UBLl2GTvOqAIrPjVTcVYKc2703xIH+7vsPWmA/g1nBkiaCHsdorAv3CLVw+9dXPZatsqtGd0K/UFcAHqJRTszLTGtzvAs6UG9kbigo3iPQHF5B+IdtEBbhMJbkdyuvRJ64mfqSe3U5JSA6ObdVwX7342WCxeAeiJsZUppLbKxk3X1sq+TVFNbVPLJ1xrXC5Ri2FL4denu0pIGCTNNFNLKBfVJk4= 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. Print an error and disable DAX if dax=always is requested as a mount option on an architecture which does not support DAX. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Acked-by: Jan Kara --- fs/ext2/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 01f9addc8b1f..30ff57d47ed4 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -955,7 +955,11 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); if (test_opt(sb, DAX)) { - if (!sbi->s_daxdev) { + if (!dax_is_supported()) { + ext2_msg(sb, KERN_ERR, + "DAX unsupported by architecture. Turning off DAX."); + clear_opt(sbi->s_mount_opt, DAX); + } else if (!sbi->s_daxdev) { ext2_msg(sb, KERN_ERR, "DAX unsupported by block device. Turning off DAX."); clear_opt(sbi->s_mount_opt, DAX); From patchwork Tue Jan 30 16:52:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537743 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 6A953C46CD2 for ; Tue, 30 Jan 2024 16:53:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCBEE6B00A2; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C550C6B00A3; Tue, 30 Jan 2024 11:53:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D1D76B00A2; Tue, 30 Jan 2024 11:53:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 78A7B6B00A3 for ; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5890B12018E for ; Tue, 30 Jan 2024 16:53:07 +0000 (UTC) X-FDA: 81736572414.24.FC49812 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf13.hostedemail.com (Postfix) with ESMTP id BA7BD20011 for ; Tue, 30 Jan 2024 16:53:04 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tq2gAYC6; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf13.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=1706633584; 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=tk/vyFkTLiQku0ad9N/cHEV2e4n++1obKWF1GV2oX+Y=; b=4uTVLNtL+6DKeciTEcNYoQlKscbI0bEI9ee4tMvyDq0CoDVb0FtUszlCT85AMUFSs1HWLH 9krn6rTLTistq6+LRxzGqkSsX8MA0zsBJv2gZIaTgXx9RvUfR1frdbLuwQys0mnIMDws/W HvRHVPQsl63zi5k9YvclsfE5dpzuTMo= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tq2gAYC6; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf13.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=1706633584; a=rsa-sha256; cv=none; b=BXfCRhsOolnK197nWnlMryzd+D6qp/A9KyA0madZyWcKCMBnhUpV2skVDDj3NJMhR1qFbS zEeLM20qaFDA16p9MUwPWJfzEOG3tvWmpCa3dZOQ6Z1QqMxHCDs0FDxkvX0iuzZW+VEu32 pM9+p/XRb5Vj+DjvwAyxUl3VMGg0Ghg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633584; bh=x2kfVQnd3mtJ56l0EVkgCvgLcCn8XobB6WTDFgooC9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tq2gAYC66u0pgRQLdwQulg5tni9ICP4HQV5hNkD1Cq/9tUIG4HFmibZjHYT0d82Lp cMicqUnPpJnkA5r9jAw2IGJZq1ai49+03rBKiMvJ7+EVVJ3fomY/mGR2UbdmuwD82g 4P1KAEd/fHlBxO4l/WrPaUDLeudpg4vY9nwVSw2A4WctYupqUoslr+z8KBr5VnR1kC PZkebcd46BiUcXGPvLNjvaSeP0AjrYoRbx+QE9XFaoZGhkh7hav+ThwGlx6jS15Qp1 +KKuZLU3CDCOUFn6SKF6TtjyMsTWQ3wPrQ6S5XpGbBt0rNU6SjpdQh2odtFvPnz/1l Gdx4KC/aBtZhQ== 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 4TPWSb5HlgzVcs; Tue, 30 Jan 2024 11:53:03 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 4/8] ext4: Use dax_is_supported() Date: Tue, 30 Jan 2024 11:52:51 -0500 Message-Id: <20240130165255.212591-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BA7BD20011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: i7ipmyr8p64eks4p96y7obtyaajhmbun X-HE-Tag: 1706633584-938487 X-HE-Meta: U2FsdGVkX1891rqrVubQJvyYt364YVTtPqiWD1HKWg9uq+VJIEaKB7Gb5JmdpG/sG5ff8gHI//qFUgd/0NqALfaGTY9QC6UjS131xF0/nJfzIW4ljc0PPaFEFwB9RQpKmnmDbcueI2CL15ZkJ9S+vnS9NiW0qdMfoWm+QTnJjulldgxYvRJaaEhGsL6q4Mbbk0AfuMKmt8WZewEiob6fpQtVT2B2M/Ii34x7+zgBfe08OxRZt5GSzVQjzKMgL1RibXYDR7SEiN2Rk6pQXmOvBhYL2/VHI3MMnNj1I331VN1fySreBZtQ6jK43R53hPebCE/SgnmIplQHP2vTtyi2DNfs25wNTv5foAOEdCk+z42SgkVvBmHzOvXbb7QLSEbRwFTjfjB21Gg5XGwHJAeenzkli6hHL2nmrKod7Ulm+w4FBwnWpRKIvTvE5g3Lyw9aQgvc5C8K4LKV9axo9r0D1nRB7BYVvULdMfFuX1SpBseWx7i6/oJJ8MGrenUevraaFMDbebNSY8OTlAjPxNP3MC3oHaFx8e8cUIs2gAopBKHONmbqtVaICSBbngroDvZutlOKZJBRnLwhek3s9+Ixf6nPeidWLaU8LN4gHtPfT0C3rSBra/3s8qj5xrGoTU8UssOAIPDFPOOJxYK86+vjWsTLc2ZGQlqQRtNMn4bLAyh7RbsLo9VHtzBWjzYdcneaeKyD0w9UkV1z9C8gy8XWgDTJE/ugO4+zmWxg5Zq/Lf3HV46IBzd2rbT+78Qc+HDfJ/xuCPsDKFZkoLZKSoTlJHnBCzm1e1s4BOQHH0UZjEpSbui9efw90sI2PYMkKkr8S2ifhDX1ruNqE9lTzAfs+rVJ/Km2VuAh9xzX0R6h4nnNW5PaYRp+NkbE79c+bqa67pX9JhE+07wkGvyv4F+AHhQfD+KAdrN3LNmC1ieGyrtM8ra7J5g1OzaOVeMoFCnj81G2N6HfZXlvRsP846u axj8vwYx vpKXSzwU+DEYU63Tuntgaxc9iJ7suHH/QS5PxxKbhVyTlVIfM7IOXMrRGSXo0gBl92YIkbkvFdddb1bskwq5vokVoMs0WboHdnYFSPB0nijAPR/9VrnE1mzEGpM00MkZglPiLmfPQhp4+yQqg/NZOmSSiaTOaHCBAzKoUR3YzT5dKTDxMypCi7UCjUpp02/ssXwmyMTwlua2AQxpujEWVIyv+iANCGn92197bx1hGSPR4Bc629f/Ony3+RJ1PdqQxtD7VX1JIZzdQip/fQTQmyn4z9Iz0QNBtKucHPDng9Z7s7VxripLgOiprzygQFLNlQx8DTURjekkUVPg8dD/MRaKrKzMUm0kUoCZGUMn5me38mldpmsMzJRXgOtr6pIwnoikfCb2dSUQrYwxryEfftodfUWF7eEzJvzFpqdeRUIF7JQF1DOIs/I/gs8A3RarXFYE9CpiEJZ+jGGvLlxnpccbyFteq7BAE8zZypU2a1aBXo3qbaw/+BIhzWIvIKQrl1+yaox4Bb0tIYzn+OWCM71r1flJVfslzaUrkoRL9ueeN7aZqFX453+zrH0s/t1iQsr2QFX5LBGqA+5Opb0p4qNV9fHRy54wJ3kIejpzLDlMqUippKuwaPnfOwYziWV5sJaipGh1QVCbHaum5jRoysqP2AYSMuwHPr5RLoKRjwyVdg+k= 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. Mount fails if dax=always is requested as a mount option on an architecture which does not support DAX. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org --- fs/ext4/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c5fcf377ab1f..f2c11ae3ec29 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4743,7 +4743,10 @@ static int ext4_check_feature_compatibility(struct super_block *sb, } if (sbi->s_mount_opt & EXT4_MOUNT_DAX_ALWAYS) { - if (ext4_has_feature_inline_data(sb)) { + if (!dax_is_supported()) { + ext4_msg(sb, KERN_ERR, "DAX unsupported by architecture."); + return -EINVAL; + } else if (ext4_has_feature_inline_data(sb)) { ext4_msg(sb, KERN_ERR, "Cannot use DAX on a filesystem" " that may contain inline data"); return -EINVAL; From patchwork Tue Jan 30 16:52:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537744 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 540B9C46CD2 for ; Tue, 30 Jan 2024 16:53:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26DAD6B00A6; Tue, 30 Jan 2024 11:53:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F71B6B00A8; Tue, 30 Jan 2024 11:53:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E373F6B00A7; Tue, 30 Jan 2024 11:53:07 -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 B3F1A6B00A4 for ; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 830891C1288 for ; Tue, 30 Jan 2024 16:53:07 +0000 (UTC) X-FDA: 81736572414.22.47E779A Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf29.hostedemail.com (Postfix) with ESMTP id 2376D12001B for ; Tue, 30 Jan 2024 16:53:05 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=pqI8Vxqf; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf29.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=1706633586; 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=C1HMlvGu42Plp5r2VyEDFqQXOtGIITlr8J2Fj+qB9Bo=; b=xjh82PmFAvm/Xf2+nvdpay7RZMc1qH7iT6Q7kAsEof8Fee1v7Oq8PUJNTn+KLB/cA4dEUf JvumIFSOWktksCEI+GXLDUeoijkwqShDaWRpO7ZB7W7k6Fj4S0OmLWFGgkPyh2zFY6qVw0 ZM3oz80l/LY/HtKe+ReBxiNo62o+lIg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=pqI8Vxqf; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf29.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=1706633586; a=rsa-sha256; cv=none; b=EJL2eNHHqgnbHcFpFvBzpvon1bCNY3Z6H8oF4CbOpYGsbsXeQnzAsyld7/5HTdDI3wZfU6 ATXy0L+t4r8IaFhF6/YL7M0Wsw2Vr73twJoNxTEz3CRbsWqPVaysijDW5LePI6YGERLzM3 eU25qK4cr+pQnwHW6CN1PsrvpI51/qI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633584; bh=TeqAlXONUU5nqUDfGe4PPPm1rluqnLU8fKx0/5MP6+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqI8VxqfmApmjaDjKQX349yC1ZLj6cXG8NnjM6GRv0T0PqIXwhiwEPrza6mt1yGYj bPAMgS7faIoPvOFK2j2p8dbPw+IGautTYGnIeOJ8GcJ/S/4+3Tgn4lSKJxsLiC/5sG 4fvfrTpcL6JBjlv+dua8XbJsXqQyTP0mHbPrjpe3/oKtSxJQUFlSzrrBBSK3nUXR69 4Q7uQJi1R+AfVFW2LhIChPTjmyLDehNjjBOeS0GsHokH9TPg3wr/Lki3C6hyecKDio UYOhuErVYy275XFsBOAFeY8gqUTg1T9MkuzoJO0Owfc488XdmddiKhpHV0zLY4x73X JoaEMIwFP6lkA== 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 4TPWSc0vhmzVgK; Tue, 30 Jan 2024 11:53:04 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH v2 5/8] fuse: Use dax_is_supported() Date: Tue, 30 Jan 2024 11:52:52 -0500 Message-Id: <20240130165255.212591-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: xhat5wwyua89frp8ys757zbo5n6ujm6h X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2376D12001B X-HE-Tag: 1706633585-791200 X-HE-Meta: U2FsdGVkX1+zE66zAGapG6r4+F+NbvEvj6oigbS8t/FKF4rxYcYzLr7g7wnU+TtHEeyCzfDi7CuOZeM+GzM70VUjv3vBwnz2UjDGFQYZALQXosXtUOKEPgIDEOb9R4bvs/06NzFOxaDO6r0Y31yksNZosqa055Bv0JVEC/HN/9FgzqxOiC6x6kiYudCFzBAv0SvcvE10TAlW2L+HwxF7ZTiWPBhvPncY3awlqEhsUUfYAMihGSSegXibIGw1wePBCzodcLZCfO9h9eMqYT0Tx/Y/W1FBkUzk1GBSucAxKsknALvrtq+xP1TlQF1jE/FYgwmeAN1eR7hS3Xa1jPLXUxM0aqMd5E1O2XfgbX2DrN5iym4UlNm5zogdt9ADm4xC4iMkFe5dG2C9U6Spf0K3tDse/PMb7R5sPOoZW4URWi0SBTzPBcvscMDmmZld3A2t3GAui5dabwEbhDdUbHJrsEk/K/ZNPu7IV/I/paqzb261eBYDaxLj6F0HPoMETdDBFVs+CuNunJfJxQ2EjQP1Mr/uxK0FDS+di7Zmyfjphfdm/9s6g1uZLs2IP8HgpHvYUf3PEyfMyJYE8hSdIPDca9P70AKHwo/uTsPDC0TuGdFbDNj01+gsmJXJwmZzNR8jLrqMexvX6qXG4MgQM7tE2j7oVrFweeA75+c3kCwU59rFJT5QXX2HKSgpNjpX8CWaDqLTpdjDwi+mMsxlA5l8eATrPi2OZcyFRtOrQBEYeCS2JlisPzEfGOBzt36jbWImNUp/Ebi9zLCGWZodY7jT7ThJD2caVOgQIxUAEMFD2D5HX0BsroSP/rbIAL2HCcSeCUaqBmitVlAfW/DaehpfBfa1h6c2duW3WqcYk3q24bVosyQGJwrZq5yiSrywimOMIFMiPpv2tNTevz8rAXf0ow2ZkPQxApc2jqCoX11VrTyn4eG333DFY0XK0PVUnU9a0WRhFKI0+DNXunbmPVw uAA28tIZ bsEL0j4M99pFLtJU= 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. Silently disable DAX if dax=always is requested as a mount option on an architecture which does not support DAX. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/fuse/dax.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 12ef91d170bb..36e1c1abbf8e 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1336,6 +1336,13 @@ static bool fuse_should_enable_dax(struct inode *inode, unsigned int flags) if (dax_mode == FUSE_DAX_NEVER) return false; + /* + * Silently fallback to 'never' mode if the architecture does + * not support DAX. + */ + if (!dax_is_supported()) + return false; + /* * fc->dax may be NULL in 'inode' mode when filesystem device doesn't * support DAX, in which case it will silently fallback to 'never' mode. From patchwork Tue Jan 30 16:52:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537745 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 AD104C46CD2 for ; Tue, 30 Jan 2024 16:53:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EF486B00A4; Tue, 30 Jan 2024 11:53:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 59E006B00A7; Tue, 30 Jan 2024 11:53:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26AEF6B00A4; Tue, 30 Jan 2024 11:53:08 -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 DF6DE6B00A6 for ; Tue, 30 Jan 2024 11:53:07 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A105F809A1 for ; Tue, 30 Jan 2024 16:53:07 +0000 (UTC) X-FDA: 81736572414.26.3AEB614 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf28.hostedemail.com (Postfix) with ESMTP id 16D4BC0013 for ; Tue, 30 Jan 2024 16:53:05 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=bihVHjMT; spf=pass (imf28.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=1706633586; 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=SUrs+a+seJwqRojpbljVvvOfD+UCI3GAhDJI94PFAUk=; b=NGP1lDvy1JABt9VOMDA25/cRPGfynud5FOF+Bs6IMFAYvT55UUGqtaZWcHRFcRd30tjpmm prjvmhIsc/qYiy36bpZXFv40r4xLinSn0RVkk/znahHBlotyCvjYIJChT1mQjDTwgBCMjz 2wSCRu2MMM9GAOrPqy4ncWuN8D+8ahk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706633586; a=rsa-sha256; cv=none; b=5j2qfcXUUAVzs8APJLyCx4JUi26L16roISWHbIp4tbsXVKQLnpTnJUYRyYTFZvLAJ4vdPf RDEafS2J6s4RcLyD773D+CLxtnIes3/f6YD8Wo5h9rLb5AxOyxe2DM3DfmwfkdmzAs7FAH rHfHuwXXT4DDeC6YU4elvb9eksRkdtY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=bihVHjMT; spf=pass (imf28.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633584; bh=4g9gvr2zRDJKqqYI0mUySJAzztyEKM8oIoATdWwyg7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bihVHjMT8e4Ue70q8Z3rvXqCi80gjbTnxicO3gxmMDeC0vxcZR8yP9+fyJ60aDdvP ZtH4Pl0qqOiXSzGsu372Hho4/PFKWCmQ/ZynIysaQqFioxW895NY9ZquW4AKykzHS+ dXa+jzGs49fy0IlxhrTtJEYeYGP8KdB6hWuNHrSgpZ394PbhBgU+SC44d+s6lxIKiv xp4IyzKVfSbh8zD8n/wWr6HDAgtd8aNpc2E5rpc/ONXK+2DS67hV2tArXqF/9NqGyn 5zcr0Ec3hXOJ/iQSANYw8xp/neByDUFebT1ybnHZOpWkPtKYp3zEucDjWFCDl7+Mkf hTksPwIfbI8nA== 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 4TPWSc3G2mzVgL; Tue, 30 Jan 2024 11:53:04 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH v2 6/8] xfs: Use dax_is_supported() Date: Tue, 30 Jan 2024 11:52:53 -0500 Message-Id: <20240130165255.212591-7-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Stat-Signature: ycfeiagj3pughmdqymhijaogx1h1njaq X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 16D4BC0013 X-Rspam-User: X-HE-Tag: 1706633585-419145 X-HE-Meta: U2FsdGVkX183MI/3gLTibyPNdsAIStLHLMWSKZBX7qiMuMPsLQfiyl+QzfhLODw2MnpPEXEZa8F0/6CadPxYR3fkH7/Wc5tmmHleLDIODRQ0baozuxdffVEYh0hYABlabIxx5UJWsU+QZLCbieeIyccYXMhGDD4WLat4ocnxON88RWG9vsbGUJf9LQuukyPTpa5LG/MNGBiQDr7RQlJh94dbGcJFz2cGpAoOyG4r4VKwn0DGaL23rqZ8o4LykgNf/71MLU8r2kWYKKSPFq2jdIK8i5CaB6UmhAT6rObomVWSLcr3R5nBwXoGjyd8uVtFhBu9zv0RTBwdeiaFwQ4JOprNewKLN+43KJExYbcx8xjC/R7Qncv8CzssF+rk2VEV04sqBi/gVjspq2p/Nj3WPUcs7PogRM/nDKEXSQFVix26bz0uoYcC6HlzNRHZTtfe8nEpfVjXCYYIiuy/F8Mt3byRru8O/0N8WdNi6/XjGjKqJCsRVKZr5cFGJqkX+oivQ3BRTvmvNdSt9W4fD+JSg2jDtUG2cEbGlBqUswx3Vg+lmzHa1nyppCiOAyx/EJGCY4ttSermG7BWgLCNEQNjV91jlSp5oywKZ60nWmBVAmbnW50nyJT75zQ3i5iRu56IoNtwdlonEcSkbuOeTNpLqmnb1govMT8kVDXIJmGMTyP4OWbfY65L+J9Ej0N3xrFh6fsdOndla3mo1kWzZW6HY9CqPb3LPNf+PZQTsv4ZJjA612B6gmGcoNcLIySu1I5UBIf4Oq8bBvbnOGHqyXKH74QVI3Z7sI2/G+zl/O3UIZ+naiexAtB3X24EHexHJc57FvyJjhriNpzxNGP25ArrEELdBx3Bud9wRWqjaxwbFzfe0Y+Pej1YYrpQFgYNwght4L2aoVzEH9tZ8X6HPKjl1jNLlATbZe4x7FJvKTN5B4jafHP8sRhoeib3H/5s67+Kz1caXmSmtLpT0OT2+pj oniIQKN6 u2NszVnqfjQ2jG/PHVhyos9qnTR8L2JrJi9VrzpDXmwbNGRZudDKMENPQmclhjgkN+RO58UBN4xEHQUsNyxcrCrJrHpFyqsHb1LFdswfSmSAuk2ySV4a3b7tOTRzzZjWIUGiq9jqzLoOQ25lOm7qLNnSjP7BPhgEk8Jo8Gwsik68MlDFRO74n70v/XytI5HXKY1gtJL/iKLRWqk2tD2PFrqPzGr1i1gN1d4AWZx/JpqjpX7BRcRk9FJpi5o0rpcUItLw2XHxXTVU1YAAdhZ2R+9mhHJM8BsLd5D0L58KnugZuxZR4Y9n9zS1ar96XJQYydEfwvV+yapjT3FaJ7SrXic2st6LSODY03jL5njpTkZM2EcAtr2+UyuHIcq4eh5Q56581hQ9OCiIrWBBdFksZaM8qUe6mb96J47oDshQIzhvTEgX3RvqruVT71uuGa9e9zccc2sz/F2nMBg7tjriIGKkPqxxDH1L6tUVhLAz/b5zLPD1+z5qjRWeQ8gEllApPhw67k2vxhNUeTcHbNv10vsPfoDJ71eTQAAbEnGCoXkIH6yt+CY88z0Dk14FWLo39kNMUDBkiK0i/Wcgq9ViDMxdg8jcxhGQWhjlvnD75/9UUF8AZ+vCMc97WyIERrJDBc4QHCRDSnv+rG2c= 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. Silently disable DAX if dax=always is requested as a mount option on an architecture which does not support DAX. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/xfs/xfs_iops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index a0d77f5f512e..360f640159b0 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1208,7 +1208,7 @@ static bool xfs_inode_should_enable_dax( struct xfs_inode *ip) { - if (!IS_ENABLED(CONFIG_FS_DAX)) + if (!dax_is_supported()) return false; if (xfs_has_dax_never(ip->i_mount)) return false; From patchwork Tue Jan 30 16:52:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537747 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 7C63EC46CD2 for ; Tue, 30 Jan 2024 16:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DF276B00A5; Tue, 30 Jan 2024 11:53:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4183B6B00A8; Tue, 30 Jan 2024 11:53:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21E296B00AA; Tue, 30 Jan 2024 11:53:09 -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 E75946B00A5 for ; Tue, 30 Jan 2024 11:53:08 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B7B7AC07B0 for ; Tue, 30 Jan 2024 16:53:08 +0000 (UTC) X-FDA: 81736572456.17.CBF3888 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf18.hostedemail.com (Postfix) with ESMTP id 0F4801C001C for ; Tue, 30 Jan 2024 16:53:06 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Eu9fnlqf; 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; 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=1706633587; 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=YMy6IXOqkzLAf7JQHPGwuz4/H4cY7QsizTLKbbodfeQ=; b=DrCn36mffh1pDoinuoDkjtHl0RZeY34Oj1OnI0XJjn/k2NuTEoLzDBdOT9ui4PYAEPcYXt 35yu+30jyx8og+A3rNujJNwNmlWOFu1Me6ucx/e08/7c1z32BZPBmKIBRydAQrmnr/hWeD GcdcQLxDvCGIB9Zul0mtZbB6RUmUR6w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706633587; a=rsa-sha256; cv=none; b=iZ/pSeZtrOGVr2y87/26QB0qotE9yBdYd0l9LD98qpjwaW5TU/RpcbvbjLcXzYGkxwmmf+ CGoBssv0uHfivbCAH9IRBAO4+9C0j9j9bvrRP1kdXP0CFWrL51hQXGMnkOVpG0VVnqZb7k VbLwOIbhhi5R4n09EoVKbtq8YE7zeRE= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Eu9fnlqf; 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; dmarc=pass (policy=none) header.from=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633585; bh=XuWaMxt4d/3dm7lB6U+HSFTUUg6+UTaS46cwYkLEDis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eu9fnlqfzhLzucHQO4GXUi5CfnX64GMjpe6VUPPfT4s6bICAVT4o77MD8q7QjAJSP YlOp4I4vA7Bu5BearWb4qzDlQjHp0BPHrxrbBkJPO/2COFYNJx5kdHJuU7fAbWAquJ IzgQPX1lw8z+xki2gN6/qLPbeZeIEJI6bXXh2m7czyaaH5c38KsSz2PfKAh/CGa5w8 /pw/3osZ+zO3DcL4GUYFfdb6WlH315jS5xDN3ZakazBLbrXYFJr5CvX74U4sFWhPoR RNBEIN3CJKWHmlzN6rkvu+KirGViahrvLPjkkKihr4Tw4e3UxZnaRtd8yK1Xy8h7pg 2c29zPZ8Pv9hg== 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 4TPWSc5mWlzVgM; Tue, 30 Jan 2024 11:53:04 -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 , Arnd Bergmann , Russell King , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org Subject: [RFC PATCH v2 7/8] Introduce dcache_is_aliasing() across all architectures Date: Tue, 30 Jan 2024 11:52:54 -0500 Message-Id: <20240130165255.212591-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0F4801C001C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 37jbr7j1dr5ds4qs96geq51r3xginsz3 X-HE-Tag: 1706633586-232067 X-HE-Meta: U2FsdGVkX18WGeDXJGcEkBMI22uX6keYfL111kl6kDUU8mipeP5VTHtvCLPl8ltHE0m/aUJJiG51AxINNUbTPVzns2OLvisb2wsLbk8zYCQBpn6HrIaKQZT3bLxcrA0sFgnHV2arpTKOA3EQNj1kUsR3IoQtODMqJuRAI8oNK+0rwkhR14QSz45TG2EMHqaI1j0XVCkEv/ilXbA6suNwRkcIiGGG/xQ5UxKPY9kXVPJ3gGEyuI8WejHtsAolHWEo9QYNR7n1llQSOfNhkOhLPj5Kfp6E4FXkpTC5SN+Ui/OHb0af82lwSmjlbF3uoQayTr+oZgtkjLGEojG5lT/LCxAdQo0lOyMJpaeRePCNHIzSHL7gmqMM0ds1Q8yrJ9PrxLWEGGJroqHUFMB0BvzABaw40JvTo+tnHQs+diT5v5YSxoPluo6QIFoZ8ckqAnjAQPtGgG1wCazojLbUKptkKhgFgCJBWj7KR/ojm3+w3KsVlC5dEzW1FpdBabIJXLG4CxGKvx2k6UwwHWswXveHhGVtXz6ILckqZRqR3XCEL3GW2UcrYTDt6UVETFAR1KPIVBuj8MQVKoJ0KbeDG2ofI7zzH56aGtnhTMPAllBuDe5W4U0Idjt0J18O5yHC2K1hUcIguTKHeuJISy0xPTtHxI0m24HBcmgMH3JqYSIhb9OIozD4Ea3v6hMqYFrS6LZg20js9cm55sEy0C+CxP6yopmexRVLY3i4BR9akUjQ2vQctYSz9qH508MxHvAeOLGfIUzamo/B5dSAivhl5ZXzokI4j+bVrzs1Su9T6i2L8ljI5LzCLc3w2zpIjPpRRJEHGcJZJtZzzGwLLhXSXWPeYe8MmZo49M6vqdNNTaoKngSo+25TPhUnfr9Tivpsao8Ldy6s+vonxyOSCwr0YoWNWsf54y4DzIfKnI7/qzOvsLza2Rjsb4RXil//PGIBBUKrHcaSyEr/bpFKJnjMkao uQPKnW/J Pn5vZDC7N82Klj/jpJ4Nicp4ypYCsi5FDlIsvOePVk7q6uk7pe2uVqaOaWw4K03LStqDzz+kvMAnXJvAL7IsUMe0jgI6Jxn6ebAUwCVVrGXypP2rR6NXFjJo8Qz++3KaWxF/N6+3EF3NbsGBiWIJ36vZM+vDcc22QJMww1FD6isenhEiBrq/N6sf8ZnQUK+Dxs+6a8OEQDHmgXWoUHlzaXA4bPYWuW99Nf7D0BV33R02r5a5k4wi9VDdmLqNw0HQglDOqx1F2E77hDpqrygIAhPY4n0fa7r0qJKdILeF6k1K2qHX7atVvj1FSaR4gjHbf1EybOCR6PgCsZwO33ly9g+KcYM6DSCdxoJoIvS93+TVgttZ//kFTS7iOwFJnVy6fiMbPVZLAL+YeVPY5IepVPEYLszzlVpUEj5X0D3+WjC7XIgi5AyX3A3+Krd3ar5CKJoEu+CeZVNXs3GdsIrOfUWyB48hFLB0S9bYQs3JznMIHLiQ7JVqWxDhM5rf9F9ilDqg/3NE7IOltKMGCMdE+dCzpKiXhBYyGWXnPkYz3t253U/0d0PBbAgFQHs2lKI/9b1xSuThSxJ71R/QQFbUkO43yDfifEKn2kej4U8BVJcGpGBxiRmO897cEg22kPuh1kpuvMlz8viq29zVoE3Z6due9VTsp/DP38193KpU7g04G2g7x3t/Unylu5tE8rnk+s/LPMgLFSeSVLlQ= 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 data 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: * arc * csky * m68k (note: shared memory mappings are incoherent ? SHMLBA is missing there.) * sh * parisc B) The dcache aliasing is statically known or depends on querying CPU state at runtime: * arm (cache_is_vivt() || 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: * 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 Require architectures in A) and B) to select ARCH_HAS_CACHE_ALIASING and implement "dcache_is_aliasing()". Architectures in C) don't select ARCH_HAS_CACHE_ALIASING, and thus dcache_is_aliasing() simply evaluates to "false". Note that this leaves "icache_is_aliasing()" to be implemented as future work. This would be useful to gate features like XIP on architectures which have aliasing dcache-icache but not dcache-dcache. Link: https://lore.kernel.org/lkml/20030910210416.GA24258@mail.jlokier.co.uk/ 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: Arnd Bergmann Cc: Russell King Cc: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev Cc: linux-xfs@vger.kernel.org --- arch/arc/Kconfig | 1 + arch/arc/include/asm/cachetype.h | 9 +++++++++ arch/arm/Kconfig | 1 + arch/arm/include/asm/cachetype.h | 2 ++ arch/csky/Kconfig | 1 + arch/csky/include/asm/cachetype.h | 9 +++++++++ arch/m68k/Kconfig | 1 + arch/m68k/include/asm/cachetype.h | 9 +++++++++ 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/parisc/include/asm/cachetype.h | 9 +++++++++ arch/sh/Kconfig | 1 + arch/sh/include/asm/cachetype.h | 9 +++++++++ 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 | 6 ++++++ mm/Kconfig | 6 ++++++ 22 files changed, 112 insertions(+) create mode 100644 arch/arc/include/asm/cachetype.h create mode 100644 arch/csky/include/asm/cachetype.h create mode 100644 arch/m68k/include/asm/cachetype.h create mode 100644 arch/mips/include/asm/cachetype.h create mode 100644 arch/nios2/include/asm/cachetype.h create mode 100644 arch/parisc/include/asm/cachetype.h create mode 100644 arch/sh/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/arc/include/asm/cachetype.h b/arch/arc/include/asm/cachetype.h new file mode 100644 index 000000000000..290e3cc85845 --- /dev/null +++ b/arch/arc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_ARC_CACHETYPE_H +#define __ASM_ARC_CACHETYPE_H + +#include + +#define dcache_is_aliasing() true + +#endif diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f8567e95f98b..5adeee5e421f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -5,6 +5,7 @@ config ARM select ARCH_32BIT_OFF_T select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE if HAVE_KRETPROBES && FRAME_POINTER && !ARM_UNWIND select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h index e8c30430be33..18311570d4f0 100644 --- a/arch/arm/include/asm/cachetype.h +++ b/arch/arm/include/asm/cachetype.h @@ -20,6 +20,8 @@ extern unsigned int cacheid; #define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) #define icache_is_pipt() cacheid_is(CACHEID_PIPT) +#define dcache_is_aliasing() (cache_is_vivt() || cache_is_vipt_aliasing()) + /* * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture * Mask out support which will never be present on newer CPUs. 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/csky/include/asm/cachetype.h b/arch/csky/include/asm/cachetype.h new file mode 100644 index 000000000000..fd21c815a8e4 --- /dev/null +++ b/arch/csky/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_CSKY_CACHETYPE_H +#define __ASM_CSKY_CACHETYPE_H + +#include + +#define dcache_is_aliasing() true + +#endif 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/m68k/include/asm/cachetype.h b/arch/m68k/include/asm/cachetype.h new file mode 100644 index 000000000000..24298a45b215 --- /dev/null +++ b/arch/m68k/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_M68K_CACHETYPE_H +#define __ASM_M68K_CACHETYPE_H + +#include + +#define dcache_is_aliasing() true + +#endif diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 797ae590ebdb..cc21e88b2dc4 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 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..b967c4219c31 --- /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 dcache_is_aliasing() cpu_has_dc_aliases + +#endif diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index d54464021a61..af3a0631f4f1 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 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..3027ba4e75ab --- /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 dcache_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/parisc/include/asm/cachetype.h b/arch/parisc/include/asm/cachetype.h new file mode 100644 index 000000000000..a7f49ff26e3f --- /dev/null +++ b/arch/parisc/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_PARISC_CACHETYPE_H +#define __ASM_PARISC_CACHETYPE_H + +#include + +#define dcache_is_aliasing() true + +#endif 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/sh/include/asm/cachetype.h b/arch/sh/include/asm/cachetype.h new file mode 100644 index 000000000000..55619e60c55f --- /dev/null +++ b/arch/sh/include/asm/cachetype.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_SH_CACHETYPE_H +#define __ASM_SH_CACHETYPE_H + +#include + +#define dcache_is_aliasing() true + +#endif diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 49849790e66d..8794e0d0920f 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 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..3ebc0e08a298 --- /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 dcache_is_aliasing() (vac_cache_size > PAGE_SIZE) +#else +#define dcache_is_aliasing() (L1DCACHE_SIZE > PAGE_SIZE) +#endif + +#endif diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 7d792077e5fd..54dbe9f42ec0 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 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..1de9337e9dbd --- /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 dcache_is_aliasing() (DCACHE_WAY_SIZE > PAGE_SIZE) + +#endif diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index d504eb4b49ab..a307916fac40 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -138,4 +138,10 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level) #define use_arch_cache_info() (false) #endif +#ifndef CONFIG_ARCH_HAS_CACHE_ALIASING +#define dcache_is_aliasing() false +#else +#include +#endif + #endif /* _LINUX_CACHEINFO_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 57cd378c73d6..3fa87e45883d 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -1016,6 +1016,12 @@ config IDLE_PAGE_TRACKING See Documentation/admin-guide/mm/idle_page_tracking.rst for more details. +# Architectures which implement dcache_is_aliasing() to query whether +# the data caches are aliased (VIVT or VIPT with dcache aliasing) need +# to select this. +config ARCH_HAS_CACHE_ALIASING + bool + config ARCH_HAS_CACHE_LINE_SIZE bool From patchwork Tue Jan 30 16:52:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537746 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 C1992C46CD2 for ; Tue, 30 Jan 2024 16:53:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 099FC6B00A7; Tue, 30 Jan 2024 11:53:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 026896B00A9; Tue, 30 Jan 2024 11:53:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D40EA6B00A8; Tue, 30 Jan 2024 11:53:08 -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 B85936B00A5 for ; Tue, 30 Jan 2024 11:53:08 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9D5D3A2116 for ; Tue, 30 Jan 2024 16:53:08 +0000 (UTC) X-FDA: 81736572456.13.B9F3FFD Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf19.hostedemail.com (Postfix) with ESMTP id 0F91F1A0002 for ; Tue, 30 Jan 2024 16:53:06 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BUhe710j; 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=1706633587; 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=jZU2ZbbgI/b/87AeHhjaYiSd5/oOGG+UvSS00fh9aPo=; b=rsvy5ocy7Gaf6+BkE3ui7iFGjBFhz14wF72vj9uK8gFToGW/+cJXCiw1hg3MHFJjZ8CM5H rLHCabKTU9sYcrpH/ScM8iLQNvL60/7hEts4Zf3w8WnLOWnRYRYhBQFC4NMlJ7J0Vbv0ik NGRgNlXI7IbZx/KPYP8BqEJUaHK65rA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=BUhe710j; 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=1706633587; a=rsa-sha256; cv=none; b=b6BJk+589B00nNbUfnO+t0wKuzQuzWzXCYlPgySz1w+sbBv50ho+BCMRuSExMmnh0OsqiQ Kfkhs+ZduiE9qdyJjTY7KW5CtQyuU9b/uBKZwkux2nxEVmZkxtOBYyDlFCoU7afI1+iWkE k62BTg67Dn2b07Ddg8d0/VWc8XBJMQo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633585; bh=39364yK8Vve2TZEwvAasv/nldxj5QFqZMMVmBMwwiu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUhe710jU2/derdpsA0dmrgdapNQmX0LXTEssfQdWcX2L97NEiIfvqlxiNskzlCQ+ uFBF2yIOIW7lLhGlgmLYL2QC0ZeqL0RkTwoEYx20D9bs890S3wdBKzVJdaeYrnozqP r4rIEq4WyYWNEKxGADF+jEmZYQH3YyuJEpH3/tIUj4UOrrV1coGgapkbjslqVS0p7F g8VCDbYKUyXI00zoYgdo6nbeTVRFmEiOfxFc5YMj8+QBGAhQlPTdTKLswnRa7tKr2a n8HrygNAcyh6r6ttOBpYmgmUin69L64Gw64u0Grq9Que0glHbaZLrtM5V+rY3Uav/H Pv8DFsI0xlUoA== 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 4TPWSd16qfzVlV; Tue, 30 Jan 2024 11:53:05 -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 , Arnd Bergmann , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 8/8] dax: Fix incorrect list of dcache aliasing architectures Date: Tue, 30 Jan 2024 11:52:55 -0500 Message-Id: <20240130165255.212591-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> References: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0F91F1A0002 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 5kx5osid94iorp1faq8agha3r9wwcm95 X-HE-Tag: 1706633586-391634 X-HE-Meta: U2FsdGVkX19tJ9j3WiDPrSpA+o2/grYM9HINZsb51Q4EObxk1ueNgmixUVs6tbkF+eXwu6tpdhI7hKU7fQ2FJOlK+wBRSW//iyJqoqYrmO1eS29+Hzq27vib7euIMhVftZhVb2JSZMczt10+LNLUz1/lrSoExxqAlPBF5rYZHhoggJfquUngLoM1+JCuQXqIRSP6Rr1OoFwK5EwIul4/8BoQEtearPKVfhs3F46oJA0yVKZrv95ewuw597F3lQyvkMDG3+6C/X59dOWF/CfzShd8F/dO5qPbpVRhZ4Rf4nLQaVwpeFfSrCIZwCQTP/4AA4a3uIpvFKIn3DL6Wj8Fk9jlHNCTcmjyJEpFtRjamLG9YXotzvqV3fE80Gt0nZf315DZkSNbBXf69mj/sBndTmrPl06xhGPwEHPHEX4DmAuYukiibY9kE20dCaXumSoZ9GjXcS+m5PIrrewaQiLkHDl77lIO71K8R3/cNdqCtrhCi66E7A2Q1Z9bWL5PZHyOO8hgXXZCJzZ3t7/prJHsdoDa2+5PMZYg20p6SW2eHyrQ0IlLqwbG+AFLUx8BP393RvUtauqpe8HENN28aVNoy1UdSyDgJaZFDTKAZTjQmJqLhaWZjesYkWU+dFtRKhUlCWjBYTYx/HeP8yXFVnCoeN3TUQPTM6pQhqzWOHKYhg9bAbAOa1HxQBXysx+WizVGUKVtGQKsm1NXNsDyBTVn7mLPCiJ+LaUrKMkTmEtAph1ipN0YfiaH++N/j2Na3Id5bsTNwqG0Km8e1CvTx7bIuGaQCSwanXxRiogmll3dT7inBWHfqikZHJYkPcK1HrxZa+DFUtw121DpGAKDQuuZSyW89KT5Gz01cqxZb4gcY2E4H4r5Yum+07kO6nqSAGijN3mxOMkGczSL0tEJI8aPAxkcflE2yMKnMeyUp5iJ3onQrTKqncvrLlElP1E1F6ursq8YAdyoG3TDwoF8cUB BNXS8NZY lcjujEkFtk1eJvfFQAS/14fGCm+Td9msffcu8EvhJFhrK9lPUXxsBBzoLTJq9BZU5otPaxn5PvzluO1ERB6VxIbyBEcTWhwMtnVxjhw49K0pI0jAxTNjFsAJ+SWpHackmPCUsVC6zBlvdzs2k77fPvL/kOYH5+7lpJlNdMROAZw5mnkuVg+LP5rg9SkPBSUDhlLI7QNAkmfZ4+Z0802jc95GmV0Ay25jGmnY7hKqtHPZHIaTiguS9/V3dSzTx6vtBUSDNU232Htj7oe2tXPMbFqMXz9UaQNM+xFXLwQSRimGsaBSMeYRM6ocxXHLuY6lzL6ZDjeohNBKe9czpnQi52BhCvtbaKXUrcSIoPJha6ZpQ/b2g7tma4fFWs9hwp4Fax91+0YaUES0ROYp2KLPjp/d4qU7jn2kJ/pUGYRjWQNLAezzl6Wm1E1isDCvuPGhTfsTGTpNd1haX4Hi/TQr8CJ3/6BzES7cy9HbWhnAJrVb8AElgQcqCr3E9lcGexdM2WcdTEtLgUoGdRJVR5LTkXKJJTzAopuJ8/hTm4t4SfsWH6guYl9qA6e4+ADa8edp0jnyZ 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: commit d92576f1167c ("dax: does not work correctly with virtual aliasing caches") 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. This was turned into the following implementation of dax_is_supported() by a preparatory change: return !IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_MIPS) && !IS_ENABLED(CONFIG_SPARC); Use dcache_is_aliasing() instead to figure out whether the environment has aliasing dcaches. 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: Arnd Bergmann Cc: Russell King Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org --- include/linux/dax.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/dax.h b/include/linux/dax.h index cfc8cd4a3eae..f59e604662e4 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; @@ -80,9 +81,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, } static inline bool dax_is_supported(void) { - return !IS_ENABLED(CONFIG_ARM) && - !IS_ENABLED(CONFIG_MIPS) && - !IS_ENABLED(CONFIG_SPARC); + return !dcache_is_aliasing(); } #else static inline void *dax_holder(struct dax_device *dax_dev)