Message ID | 20240130165255.212591-2-mathieu.desnoyers@efficios.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-44991-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1356378dyb; Tue, 30 Jan 2024 08:55:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQkqxTfUYomGMuKhIqvqreTWx9+dRVzESbUibksi/LQ6MOdo96iPVESnz/N1pv4dFPjJ68 X-Received: by 2002:a17:902:ed97:b0:1d8:d02f:a05a with SMTP id e23-20020a170902ed9700b001d8d02fa05amr5241684plj.34.1706633749766; Tue, 30 Jan 2024 08:55:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706633749; cv=pass; d=google.com; s=arc-20160816; b=qPRMTg30bpgO78gYzSReZ+H8fT7W2gEo8lG5MiQod+xVl5ZgchjpO1MRAlgsP/mTa0 Dq74NqXJzWJFEJ+eQqxwFubVjavUmJDHwt1fWRDxovba0HBe/M4E98c+iMwmJfq1qUEs YXQl2EUH0iCkrRYKrY9Tzmrpwz13G8ZZcqO3Tv9Ojbzc664Oqn8oOlE7ZKV5jxavF5n2 fe8bzAPbgprfWeko3PKtuHSTWgIOT1GYP13BA/9wCxhXeBmAGUKi5lATEUcxDAHNo/JO lJ/urcCBedMfc0MnVtskJuohO7D/pv4HqACPFDZxrtbPqiZWNnoVQEgcV3vDogDlnICX pt1A== 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=XsGwYVoIL2p17hZN8IAvz/FHhHmi8wuXgYvwpNE3TAw=; fh=vbyj9zC2wTIZazVHAO0c0ywrUG9FLIS5Hx6RH0UNtjw=; b=kuSykqWA0C+KLIyBRU8hv/llserfVLMVXGJc5Uky4Hdg+yDLMBSudU+8VsABx1/0VU dAWpNgYM8O5xa0yxqVSJeGQS3JIcRV4AEV2DEfKaja7VMOr9QMCqxi2UNNvnQi4zAvpg VE9IeKDYx/GH2itn+Y09xZgFTzG2gynhShlbZEGUsXGQSYVySCRmyeEDy5X7kgUy4MiT yWT1T1ELD6+C8/OeW6+MetgHZhSmuoSrhAhZqlIPiRtlkn34/G6Cmg1qWzwUxA7OlQ5S M38/X3a8q/DYfM9emTYg0fp0fZ5GZjA0xk5j/3BGx9xOT8IV7vG5LIe4DpEfA6tDV4HK 2E2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=vgbjUBoC; 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-44991-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44991-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j20-20020a170902759400b001d8f6ce9cb3si2430048pll.645.2024.01.30.08.55.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:55:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44991-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=vgbjUBoC; 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-44991-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44991-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 1FAE728CC80 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 16:54:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42BCC12DD98; Tue, 30 Jan 2024 16:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="vgbjUBoC" 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 AB80386AD3; Tue, 30 Jan 2024 16:53:09 +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=1706633591; cv=none; b=iRv4L8GOw5Al1iS1lp+1GdIfRYEsYTT6Xoj3H6aCpFr+WMitydX8E6qi9WdNUktYG8bfdGnxIhajRC5Y3OGKu1JkLRF4uvHmelwuJQ4AtO1zRTgQf/Dtb1YVTpN+n+9WCYZ+bm+aqVnrv2x7fbtQDaUS0kim7uRzmdV+3vMwrq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633591; c=relaxed/simple; bh=kONcCPsuyI5WQYSGBCSYy4QvFvi3USH7Uw/j5x6yQS4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pGAFNgESmrH8YzT2H/Mjw1bymqWi0Xx2e1pAyfplLByHB4mG78FPvzKwFmCpRE8jkuuN2LxYGoKun2LSOllR10/e1ezZGVYSewnBPvJ2lOLQDWxyaRhOegxZZpvKOTg7jQbVu98sqECRbsForC+ALshtzIyrkt68cPIisZvJw0c= 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=vgbjUBoC; 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=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 <mathieu.desnoyers@efficios.com> To: Dan Williams <dan.j.williams@intel.com>, Vishal Verma <vishal.l.verma@intel.com>, Dave Jiang <dave.jiang@intel.com> Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox <willy@infradead.org>, Arnd Bergmann <arnd@arndb.de>, Russell King <linux@armlinux.org.uk>, 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789535190750235774 X-GMAIL-MSGID: 1789535190750235774 |
Series |
Introduce dcache_is_aliasing() to fix DAX regression
|
|
Commit Message
Mathieu Desnoyers
Jan. 30, 2024, 4:52 p.m. UTC
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 <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-arch@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>
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(-)
Comments
On Tue, Jan 30, 2024 at 11:52:48AM -0500, Mathieu Desnoyers wrote: > 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 <mathieu.desnoyers@efficios.com> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Linus Torvalds <torvalds@linux-foundation.org> > Cc: linux-mm@kvack.org > Cc: linux-arch@vger.kernel.org > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Vishal Verma <vishal.l.verma@intel.com> > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Matthew Wilcox <willy@infradead.org> > Cc: Arnd Bergmann <arnd@arndb.de> > Cc: Russell King <linux@armlinux.org.uk> > 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); > +} Uh, ok. Now I see what dax_is_supported() does. I think this should be folded into fs_dax_get_by_bdev(), which currently returns NULL if CONFIG_FS_DAX=n and so should be cahnged to return NULL if any of these platform configs is enabled. Then I don't think you need to change a single line of filesystem code - they'll all just do what they do now if the block device doesn't support DAX.... -Dave.
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);