From patchwork Mon Feb 12 16:31:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13553526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76DADC4829C for ; Mon, 12 Feb 2024 16:31:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE1EA6B008A; Mon, 12 Feb 2024 11:31:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B6A716B0093; Mon, 12 Feb 2024 11:31:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99D096B0095; Mon, 12 Feb 2024 11:31:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 64E026B0093 for ; Mon, 12 Feb 2024 11:31:09 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3619D160ADF for ; Mon, 12 Feb 2024 16:31:09 +0000 (UTC) X-FDA: 81783691458.16.D073B50 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf04.hostedemail.com (Postfix) with ESMTP id 7181040024 for ; Mon, 12 Feb 2024 16:31:07 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=LZvaBdNs; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf04.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707755467; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UPDJkdwf3N1VcCYbcUnUgFJY3X3oR+UFxWlZudqMVIo=; b=lehfEnoRuiC4gSS4E+Ev/kEKFN4iJGWdQnsB/6oH01tbGxTksqwk9MT0pICFlazTBIb/em sWRKLI6AEJZ+im3SoW3m12Qo5nbm4cJK2XmpDX+l7/ljUlvb7PF8+t8yKmAsDADVk8amtm Xdu7+MORrHVU7LPWaOb/UxpMf8/Mb+k= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=LZvaBdNs; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf04.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707755467; a=rsa-sha256; cv=none; b=Gw2HdFavTGREDEcfMtRXdhOcp1a5ifUWZRqOF0cVJ7+YOtYtrhu8fKsXrw/EehQJeG8tL4 UBTBwLse5qtoPmXvzUX814q7B5pU0+fkbW8KIbtLOO+O2fvjwRipSg9QaKGj1k5l4q5h8b q340VISBULt+IOwfaiSnq9vDAfYcKWY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1707755466; bh=5LHEXykJS2jSVE2sCzHC5a4cdCFsRj5a/HPr77qf3tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZvaBdNsLGQIy+aXABay82sJ+rFu8g6aaxGiW9uZpN66wS+NuUa7/G4W8gITWGkpa c1867KsbQxo2upSD+YIPCfUlDoy+ZG15o0o8gSLcOMEAKGWPn4/raakjLJgZ3QmgQl dI/PQmPe4eKxi8t0eZ/GmWxeVm048ci7sExiS4Ecjb68SKCeD0b3y7maiMIye3wJ45 DGGcrFkvDB/kNDA8WnFjK3mwIrvjK66KtDZL/O72RsTS0jcPJStuMuyH5yBjbq3tTG J7m2qben0XtmlSJAe4Yq0LSiYgiDICl058dbEz5NMMLhFPozAslNYp17M9pnVILYBE OPYVUdNaYbjGA== 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 4TYVMG3My8zYFZ; Mon, 12 Feb 2024 11:31:06 -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 v5 8/8] dax: Fix incorrect list of data cache aliasing architectures Date: Mon, 12 Feb 2024 11:31:01 -0500 Message-Id: <20240212163101.19614-9-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212163101.19614-1-mathieu.desnoyers@efficios.com> References: <20240212163101.19614-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: b4on6nzemwt8d1kx53hjnzw1f13imxya X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7181040024 X-HE-Tag: 1707755467-685142 X-HE-Meta: U2FsdGVkX1+XxnH+QZ6awkgklZAKavAMSx2msFjWUW/MF/eF6tTryazEzUS5xOrSC27RwdzpuS4+E1xVWRwmOwnwh/3I181q1kkErY7Ggc4dedKCS4sh5RMMDMXbslpUx8wSQU8qCSpNa4ZF7pA951LmF8kiEADnwynWvwj+GiPAQZffTKoBZETc+QJOLeQ1qIy8wXHJnFN+Hmc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xCxdY9gqKTg09x7eJzT2xfCKsfHBnH/4tRBglm/N29AWDYPPfigW/W9APrxjUHs8z2M+Kq4zHWKCR66RDFBKUwEo3RPxWtQ2S/0COIOGpvabZW0bKaMcKrADxHMGY+Yk+VySgWlw5mF5dcDYc8YwIdCpwWLsbVnEdLORSFOZ4uThy18/geSkZO7GPj34FBv1wSYpUw7bnhRHtxNbZxj23i4EBSZmUcOszdj53Jo1Xk7VOJmZ4/pAu/iZAnawRkPQdNq9up9LHJYjr0VY/nLHVIg+3+gsyJi8B1HWLwc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 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 | 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))