Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2560718rdb; Mon, 12 Feb 2024 08:37:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNGBk2+fhEmk6AmvzQqVNWPh3kSz0L0D6NCUMemSnV0IAAi4qqfA959B/SwUMCLxiUpLJCMTVB3h/19Qoswpnv9qUFt/Vnl3zVQA3d8w== X-Google-Smtp-Source: AGHT+IFbtDGpzxtgu3+XphLn6qtAyaqSESjgCndEx/BaP6VEXWhuZ0mB14lQffHOMy7biNPWua6J X-Received: by 2002:a05:6808:4194:b0:3bf:d26c:2381 with SMTP id dj20-20020a056808419400b003bfd26c2381mr8569815oib.38.1707755875377; Mon, 12 Feb 2024 08:37:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755875; cv=pass; d=google.com; s=arc-20160816; b=rVmpw2oeP77et92h3HKHqi2fscKp3vOIgSzuUp1DFNq7WmFcTKdmNnCrkIb1WBYX+z SkWclohtU2yBCRt3RNdQpjFGXnMTsTzQWbXRfKg8Z5bCHx17qC+Wc0zn2LtBf/lytXCf wgAcDfnAMr7tCA4JzgeoU/BOMbT2wAG1T2bJxGTM9Ke2rVW6GrEYRSQSfVhUh346GMrF I3Ul18FCcvX73FzFZ4pDmA8EqLmzsFqaccN5cOk6LBaPR56/UBBw7Rat6+ATF6cvAtkI zmQYGpRPuZlK0Wj9BdO2R2QO6xQlthjQgMUylMl0+KIMZkxCRH2BX+kfXwg7Omc/nlU0 vS5g== 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=1UE5e/pZFgiaOolrOdwZ3TYC5H0pvTp6OY01q9Vf3gU=; b=O3bUsLwrWYXPGz5EDLNORlzcSGctQ6O09qe/PnSQF80ejdj8jqMv5CD0O37oczmOeO PdHGNiu+PCbk5kgb6V53kWA8OEBkDVJB1jHebKbXps8icL1HjX9AY9v6Pw8USdXQbR2g 3ygMeJD/2ia5fTObsw+9US4WP7pxv/9exTI6KfC7UuZr5FX4b92PdqTleCBbC5/5mU0P gC4hGeNE0D7LuRQY4tMrimxicxuadsBB/LmPq/RicmIBiJ4vN/ud40CTH3PDR+nqZWxJ ydk+3IKRhBwENphQqTIPJ4NWpZRr7pvBWcSUmW+FDqyZqKppDb//WeoEi1Ct3dOjHTdf PrWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=rLOcpJh7; 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-61983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=2; AJvYcCVrJi6wdvrHc5t7mvn11VdYnsgDnJzzoT95/czBNQwBLKI+grZIGqWWb7quHvrPto/8EkCZs8y0Z1Wf9jQk0fs96oO1z/UiRrg2Kt0w7w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a7-20020a05620a124700b0078715f3f27dsi573963qkl.154.2024.02.12.08.37.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:37:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61983-linux.lists.archive=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=rLOcpJh7; 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-61983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61983-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F08211C21CF3 for ; Mon, 12 Feb 2024 16:37:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33D9F4F214; Mon, 12 Feb 2024 16:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="rLOcpJh7" 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 DCC503EA8A; Mon, 12 Feb 2024 16:31:06 +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=1707755469; cv=none; b=P5IKhQPCaDKnwXyclFV9BwONCMSE+N6Dr9b7/k9KtbQB54+NwRtpm+BID0gt63VrCoRm3MPWlNOLAJNDD6f2YEsDxwGQ4c9U0f1h1R8GEI+b+J50GRyv2rZLIdu3lrGfh3mH5DZgY9BN/KSwJjCvqA2dd1ewCW/lQB7XcBMTQ+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755469; c=relaxed/simple; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iDxsNhskgT0u4faflIqO8rXQxhLL1EgC/UmGhzby8H++qwEfwlHGUheKClSn/VjhznP+6NPnXO+nOiD/cVfLig2QgSuv6UfrgKthBYBFUs4Jvk9OMRP5MFMr89avmCsBr6jnFM3YE+V/JJHnKlTEz4wWL7A5X4kUPBGpdCj9vEQ= 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=rLOcpJh7; 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=1707755465; bh=+A5CzyStXl3uuRu7VAvAaofgyGw3Ro+0xr6rIKIjCf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLOcpJh7qO/ASHL139V8+yktYx350C1jag4/LXONT+oeciyPsY0S50AUxfn3outtW Xh6+rxFJ7PCvp1YZlzt3BkSPCuy7Bzv7ejY4+/GHqRIOzksRYekJ9021rmJ4tVOjlT fMzOrfv/DbKctqYPZc8HVJvCJICQiPvWcN7e2vXwINCfGELVEiIyugZesxu+iW5Szf 3YEzUrTP618zRw7omUXvFIeRYFvR3G2ZHanEbH0zYyAJNulpT/DpzbMYujk6pIp2hA pbbw9eZ9T0ROi7H5Up3L3SfWUYNKb1H9Pv899QDt9fF+O4PCRiNUmfYQZfbwf2fEac DHgPxu75pgj5w== 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 4TYVMF4gNTzYCX; Mon, 12 Feb 2024 11:31:05 -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 6/8] dax: Check for data cache aliasing at runtime Date: Mon, 12 Feb 2024 11:30:59 -0500 Message-Id: <20240212163101.19614-7-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> 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