From patchwork Thu Feb 15 14:46: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: 13558537 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 0FBEAC4829E for ; Thu, 15 Feb 2024 14:47:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D49418D001B; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA7C58D001F; Thu, 15 Feb 2024 09:46:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 993A78D001C; Thu, 15 Feb 2024 09:46:44 -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 731A48D001C for ; Thu, 15 Feb 2024 09:46:44 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 48CB78098E for ; Thu, 15 Feb 2024 14:46:44 +0000 (UTC) X-FDA: 81794314728.23.A901A0D Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf23.hostedemail.com (Postfix) with ESMTP id A547914000A for ; Thu, 15 Feb 2024 14:46:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=YtP1iOrG; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf23.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=1708008402; a=rsa-sha256; cv=none; b=DiR8Y8BcAApseqLmR1NIjCNKO2TAlkOcpgvPUADAU9RtjEwpcoellXYY8bWtD2/iND4k3u uVf+YBaX9rp46Yi1lR8Y8XH5gY3OWjNe41oBLdEaW0+ShARSK6Z8IqM3xjG6VqjYA2xksU gOoA/hDhLiNUGur4Ugbdrgbd7LIA/EU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=YtP1iOrG; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf23.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=1708008402; 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=OG/CzkI43SfX6xCzBBAMjDKIpbYgr3KZ11AqPANjUKI=; b=WUTLE2NVXH+O9ruV2km3ERwIlHdnLjPGfTiSBCZsPNjxEkI4i1vfNUzlXoNzw6bwF5OEiy qoJrqjlA6OOEtcbrG/1oXL45on4FTfsn220yZp54iaBMKiKXvVWROC34GRkl/bbfLAH01V KcVSW+6fwXBgVNzYlUN4Ni3ty43MHv8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1708008401; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YtP1iOrGBZ2DFcfkMrFn0KrohYHueOZWWxnb1yMeBkD/1lvsW2xGteSYalPZKSM84 dPZuexmp1ywRE4ZTQOjFAgKyIAvz+xWNg3zjhDySnvi/5JJ+HqV6yNHbJnIgA2V+Cz LrEIdoTvdqClLxE1CDwMu7BvH4kU+HynYTL8FGvWqQVF+ZUtTFmBtps3Fll4hy5iYb VWfnhivvj+Lue04BRQYIzFUyJj/QJixaTtTpM98rtcdyFCecmfELtoqdx9qmJ4d3Cn Wpo8Zfth0EElxlDfWMpTqDJD6h2d2p2Z/MvkLxve0QsVGqva4CwWkicSMaV5TpJXl8 BS4uFSpfm9ZuQ== 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 4TbHvP59RfzZKm; Thu, 15 Feb 2024 09:46:41 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org Subject: [PATCH v6 7/9] dax: Check for data cache aliasing at runtime Date: Thu, 15 Feb 2024 09:46:31 -0500 Message-Id: <20240215144633.96437-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> References: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A547914000A X-Stat-Signature: k63qu7qbt4eb1xbook4paswshodpd1tk X-HE-Tag: 1708008402-910630 X-HE-Meta: U2FsdGVkX19Wf2LdCCpJ0oluPXFhlWefueD7tXnhHJ23wa1Lq6uZ/u4/K5Kq9a4FMEkCEaGulXKxnq7lp3LJ04I3cT07Gl4y8tJX73LaJMmhl4sFufpIbzv8iLe1N2BDvFRrWeyMpucP3ygKrs2EMw8afYfzpa5ZJM9CZmCbwLqRRTuyvpkzAGswU7ITyYpWhNg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P67ZHNaVo+5HQJXik+XgrjREuMalLdloGO/odGOTj5JcGKN4FxwCAw+XsF55as+VMM3Qf8lCBQGmEv45iq6Il7o+bIcIkOLiXRnBvscW5YTQr1GXbktoyynlBDWMkUpPLa4wwsmg0aMO6njwqmU6/QsI++8uMJMm/VB7McGPVMrXpBCVANoK8gjBpRoOew1OPzg2bsE6NF8QBU4Z92/mml2d5pVpldkdQ9I2zaWryg9RgegyDLckGgTNVO9RCNeWNi/fQwwRbuOsPTk6a6V/+v8bJRXpdQnlLmf5WZ5TOa8+0DfmW 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: Replace the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) By a runtime check within alloc_dax(). This runtime check returns ERR_PTR(-EOPNOTSUPP) if the @ops parameter is non-NULL (which means the kernel is using an aliased mapping) on an architecture which has data cache aliasing. Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for CONFIG_DAX=n for consistency. This is done in preparation for using cpu_dcache_is_aliasing() in a following change which will properly support architectures which detect data cache aliasing at runtime. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams Cc: Andrew Morton Cc: Linus Torvalds Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: Arnd Bergmann Cc: Russell King Cc: linux-arch@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-xfs@vger.kernel.org Cc: dm-devel@lists.linux.dev Cc: nvdimm@lists.linux.dev --- drivers/dax/super.c | 10 ++++++++++ fs/Kconfig | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 205b888d45bf..ce5bffa86bba 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -450,6 +450,16 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) dev_t devt; int minor; + /* + * Unavailable on architectures with virtually aliased data caches, + * except for device-dax (NULL operations pointer), which does + * not use aliased mappings from the kernel. + */ + if (ops && (IS_ENABLED(CONFIG_ARM) || + IS_ENABLED(CONFIG_MIPS) || + IS_ENABLED(CONFIG_SPARC))) + return ERR_PTR(-EOPNOTSUPP); + if (WARN_ON_ONCE(ops && !ops->zero_page_range)) return ERR_PTR(-EINVAL); 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