From patchwork Wed Jan 31 16:25:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 194837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2005707dyb; Wed, 31 Jan 2024 08:28:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAMmpwfo7gYqf6djhhCQ2Ck112nWameXEbhokPr5jNKw3nIDX2Kwqxm1RZ6D7KmFVg24i2 X-Received: by 2002:a17:90b:295:b0:295:da83:4820 with SMTP id az21-20020a17090b029500b00295da834820mr2782548pjb.45.1706718489014; Wed, 31 Jan 2024 08:28:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706718489; cv=pass; d=google.com; s=arc-20160816; b=vcCzP+/L28biJkKPxzu//H8nm3APlKV8D3MSq8KfGiiMMrm4eouAKyhZZeQqOhrVYv ixJEUuBSZ/4NimiRdTJ4ofeSu9hnw22CuAxINBlymumEZuX35mlLfrAlzrnxhoqvnmm3 pFGbHQGVJfTzCVEoACOpt/zXoJZ+85Jwaa0gkmWCCSvE4hbfhvNAQCDCElp9C89Fkjab VjgpZdCSNUS8Wt63FozIcrr5HyP8myyxGOkMm3rIf13860SrKVAC+UyZ54l7N9jWffEp lxOPCMnpWl2LDrQAJBNBLgKBTUPBeKwCktPC4rkmSGJhw+Z7lGVXjHPvVhpOcZiXzIb+ 5BQA== 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=9FkgFod/IS4HkUrFEP6tB6rUBCIOXIehNKoOY5Spu6U=; fh=Pa9Elgd6zBKfefVlFAzFkWiJLpl89wEF3EtFUAAmKH0=; b=vWifEBk4A+vaC3HpmqvM8LpDhwM32C/NjqD9KrvJSU0HLeOcco9HAjEaVmVyTAWQvo LK4Chia0FndM5kHqlou60MGRhoSkgnz/9sPQDxOHadobOl7SdNTjjCzCVx+To1SU+JI7 XsJQIhaqeJkFUDByi3Sx/1CtDIfBwWGJHPn/zBMJ8zcOVhmtK1oSDBLx1pxccz1DiII7 ZoDQmXfGsZQDKFnT1n9Iam8mbJZK7xWcC+K77zpuSFLMfjojq9yqh+pSIV6b91+YKa/Y LSYXg9eTuDjX5aTp6U0+ewtpQiw4yMstALBkawrwkpjg+UJdnN2ScbyCy+HiQvGCwgi3 jIog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=HA2Zt+xx; 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-46783-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46783-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCU/usNApWT6+lpVbEZirDF4RnUuoXWSlpEqSx/d/UPtQxJX0Dk6/UGtf4kpuDrsNJJkxLlkojJmjUzr+esW9AoJ84bq1w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c19-20020a17090abf1300b002902c320c80si1554742pjs.96.2024.01.31.08.28.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:28:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46783-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=HA2Zt+xx; 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-46783-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46783-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 0A21C2857B7 for ; Wed, 31 Jan 2024 16:27:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC65512DDB3; Wed, 31 Jan 2024 16:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="HA2Zt+xx" 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 897E312BE9D; Wed, 31 Jan 2024 16:25:50 +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=1706718352; cv=none; b=V0C4vzYYDvTcysYeIH+t4j+GElvPSilRboIKrlapuMkcOKdOFa2eWxBt1RgsIj1cnLKS1F9DgtWrmTCwhnvePz2mtnGsvkj8Z1JIlYGjC/unPKicKeseS63u9DDaKjjePkInN36UMsfhPt2b28TH12itQtzRcur5ug4XPCcBsik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706718352; c=relaxed/simple; bh=eX0TXo9pcQzgnT4JpiJ1uz+KvY1x3UAQjUEMAJVLHgE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p7wK+DcVP7CkWGWEBI3hBtwHsbaYLW/8n/E8wsVehJ3B0czv+slQ+9N8/SUE5sVRiBD0Lsj6Mq0P+dmAwSPcDrNS/DlwxnNbDOAK5I6PiZmdS95P/lmnDDsa0CKqmvJrHSXrxseRDdzMGH8F/FOUUPQpuJOxgEhQ9T/r+DotJgs= 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=HA2Zt+xx; 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=1706718349; bh=eX0TXo9pcQzgnT4JpiJ1uz+KvY1x3UAQjUEMAJVLHgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HA2Zt+xxhsvOb4O2UchDtcajfJ8ji+gNYMyIjAGZ5EQWJYleafh08/eminp77aE82 yajKp/NCmwT9QgTnvK/lTjgc7JIeNPSy8OUEcPFCHvxToJXJOl1x+D89IDEw3SnePY HGYVNr8qWrGj0nxbnfdG/h4ky03ZNKXxoNWxV0+YPw/t1zr8gq/bQQlqqJb50gIUWj lAj2UWcRkVhbWaTg+78o35p3+S3Ghr9Cg2Ii6UU64XHEvV7/avptbzfMDDiPYGDOD+ vFw7mg9tqqdM9u0smvoSSRwh4/CSG1XgucTAvwWj3hKokxfqG7+Q+wSjDRNZ6qGj4w HNu4r51PyvvHw== 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 4TQ6pj2GjXzVp1; Wed, 31 Jan 2024 11:25:49 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Arnd Bergmann , Dave Chinner Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Vishal Verma , Dave Jiang , Matthew Wilcox , Russell King , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@lists.linux.dev Subject: [RFC PATCH v3 4/4] dax: Fix incorrect list of data cache aliasing architectures Date: Wed, 31 Jan 2024 11:25:33 -0500 Message-Id: <20240131162533.247710-5-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131162533.247710-1-mathieu.desnoyers@efficios.com> References: <20240131162533.247710-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: 1789624046097899478 X-GMAIL-MSGID: 1789624046097899478 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 v5.13 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 (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: 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 Cc: dm-devel@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 e9f397b8a5a3..8c3a6e8e6334 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "dax-private.h" /** @@ -446,9 +447,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops) int minor; /* Unavailable on architectures with virtually aliased data caches. */ - if (IS_ENABLED(CONFIG_ARM) || - IS_ENABLED(CONFIG_MIPS) || - IS_ENABLED(CONFIG_SPARC)) + if (cpu_dcache_is_aliasing()) return NULL; if (WARN_ON_ONCE(ops && !ops->zero_page_range))