From patchwork Fri Feb 2 21:00:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 196033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp699811dyc; Fri, 2 Feb 2024 13:08:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhWFXPzPHIfpKhQXV7Dl7CYGTG6a3+7g+IqjMkSv9RZyvw5wxXPTqmYioaqVZJOXZvsjx1 X-Received: by 2002:a17:907:7804:b0:a36:5657:f442 with SMTP id la4-20020a170907780400b00a365657f442mr1864191ejc.10.1706908097661; Fri, 02 Feb 2024 13:08:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706908097; cv=pass; d=google.com; s=arc-20160816; b=pjud/A+Vsxq3Geqm4RYxZlzCOmmNyT5PdWTwIBXnrQHLhVv/vTIKOJFE1nSSPMQzY5 w3uYC2oTVuXM+N/a6SpPBUVqnxMmxV8Dm6zCu9m8CP9x97jIAfmRXrI86OJ+teSYrGtc 0RwxmOsDGNfE071+GavP4kivEybbLpCEOA0JAHN2hceK41wQzuZeJvlMNGluiAsPfhZ4 hYI58DfCbxKMhIuiy1NOFdPU2ICYfsKtlxvUDD1gSRBqIzsN9sY+6qvwM8TJdwUSux8N m5jM7HpfsdZA0YhEPRf7o2wZ9hLgtA9wMBWcwvbul0S99gBTm2S4iWOsyGEgycFdAw8v QUTw== 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=8wpHKT9Hi7IbUfkZ2WanEEBa5TZxfFZsQCKHq9VYM5A=; fh=sG2u3Pw9ibBQK81mqBDDeR/+I9VtpzkYbKW7sJNHy60=; b=WjCGCO7wdOx0qJkPy5qt/NbHnXpkw/9q65lOJLED9khavjbqM9KJBPjY9R7Q2jJkyV Hw9eWO3hrtzQhI3uzhf+ewyNxhNQIjzjddhu2vvQJy0MbfWpZsaaTETgeMdviQurPzG/ SKMbLw1x7rE/EwFpOPnbWC4KW3bG09pYW+lzKQ6VOV37Ea0UuFrCQ2EPw52nwzyYQ9gl ShbjHtkjVNZ8YhZsY5q9axhWTTtqasSaMn+4ZdFLXS11LMhQ7+iM8Tgf1BjX1ydzKPCF 1mjfupruEuRxBouAozlcYU4ZL4hbiepfa++S+2dSMSUzmB8qKGh+dRFluv2X6LC6fx/w 6LhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=pmLoboe0; 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-50585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50585-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCW63eycCnVkOK5YEuBNG/im5RNsCxgnx/cCpm6A6Mz5ccMQMi1mHxx4Gz6hNdqeN8pU6Azir9lEv9nAvDX/Jgcb3CNqxg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v13-20020a170906564d00b00a372ac5cee5si453920ejr.850.2024.02.02.13.08.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 13:08:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=pmLoboe0; 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-50585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50585-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 484011F2A16A for ; Fri, 2 Feb 2024 21:08:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7C1213B2A4; Fri, 2 Feb 2024 21:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="pmLoboe0" 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 7411B12C809; Fri, 2 Feb 2024 21:00:32 +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=1706907635; cv=none; b=bSw8vK0PRztuUNPtyKjmSVWwimSMqfJJOJUcX9s+81pcUCS6b2ayE3cBWYy6fKliiA8ajgrE2Et6ZwZWdlhmKN6bCqCbQqWji4k10Dyaffvun99OAQhjXzl1w8HUISE7Gzfrh9/gMCITCQNGOdmpmQxqCOCFJi1grnTk4AsesXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706907635; c=relaxed/simple; bh=MgteUY0CjaNYCNu4ZJjdjfbOYQwaLS6hDEa6C2rXhOI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BPPRk6+Tm9RfYA94V9YsiKwrxfqjHTpYQYChBm5JtJYekdUcMBvsG3gY3pBgEAoT9xYbPEu+beFLJieuSMPjQwp4z3PuFPpMcs1XApAiGv+/qsyi9e/HMW3WtQCvEqlJ/O8rEauurzmnia85n2JZXC337D3C1Hevl33oVuX8tDk= 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=pmLoboe0; 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=1706907630; bh=MgteUY0CjaNYCNu4ZJjdjfbOYQwaLS6hDEa6C2rXhOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmLoboe0biQmKhxDQSLFLxe9fj2PBsN9j380mMLjyT2JWK4NKO5DYgC1oKms1hE2X mfyhAqyK/4sWjvu2qrc9U3QSqaqdyPHsaoH3DXLzgSTf2MpcJhENZ7zYoOFFmnOuBS gq8dm7ShaBHLybdKCaEnCossjL+YsNN4tFqYabm5/ufcyshuoiCyl85YvJNrai7hcD g/MvYLbhc2C8SRDi3vXOv1e/GsbbwcSRytwt5wh6vd4lIvjdXNaK3Rv4NQtXV9mGyQ qRZcVkbjwe9zctNTJvb9TxZ3hp1mRdRztkjvgnCT6YZP+6xeRdYi1Vjd3i0T8hyz6s 5wJOddiVYFkFw== 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 4TRSpk0JNRzX4W; Fri, 2 Feb 2024 16:00:30 -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: [RFC PATCH v4 08/12] dax: Fix incorrect list of data cache aliasing architectures Date: Fri, 2 Feb 2024 16:00:15 -0500 Message-Id: <20240202210019.88022-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240202210019.88022-1-mathieu.desnoyers@efficios.com> References: <20240202210019.88022-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: 1789822865418059767 X-GMAIL-MSGID: 1789822865418059767 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 data cache. This is a regression introduced in the v4.0 Linux kernel where the dax mount option is removed for 32-bit ARMv7 boards which have no data cache aliasing, and therefore should work fine with FS_DAX. This was turned into the following check in alloc_dax() by a preparatory change: if (ops && (IS_ENABLED(CONFIG_ARM) || IS_ENABLED(CONFIG_MIPS) || IS_ENABLED(CONFIG_SPARC))) return NULL; Use cpu_dcache_is_aliasing() instead to figure out whether the environment has aliasing data caches. Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index ce5bffa86bba..a21a7c262382 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "dax-private.h" /** @@ -455,9 +456,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) * 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))) + if (ops && cpu_dcache_is_aliasing()) return ERR_PTR(-EOPNOTSUPP); if (WARN_ON_ONCE(ops && !ops->zero_page_range))