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: 193703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp833331dyb; Mon, 29 Jan 2024 13:09:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6acoGrmyxIPHv+Yb9WHGn+YOhf1Ye9A+9nwsu+6S7X5o1GQRJcS9iWJIXMkbRoIRYJsuw X-Received: by 2002:a05:6870:c1d5:b0:218:5600:e72c with SMTP id i21-20020a056870c1d500b002185600e72cmr8046532oad.37.1706562545634; Mon, 29 Jan 2024 13:09:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706562545; cv=pass; d=google.com; s=arc-20160816; b=aVaa6dpe+3LIUeMRc4HGMnb890ZxY1Fj/qFwtc8TsniAe7R6l3Lc2U8MB3KAd3CWaq rjEOV+yvjqc4ZdWeMJPgE46ga15Of6jttdQQ1LOD5C12wyyIR+Fq6Tft31CAoA83CjLE QjOg3H5rWYMDX6jtbbc9eRTxxbbtSz0Rx5C63Qw316VuzgBsDp4Ivxu8NoDYYvZ+UmUS V1I2ONmJRmSDKm7+uwwSExmxo0NHjYiy3QYQHe9q7xonvdKP4gdbtfunnrCZ7erVxDSq BcgV4RNUHnLZmwcxlvXCJoFU/PWeFeJkzCt+qlZxCbWjQfmsutBzfGDHwhLUHq+Ubf5A W4bw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4Ra1m/Cllt9w2XTndfbRVxnB7YwnV+8/KylZWJDugxc=; fh=8x7FAtGFsjjyzuDK9cd3KLedEU3LajSQhypS2WyX3vg=; b=Dk5eKAJ++DVHCyPoUzwGnhZbTi9ivXPs3ysIf2yROvDolJzSKZWOv0e5ZaMWmOrB09 yQ60P80BHMFFQThJdZvGbDENvj2zebVnBgFZiYLWi07wIT6yfaAB+n7B6VLsa3V6oP05 D4iAyQOz4nBx5uKH8Z7C1ky0dQ9KT/lzScY0WfPHaKa+rJeyT+tBr+7dHHQUCMQSMv1Y rGGNaO+OcRBaq2DbTw7Dw9hY2zZa5hIEU/l4A/QvBCsMD1FWsGAWVLPyKqp8dms8/59b 7FD2SB3wmF3R1j7YUdX4kgKyQoR/efsnvgWssSa3CZOZT0nCuZEyW877T/hucMpaqBuo ycaw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=IBO1D6SV; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-43502-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43502-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y13-20020a65528d000000b005d8e1b8084dsi162385pgp.439.2024.01.29.13.09.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:09:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43502-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=IBO1D6SV; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-43502-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43502-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D5F62894EB for ; Mon, 29 Jan 2024 21:08:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2984B15AABE; Mon, 29 Jan 2024 21:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="IBO1D6SV" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74262157E80; Mon, 29 Jan 2024 21:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706562413; cv=none; b=sSNL4giRwLd8q/W77LDWBby2S3s2iq2zNSewoVdOnzJubGljOqqxVPjBGBu6miS64bARHnxCgJqoCATlrIOUhaLzXzBJ6rzbkt89G8VNnqrkYCM+eoctJZdTrKLTYsDvAHi5F6ELZomF1fxawVZujSdYZinpFgZhlW+TqMLh7Uc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706562413; c=relaxed/simple; bh=DRZ2yg+8WAlTHni5bhZssW4ALgjBmA8zDamvFNbz2wc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gewSgYFumfvow9DqF19HeIBpkxC0ApPG+nsSN4UlIW+oKVv7C9JyeGhEXyEqCk0EBsl7IopucSZvajoA2Ol+vRwmci6GWbND81b5KgIdqGjZ9t9Nwp8U4sp5JpvgmcYCtueEIOTAlPGYoTiXF3vXcme5l8+WS5NwNZ8A8OlMFZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=IBO1D6SV; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789460527526464222 X-GMAIL-MSGID: 1789460527526464222 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);