Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp502298rdb; Thu, 15 Feb 2024 06:49:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUCBlHPHNAb0McZr8E8EJHf2Nk8HX2GOPdMEdjRyZacL6T0tWtBB28EULajdugb8PTcCOzPmlEOATvgLRx8byip0jUv6YSUwotm6s7ofA== X-Google-Smtp-Source: AGHT+IFtk19rHgK3lvBzDAa4NJqLFDVrT8ZonZNZm3e2GqXAMaaJpiaBQOQTQSCbfw7feyUTDaZR X-Received: by 2002:a17:90a:17a9:b0:299:98e:8b88 with SMTP id q38-20020a17090a17a900b00299098e8b88mr1535799pja.19.1708008569723; Thu, 15 Feb 2024 06:49:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708008569; cv=pass; d=google.com; s=arc-20160816; b=FJhgJ5tt23p2wn2Nw4B+Rb5uNycBCrRE0afPgPKqQJvVWsdqLFXov2UpWHRWsVtRfz cCXODJf9P2iUR/Qqr0d6GNYaiDA2UKf+wV65CJyz64SM5PVqaUUISRopQX4YWEvB1gY8 7mNY0nJSz97Ovh2MuUIkZglnKudhCovYvi9FEmmVELn5a6q9ARn/57GuBiuyoMa2jSs0 +whFZRbWs4RaG7xvTF4HF3xHnUGp4ePGxh6XKq1z8Il4UbhLyMiLt+c7Ff9WWyS1wARp Z0QP3u6N7tAndmHAb13OM1MdzRxTWLRgWvmtFKH7shk29qTbIF0dBS/A45wrQUoQpmYj ex+g== 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=OG/CzkI43SfX6xCzBBAMjDKIpbYgr3KZ11AqPANjUKI=; fh=GNeA/QZ7zQFhInUXedGuirIufvqkBvsPFrVhzF77X9E=; b=UPFwha8vXRvz4g8MVsfLq7OVY1rfMb7GFF1/QZw2TqR88ysUcZoJSIt+ODqsE3ampj EHTMjX9vQ3ec1PqVAKSkqz5UO2IodFZX2oSrrSpTL2Etj87cjOj6eX2ptQpS8sh/ddyd 9Jf4pFP9GnYmVK3iPkUznVjYfZrrJyVPrxDjXLFT/DERjY5mG+WbUcQSnwhFe41JCEBG fqZANOjK8Ue4+n5TudGfGt+4zKwmwq/0xw5K3WYLRw/90XyvSyoybbhBGA2EDSHRJa16 Y19Hgsi5yO8LabKlv2j9Q9cctd5HWDnfnc2chW/AapcPsMJkb5AIluBiUSCAxUkqy62l yJkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=YtP1iOrG; 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-67102-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67102-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b9-20020a17090a100900b002965887f7b5si3083071pja.182.2024.02.15.06.49.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:49:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67102-linux.lists.archive=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=YtP1iOrG; 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-67102-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67102-linux.lists.archive=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 7109028B707 for ; Thu, 15 Feb 2024 14:49:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA3561350FE; Thu, 15 Feb 2024 14:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="YtP1iOrG" 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 4711B133285; Thu, 15 Feb 2024 14:46:43 +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=1708008405; cv=none; b=c5UKq5GocFYYNFKslQDaKwH3JHKQgtHsYJEa6RY466D2fkow2XOgssRwjj8KOPEnc1hx1vPG4pOoCiVDiC6hDnhh74PEMVrZ768Y4cfF6UxhBXUBm3V8Iv6tKFQTUi2fmrMh47V6QLxOjtb2wP7cJ/hzia9qA4o96mooizY9XWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708008405; c=relaxed/simple; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=u+jBCYiGrGRGReNoIxsMl4445FHlthHFUjnFJLAhspg1potzoXSuz3OQoaWgARMpZ2dlZ6/mtDNq38G+YBGPPJ3ae6G8ppdWGbjDN86VPZ/wfeRGOoVqM7VqcxYYS10Bqe8Z5jBDCZjFpkJbWtYoxtMxMPhbfP+o8gat8hSGxc0= 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=YtP1iOrG; 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=1708008401; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YtP1iOrGBZ2DFcfkMrFn0KrohYHueOZWWxnb1yMeBkD/1lvsW2xGteSYalPZKSM84 dPZuexmp1ywRE4ZTQOjFAgKyIAvz+xWNg3zjhDySnvi/5JJ+HqV6yNHbJnIgA2V+Cz LrEIdoTvdqClLxE1CDwMu7BvH4kU+HynYTL8FGvWqQVF+ZUtTFmBtps3Fll4hy5iYb VWfnhivvj+Lue04BRQYIzFUyJj/QJixaTtTpM98rtcdyFCecmfELtoqdx9qmJ4d3Cn Wpo8Zfth0EElxlDfWMpTqDJD6h2d2p2Z/MvkLxve0QsVGqva4CwWkicSMaV5TpJXl8 BS4uFSpfm9ZuQ== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TbHvP59RfzZKm; Thu, 15 Feb 2024 09:46:41 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-xfs@vger.kernel.org, dm-devel@lists.linux.dev, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org Subject: [PATCH v6 7/9] dax: Check for data cache aliasing at runtime Date: Thu, 15 Feb 2024 09:46:31 -0500 Message-Id: <20240215144633.96437-8-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> References: <20240215144633.96437-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Replace the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) By a runtime check within alloc_dax(). This runtime check returns ERR_PTR(-EOPNOTSUPP) if the @ops parameter is non-NULL (which means the kernel is using an aliased mapping) on an architecture which has data cache aliasing. Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for CONFIG_DAX=n for consistency. This is done in preparation for using cpu_dcache_is_aliasing() in a following change which will properly support architectures which detect data cache aliasing at runtime. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Reviewed-by: Dan Williams Cc: Andrew Morton Cc: Linus Torvalds Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: Arnd Bergmann Cc: Russell King Cc: linux-arch@vger.kernel.org Cc: linux-cxl@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-xfs@vger.kernel.org Cc: dm-devel@lists.linux.dev Cc: nvdimm@lists.linux.dev --- drivers/dax/super.c | 10 ++++++++++ fs/Kconfig | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 205b888d45bf..ce5bffa86bba 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -450,6 +450,16 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) dev_t devt; int minor; + /* + * Unavailable on architectures with virtually aliased data caches, + * except for device-dax (NULL operations pointer), which does + * not use aliased mappings from the kernel. + */ + if (ops && (IS_ENABLED(CONFIG_ARM) || + IS_ENABLED(CONFIG_MIPS) || + IS_ENABLED(CONFIG_SPARC))) + return ERR_PTR(-EOPNOTSUPP); + if (WARN_ON_ONCE(ops && !ops->zero_page_range)) return ERR_PTR(-EINVAL); diff --git a/fs/Kconfig b/fs/Kconfig index 42837617a55b..e5efdb3b276b 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -56,7 +56,6 @@ endif # BLOCK config FS_DAX bool "File system based Direct Access (DAX) support" depends on MMU - depends on !(ARM || MIPS || SPARC) depends on ZONE_DEVICE || FS_DAX_LIMITED select FS_IOMAP select DAX -- 2.39.2