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: 194242 Return-Path: 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 (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 ; 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 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> 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: 1789535190750235774 X-GMAIL-MSGID: 1789535190750235774 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: 194251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1373341dyb; Tue, 30 Jan 2024 09:18:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHFHwCyrrnk7xm1G7LNlHzrY8LmCC7rOFw0IaMHFG68u3t50EZJJhPbOWCRlV4Z2rFxVtHT X-Received: by 2002:a17:90a:8981:b0:28c:f504:12a with SMTP id v1-20020a17090a898100b0028cf504012amr5939705pjn.24.1706635136932; Tue, 30 Jan 2024 09:18:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706635136; cv=pass; d=google.com; s=arc-20160816; b=FB6BOcP56Y6gIY1WDwsiFt7zoYI6w1SDYbvdvE5Uiyguj0TBXTP4/wKGr6uvm0XKiM bo9KYnE+juxlulG8xI26TPyJxiUeSfEzO6DKHHHw55YBBn4P1thL8w1npnv7ifbZbq0F 4J9P3J4iqVFVfE3N9YKarU0ppQP88fWNyshQD7TsPo8+Q3UcVoMe5lchZPSiFR/kujPh uvQq3EQOM3IJUnQI1iLue3GdA+MoyhC8iN8/fAFPjrvL7PifXWTeHCnTOgSFoDWozhV/ 5TLZXcqn/do3BIFBQYvTzFSvVQ/k+u7olbM3eAvPbibj+gPTxAGQern4y2ZZ7DHVdfH+ 6j3g== 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=XkDGYWTI60Abcy5+ZI1sU6Hpo9MTJxKHGwT6DDETt4w=; fh=NpknN67sf7tHiBkZ3Z4MhiVna3u/Db498jxHdbu6tRo=; b=ALAxS9nGxjs6yKeHy+cxABartvJBgUvETyXhzjT9SKGhsMd3VfJgxTlkKfOv7ki9rE tit9U3YJFqgqzY0fHETKvTzFEsjz61inrKibc0OZorRtBpnBNop6T03Z3dj/S3qDBvTx 4yfpVY82qO0g8WfmvNmMxaTalbiznFGPYCAphSbOmOgwt0ph9YcyioD6sgTQ7NaJr8SE i90vbNITKBrXiCK2gYwwgGgrskciV8rMbZOB19icmmcaQbl22R5LM2mxBfWalLh7xqLU IDMqyEBhi6gE2wOg/6P8BTOd+XBbcKlmdPgl84X33oMk0jHIj1ZMaY7L6M61SLqSknCs uR9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=vUW+mrCc; 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-44992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44992-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id g8-20020a17090a7d0800b0028dbaadaa3esi9560647pjl.9.2024.01.30.09.18.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:18:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=vUW+mrCc; 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-44992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44992-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 43EEBB285D4 for ; Tue, 30 Jan 2024 16:54:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10C6D12F587; Tue, 30 Jan 2024 16:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="vUW+mrCc" 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 AB8F21272C7; 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=1706633592; cv=none; b=SuDLunFaX+NcspfMzHj70hLHKjaAZ/j4HFEH1e7Zfy+2BZCpOUi5FGkTzj0P1UNObAoRggoIAWhjaVxZ2i5Vt3F+cuEh/Rl4GfpaypkjuA2SE66vTM2a1yW7F8tc6A5YaLWtUZzSOzBCu84r6tLy4X3v7vu/Ry0gplPGkCjIsbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633592; c=relaxed/simple; bh=0PS85pgqYkHDjLA73cFZbQVUmxCMDRqh5f6aZ/uoEXk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e8QvaRPzmS/TdA2NcNrF2do3jshUfyRekMUMZOukyX/34TRHDEK48Uehvp7xIUNw6g9GvHV2BdNGSa2r+T22pfuDrglcLgclSxBWBp6uywQUAih020O51mFVRsBNM10ZLx7MGRdb2PJd/LVcXYHwCLPQ0mIJ+610PwgGf23CRvE= 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=vUW+mrCc; 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=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> 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: 1789536645125927584 X-GMAIL-MSGID: 1789536645125927584 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: 194243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1356506dyb; Tue, 30 Jan 2024 08:56:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcfG72Aq9fFadq8embJZG9DyoQOJEdj2vTrPit3usaZW4Tvbbl9lKZ/oPAaiSjmxghI3Mf X-Received: by 2002:a05:6a00:1ac7:b0:6dd:e2b9:d4a with SMTP id f7-20020a056a001ac700b006dde2b90d4amr2233477pfv.26.1706633767256; Tue, 30 Jan 2024 08:56:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706633767; cv=pass; d=google.com; s=arc-20160816; b=Q3ltCqcAiSzBcFlCOv9AvQh3yXwGzbqc4cpPUpquEDmPXgoNd45wjjLRH8Cr+5iwf+ JczFO7sO+lVOXK79mj23aBrT+DCnNUmVogwBIVRHq5gfFWcwY97mc6eW6w6nBMtgRsuT tLSNz1G7Y8IzqXyynl6g4THcYsTW3sJgwhI/fSoqgsYmfNXlBwkZ+OI4GexXyWUFsSgA BK7p3dsuiExebu5Q6UJLtv2wsJ9XguhcKTTHCfAHJNMvmiK0HP+92ykXRwAyaTb0ziFl 2wdemf8IsLlsvh8MPam8J6bmiEqy2xrFmLckwTaVlulEutJMD+EDKoZf5RggVsfj5kFR HbYA== 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=/Ywp2OzIEO3UrKlV5UlZxaaKEM3XQLGE456Lr/j78Ws=; fh=lDTZ44s5QROZ2gXaPhKhNTP82LKxPjb7KuveKc1awkc=; b=uqhiqK04jzKXF31hP/ZLTMa1YMcAN+ijk3omCsY4cE2EHbiaNBMqYl3BEazXqPW6qo KBFdY0uaeNgVcxtc1KLfe+VM/abTCuf6l1U6+b4ax6F45aopo1FQvmWaq5r/OA+7pwOA 94xzT08t9iVwNE2/CYczvLEg9MNGONEbjZfBSsm4qn8CJRKapeyIuxrbsTGb2lZLf370 JOqKerFxG6Nj650mJpAmy5WRYySK56/K2ovaX4Uwdsa7NkD4tZnf++Yse41ppQ5vfsfV eNYpicgUBVjAdYVukcx7+kjkjyPRtXDoazS22FbnPRhEEsNRZw9FcZRoa9KgQlGBi83b BZuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=Wcnaeton; 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-44993-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44993-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 a10-20020aa78e8a000000b006dde3ecae1bsi7747838pfr.292.2024.01.30.08.56.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44993-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=Wcnaeton; 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-44993-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44993-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 6B3AB28D900 for ; Tue, 30 Jan 2024 16:54:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1724F12F589; Tue, 30 Jan 2024 16:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="Wcnaeton" 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 AB8B41272C4; 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=1706633592; cv=none; b=RNhhTa20+alBOi43RAV+PMUzm2rZs0arc8rssEg5Jp6//3J0m4tjI5yrMuFd10Y49uUYyi3ws9AVWGbqLLR+PIbfmVPU8fyC4ioAl47AceyBsOTAhhg8VWg6IA6z5tWSaYW13niSxmbKgQ7F8NYqG0zBEK7XYl+Hd+OAkUN3afY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633592; c=relaxed/simple; bh=uiS0GJbwiYIsdO+sIgYuUHJda29PtI1SD0eG+t25LF0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KGFadOUJgFCxyTEan/uaItEoMrE9UWSbg2Ekkg1RES7iLfwrtxj6chTury+AtPaLuW4V8N/gqbutHLIPS5h6aaAFxqrCgZmfyAplII2GoHCl2vRSFE9lBiQ74Pbmn9jwq3+PqqFP6UZ7gQqK5UPBgPTdr/Gcdlyrs+hfr7z99PU= 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=Wcnaeton; 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=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> 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: 1789535209282953895 X-GMAIL-MSGID: 1789535209282953895 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: 194244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1356510dyb; Tue, 30 Jan 2024 08:56:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJ/PWNXyq1zVcya81iFdFCbHlRH/9mWY7q2UK4kso6eFq4pf2Ho3zwc/blU8SbiJBMxLaE X-Received: by 2002:a05:6a20:e48a:b0:19c:8cec:25de with SMTP id ni10-20020a056a20e48a00b0019c8cec25demr1699224pzb.12.1706633767802; Tue, 30 Jan 2024 08:56:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706633767; cv=pass; d=google.com; s=arc-20160816; b=0HYogdpUTKDtB3Vm+4aH09cLvku/mypaMiHH6HYKOsTuE1XNdIwdTXDky5avn3Y7bT +D9Ofp+Pcwq5xHPgtjBrXMArzQQamm9v4dVP7u6St7RZUm2c2ilNm4yq0b+R9MSZt3rj PmooAJtY6xGmIzxAuPmms6ksjUvTCi/1FPiOXnkqqjF5dj0QeYcbfooEIfl5IRyN7D4F 5sFiifDPFqodYUqYKyXnS6xvl3BwkmTfiWZV0JmTZVFp3tHcVgcUws5O82pJBeB2ra4W kjWrHpfbtdeba+48h2j61UvfW6vJ7DKbazMu235gtXAS5XT2/22LEqS3vX8RWWY6VT7e lBLA== 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=tk/vyFkTLiQku0ad9N/cHEV2e4n++1obKWF1GV2oX+Y=; fh=LNF8sY1sE0MMHV6fh8DO/7oGqxXgSP5eR1Zz8OrJl5w=; b=Q3deNJw3BRBIBjS0hcyDKE7JzNAX4S7SGvJB/3LAxKR6Jthdc2idTTJgwO5K57rcIJ 2TrYk2RRlBi9zqv13//4LFBOAMjRQx7INAWC2OKzZjzLBrBw68BIT/4nENOTuU9oZ/DA ZeEgG7AogzvsnFaBFfI5pDCYUexiVPgTLCmcqoQn4QrcKmLjHybYr5AVWc76d4hmU04q obASKWs/FrXlI4wWsUgGxd2XPS6C+bZTe0Oq4Vnnd5yjhWiGDg2cnjfsohwt53mli8jA yjL/JYVf7G5xMlEDOdCAMoF7/1XILQjlM1aHy7+2XA26PIirOKMk2ZK1wjM/UKvRrl8B YNSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=tq2gAYC6; 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-44994-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44994-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 b4-20020a056a000a8400b006ddc80e5366si7788888pfl.86.2024.01.30.08.56.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44994-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=tq2gAYC6; 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-44994-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44994-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 E3FFD28D905 for ; Tue, 30 Jan 2024 16:54:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1753F12F58A; Tue, 30 Jan 2024 16:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="tq2gAYC6" 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 C8E8D128367; Tue, 30 Jan 2024 16:53:10 +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=1706633592; cv=none; b=CKb6Szn3CB95sG3syAXpmMrQiLSOpx2hDJMFQPwXFJg2ADby8lSAC6oBHyAlYWl1eyC2+26cphR2CVzDfZuQMXfaM4fkkpvyQOi0HAe15XFncgQSwy+AzfXPoqSfAuK1nr5FFdSRO71VTtsIOwterHI+WSm0J9PX4r7kgvOJffQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633592; c=relaxed/simple; bh=x2kfVQnd3mtJ56l0EVkgCvgLcCn8XobB6WTDFgooC9w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uuTqgZ0tenKUzIdHLnLucSlu9UY0rBV07llA1r0WnAOutS1qGIfJvKUA27Beh8xKmmMiQ8nA6W70sKoAUBxFiStOWByj2sIzCmDvxPFVq8OnEPdUKkVKAND3kE27HV+zedOmGbPqodLf+LcJUldTlsNTE1M7tdzWQKx7qQCZQ6M= 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=tq2gAYC6; 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=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> 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: 1789535209473191461 X-GMAIL-MSGID: 1789535209473191461 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: 194245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1356856dyb; Tue, 30 Jan 2024 08:56:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcYxxH4lta5Fe3W7pPkfKrYE0tZd4FHHUrNGfldog651z2RFMrAhww4zKlbD4K8IIEr57M X-Received: by 2002:a17:90a:6506:b0:28e:2784:9827 with SMTP id i6-20020a17090a650600b0028e27849827mr6151186pjj.17.1706633802894; Tue, 30 Jan 2024 08:56:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706633802; cv=pass; d=google.com; s=arc-20160816; b=O4oVlpRTwFw3QqLQfffNZnQLZhZqbz5O1Ad7Ml2sxdaUtSDSSyJElwBT3QnRJDPPT+ A6mBFdLvcKSRDWeyqa0Y9yXAdjsy6eGGTUeOWSc0csF6IR7UsKggZe11zLNeelwgNVBS PmMGkGSsOpqPUxwfLgJAZ2ES086ZXIFe/3P4Wjhg0vJaeZSQpEF0hJmwzBoWSLt1gF+3 0MPWKPKwGFmQ2QNaBClnCvSXIfXgurhRrVlcVpi1NEh85uVMxlzQe/iflraBb/Wygf66 PM21IZnU2RAbQ3W5AdUazv6Z2V1nlN8YYiNu3RsdK/GqO7RYmJTS1IRhrvddXMEhAPQd yYWQ== 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=C1HMlvGu42Plp5r2VyEDFqQXOtGIITlr8J2Fj+qB9Bo=; fh=92E6bQh0MDKP5TD6CMvcCDgHw2xKldJ78TdSFYHYFcA=; b=KOllp7TU2NOd5CBHxct9Z/LnjT4XD6AGH9USyCuw7L9RENZaopuyLRkuDsZfhSXw2Y /KCc3tMVzsPIB6lGNBIuVM7eXNSvFOrk0j0dPL6HMQTMBhq2re+nHqSf2k5iIPCafSpt 6jH6r/G876pig3jqJbVMBrN2kdrDuA1ooyMMENBnlNenR/90N8o43VWj4Zv6HkFSyoqk soFErp5DJ0czuKq3IZII11Lyxkpxq5wQFE+F9H5AUEOk3AUQPrOB4+SbpPGaELAbzcQb GPp97GsRLd07kFRFHLyiDJ4HDemUgJ6VR15+O4c953VtoZLs3DOJj4Kj9+/WtQruNhw8 LCJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=pqI8Vxqf; 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-44995-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44995-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 px16-20020a17090b271000b00295cd579756si415524pjb.26.2024.01.30.08.56.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:56:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44995-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=pqI8Vxqf; 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-44995-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44995-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 145E928D4D7 for ; Tue, 30 Jan 2024 16:55:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4B5E12FF95; Tue, 30 Jan 2024 16:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="pqI8Vxqf" 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 4BC75129A87; Tue, 30 Jan 2024 16:53:12 +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=1706633594; cv=none; b=X3IFE9rfaYiN+tYXQWl+mXr3/L6xZpmoqif7dkLP8RjBcjSm3apYV5088VgZ8sEyhk4kZfa1IsPQmvLK1PbchVuRxjzyG3tB/uo4+f6WGLV+jsc7SnTZcj+XtM5+L5Fdc7ZwRyaBS45y/h3WeltMSfMipx+jGpwQF5G0WdiiGmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633594; c=relaxed/simple; bh=TeqAlXONUU5nqUDfGe4PPPm1rluqnLU8fKx0/5MP6+4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Wmb1QKayYTQitkR5w9ma60QSUn6PenVGQdXlrZyDDtUy7+6qkLFWIG10HSpdglKBifOzgwTM4CbRJ9aAXKqOR9uJFwQAjiyYkB1ciYfGxl8TiIZJ8Q+pB/ssb1eEIrvq2NzoiEfkv4cKBZLIipx3CNFYIQu8+gJ5e61X7eusv/A= 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=pqI8Vxqf; 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=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> 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: 1789535246716001333 X-GMAIL-MSGID: 1789535246716001333 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: 194246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1360233dyb; Tue, 30 Jan 2024 09:01:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAXu2ejfiozmSg9JyoYKThAM04bpkqXEGKKeiTYpsaIFmQgETEG2waVo6FhlWnwguV9Flr X-Received: by 2002:a4a:de88:0:b0:599:d873:cbc2 with SMTP id v8-20020a4ade88000000b00599d873cbc2mr7905561oou.17.1706634097427; Tue, 30 Jan 2024 09:01:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706634097; cv=pass; d=google.com; s=arc-20160816; b=F1Q6Weqx40M3WoRM7MD5ZetWeinG7OZNznKIe+4VtSREREyEitBI8yXica2kI29vOd MY6C7ulWbpinlbZ7eZ5EO1CuLHlc90YJgxQpwA8MjAWi/P5ZzeGigWOGyPev+rr7rsaw KmfBpgGcfJzNSWGPmuIhdIoNvK39RWLtPj33NnzmGcP1nJVgaJveMAfD5iLrqiluWjYx 5nL3mSfnEXZUB5JyFmvReXJS45hRQimNToFbc+SyAyRSJtf9d3T69NyrMUaakAT6Xzgw 25dkHdmqqcbCfNIs81/WwFmU432MJezcjeSsfpzEgQerAC8WKJOw2NxDWXN5ipgiHXCv yKiA== 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=SUrs+a+seJwqRojpbljVvvOfD+UCI3GAhDJI94PFAUk=; fh=Cpy6WzS8ObYkMU0kAU/gb6LsOH9C4sxRhzUdpEzhw5w=; b=iKr0TSPyx+qBbdqP4C3C47TG1KAeUMSqs08nK7f1S6lsavagr22bB/DUMtKVrMiLSG 5Y/UhGHx1Q7LaKrAdIJxWIt6Ll7w88hdrgc5W3QfDr9Pg64H7WZB0CgXrDz2wbp/du/i T+q0xexnVNRxyxqrPUO9Qo1yB9KVlRWsO8sUDkunnBvBbeZlr0c/jHC45gafMl0Nj8di YAkRafPWCNPmJzLL8GF1cC+eZv3bh7b5qom2WGO2bcnjD8E1K7W0MiMUHC7b1Beht7kE pANIvT9/9PVGNvkGImjWFDi9PYGVvpI8bAJsee4noud9O8iCQmwa+/Qq2BwzVJN//0qa FfFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=bihVHjMT; 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-44996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44996-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 b72-20020a63344b000000b005d24e5ae4ebsi7575442pga.72.2024.01.30.09.01.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:01:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44996-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=bihVHjMT; 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-44996-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44996-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 603D7281ECB for ; Tue, 30 Jan 2024 17:01:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9689F12FF91; Tue, 30 Jan 2024 16:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="bihVHjMT" 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 4BCAB129A89; Tue, 30 Jan 2024 16:53:12 +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=1706633594; cv=none; b=GENgjf0gZPzjflJeYNtq+6X6GKszPhnstLI/ecsNKP4PpStlTpFSlAM7WIt0xj+DtcTvyDx+lVmwzg2M88WIb6pf7Y0EL47gtPtCMHDOpUgFjn3uRH+U5j45/Tmcvjf6sG51gPWzCPSeZZzT0fTKG7NY3CRJ+WGV/ZafyC4+cys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633594; c=relaxed/simple; bh=4g9gvr2zRDJKqqYI0mUySJAzztyEKM8oIoATdWwyg7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eeVMBp3/dLJK6qv0ITDJrhLvyrEuxMyBKNIJaztUJIRlfT1v4q7CV8IQkirh4UABq0lliwhuy3Az+d0NV4uc69zHR/zawOVAFlhSITuJbLOvOL8Cp27nyalgotMpU66gbY+Rs1CVIDzNa5tfLQ9Rc7FPxd2vgmJoCv8Y1F093bQ= 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=bihVHjMT; 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=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> 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: 1789535555555987558 X-GMAIL-MSGID: 1789535555555987558 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: 194241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1356356dyb; Tue, 30 Jan 2024 08:55:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IG08Lq0TrL1cF2GNLN/KU00gLdSQUOeAj9ApIh3tn3xN7UTTzb2J0WuBwTE9ulzIbaP9I63 X-Received: by 2002:ad4:4eeb:0:b0:68c:6369:720c with SMTP id dv11-20020ad44eeb000000b0068c6369720cmr54218qvb.18.1706633746784; Tue, 30 Jan 2024 08:55:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706633746; cv=pass; d=google.com; s=arc-20160816; b=PKv+OsMQ8DIFS+SsWwt2ER+jLpHWpDfEDfvyYyeUEHv0hCRrgXcwDy2moem97RdgNz JBPjgJViwnRNoJ2C+w+OfJgwj9kA92uc+2xb6Qpp5qSskOFwRlCbrigYDNIz9uY4AELK DBH+Khi0poadte3ySFxXKAzdK2PLrKwVJclL5/e0aV9ESXRMIUFOsaH+S4nNoodaTjwT ZW/5SX8gMjFj7ab4S12bPoer2WdRTZfPrVf63DEWJzCDnYEl6YRG+INW6gxCumOyI49E /IHoSrcPzjZKOJU9AVUvIUY7vIlfBpEW6En75+eImgY1Y6+CvcFxRfwQoXNYhzqUaQTH KHCg== 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=YMy6IXOqkzLAf7JQHPGwuz4/H4cY7QsizTLKbbodfeQ=; fh=PiJju1vQ34PcjdISX3CTCMgN9xuaXKRYRd39MO7+kPU=; b=egf8rWB9RcRAMArN0zxw6KzDBr65djyhZ7Ydcf+BgnzdHwGguCoxg5ldv5sVIaRi7z pPMEaLa1dWpnHTl8HXe+PuQVqXMrhvC+1ojKtEC+DpcpyqgZ9lPz9r5b/nrQGkuLv2WS Ukt4dxKzXYZbdCUxTeJ20XnQ93RYnAuE+Uz8RZ5lBSPVP+KMEzmgHNrutpEOB+xe17/a T3pRLKElo05Z80dOm+hWfjhXqNMSH2rkthYDPx2XrWNb721d5lxl1C078Cd0Cwz5spEA i/NzBLiq49PapCW3LvWghW64Fh88nCcSyljDX/5OhsmLwzI6qLTJd2gjEjvYMA21St4u qWGg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=Eu9fnlqf; 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-44998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44998-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q12-20020a05621419ec00b0068c544d3545si3676561qvc.214.2024.01.30.08.55.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 08:55:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=Eu9fnlqf; 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-44998-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44998-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 61A1D1C24E87 for ; Tue, 30 Jan 2024 16:55:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD9A11350C0; Tue, 30 Jan 2024 16:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="Eu9fnlqf" 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 58C81129A95; Tue, 30 Jan 2024 16:53:12 +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=1706633595; cv=none; b=DP9SLfA2YTZUgA0EUiNvkTAzw9XH3l1/c47WXo6cEcYhEq1n/2xpbfp+qurKSRPfe/8ceAJ+wJGuHNEXrifr91q7v21b0WWXVFpnMw4WUxjFzljadXCCIHXhO9on60FfuXWKcH6RjSaPDkw53dV2XToLyLEpQepnC48/66tKpBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633595; c=relaxed/simple; bh=XuWaMxt4d/3dm7lB6U+HSFTUUg6+UTaS46cwYkLEDis=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=psaBN/T9WFMsrx03PpyEXK8ZjuCu6YHHqD8UyRgB7q3TQK8rCHysFTJTZUnpfImPYZvJQZI19JXs70oAJEz1Epgd7g/OGVMLlvvAAlvcbS74/ZMKXa2qyjI74W+Uvub6pC9THq5xKq99cVo2crdYlWiFHV8gosxTlwXG/+1/rFc= 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=Eu9fnlqf; 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=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> 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: 1789535187755113444 X-GMAIL-MSGID: 1789535187755113444 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: 194252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1373761dyb; Tue, 30 Jan 2024 09:19:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+04ZAFJ3uIjVzUm7uRqldF9aErIm1UzPtAzX7QaNLbnAAcqKEf6bNZK8ROHmXGTO5wZ9Y X-Received: by 2002:a17:90a:cb15:b0:295:b950:b7d9 with SMTP id z21-20020a17090acb1500b00295b950b7d9mr1377653pjt.0.1706635178747; Tue, 30 Jan 2024 09:19:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706635178; cv=pass; d=google.com; s=arc-20160816; b=dxOIzWC/RNTR9xWLhIOHYqnuoa+Cs8tjIPY5d/QZtJJmb/qx90f/5xCPrJgi/0Fuek z3lKvAi9iiSycVKKd0ldM+KDuetZfNHQoMnQ7lm4kd9kp1U9W1zPvHUvyS8yCNwvTSkc DFXC4LstT/wnPEmYp6e9Jj6dj1+ECzG2M9YjJM1JVCwIVKZDREC1QlxXqFOsf1CtMZpo B8A4dc6W844ztAIvs3SHSDjn4qOWqJIhizItV1T2SUQqLTJMukHLkSyTMRS4XBHFQC/8 EdP4IdWec9+9TR8QhTcbZBa5mt7MGVTA3njQCVxUbD1oLS+03zS8XutoQ1qc1ZVrx4xK sTzg== 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=jZU2ZbbgI/b/87AeHhjaYiSd5/oOGG+UvSS00fh9aPo=; fh=vbyj9zC2wTIZazVHAO0c0ywrUG9FLIS5Hx6RH0UNtjw=; b=Vjg1tFeVHG7WABU8kiGpZGlr9JCbLCUcIZ8ZiBxwj8lZnijmHyUao0rROowndEvCqt l8nMMnZGUMH3N93dtvCl684U+8vtNacj4C+NxwGgN/Iy0K5xTSi0hJAfR2DTa4AQ1N27 IXoAtfeaK+bNUaPk9DRZTlxJzIH8gSgODG0pGzAl4Zg0Nc8kA2rQoP4yoXZBPb3o8XpJ kvVdQ1e/MCxj298Mjucht6V22ouFvpTDUb9ep6rj62kKm2JWp8kwVRDxcG9OEm4Y3Tc6 eUwQEln/Sw+RA8W3ljic0SLO3JzYVQdvoe0YbhlSMV4tSmqgh4NacyhRepGdLTH2Wpb4 y6mg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BUhe710j; 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-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bi4-20020a170902bf0400b001d4e7ad3810si7666488plb.604.2024.01.30.09.19.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:19:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=BUhe710j; 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-44997-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44997-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B464B25F85 for ; Tue, 30 Jan 2024 16:55:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3F34130E31; Tue, 30 Jan 2024 16:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="BUhe710j" 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 58C48128393; Tue, 30 Jan 2024 16:53:12 +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=1706633594; cv=none; b=glboj2+TrvpJdo741wecK22Az9w0VJWuKdFlUjEtixV6pdbtqyORxCaTBB0XuJMXnq8jg+9yRdJUGx+pnLGnUqonAo27i8ilQZgK1jdUKGAVJvg5SOwNvo4eYviEGAXOq3ETyVbV2VOHjPdajXTLkV3ORhD8hvxqCvP5bambfBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706633594; c=relaxed/simple; bh=39364yK8Vve2TZEwvAasv/nldxj5QFqZMMVmBMwwiu0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PgMtrCt5obc0ZOIQs8C7oxjW9UiorCnGDnYsCqlrczT8ugQIh9jzqtcI0olCsmRJrYcyt1trvMKTJFLVcgfM0UM2Tkz5HVNw5HQNlAZkscjQepJPuel9yjC1zgJIyt8/baT/YmOZO/l+ayHoCBxWs+KIj8kOdwnsUMzsvnKZus0= 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=BUhe710j; 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=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> 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: 1789536689206013790 X-GMAIL-MSGID: 1789536689206013790 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)