From patchwork Wed Jan 31 16:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 194838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2005781dyb; Wed, 31 Jan 2024 08:28:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHD4ffzBALdOW5Aw629R04TmNiMUOLBLbaTZyBCjfAzn8mdheNp+EZKmoA4FJTC/r0po+ri X-Received: by 2002:a05:6a21:3889:b0:19c:7e6f:85f2 with SMTP id yj9-20020a056a21388900b0019c7e6f85f2mr1802285pzb.1.1706718495711; Wed, 31 Jan 2024 08:28:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706718495; cv=pass; d=google.com; s=arc-20160816; b=s6rhq+YWu1qydHJE1kl3L5xAYAClJwVUkXBPSiXa0bnEl8bJMVrueT6BAQT83RwKGa 5smIWY/odvdiG6EL7MHXwB3HHafK9F7OO3IMShc8S3HpssVu1xzZkGyHRBokB22cwfPG egALF2llZNrq3NHxkbUYjyBxU+LNAF5TXtJBYcXiUI22QvpkrvoTbG9Q8sagISl0JLIe ge5IgK63oahsIt5tAAGimTdH2updAX97l5g+9A60JbDVAp2mLHpVsV56n3sRCN0swctF 07a7aNymb8+oDtj7zXa6PUM6toF3G2GpqDEXQdfFZgccEx6vGVP5fMbRZ8F7RJZYFFQl 0C4A== 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=6wJ6k+XVGp97QkRoYqu73O7Askxr2TglC0OY8izxSN4=; fh=vGA7OBJ6PGMu4lUSEjVl1i9xgf/WOE3Koa9lX9CH8oc=; b=nqKXWv/zl8TODyLJ/3No1nympDmlsVZkXe9X/ejs7SZa9lzDkymt0d0DiCMJmbm/F7 8srgNojxGFpEWBWXzw5qYnsA0hr8YjHOhW2a441Sm0F64DymXR6US/hPMVz2vX0afs5T ML4/ws5b9u96r0nSRenmZKvBICuFou7Q10FHcaINheFHSU+o/bMxD/KPFDTt2/ytJyeQ fN8KLzAKOcho6TmicLIuygHA5qNBgusuKzXGFAafX7hpofepiavtQKMzfLsDeFSYLiiP QIZblRiXMuvyNnR/Jhj/6ugUqSaNBa8qNa1nkBSnVxNzCRURB01qO8CJj346O4bjJDd7 jsxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=tPFOoGUC; 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-46785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46785-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCV6YG87PDEAmWKSCwb29G8n/2Xz+aGmmCbZbYzkS68he9/A3JGZempgEzu/rqLIYl7+mfveLZv2ktOJbKx2HngrjBdSKQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x9-20020a17090aca0900b0029014755c2dsi1589495pjt.25.2024.01.31.08.28.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:28:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46785-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=tPFOoGUC; 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-46785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46785-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 37848287812 for ; Wed, 31 Jan 2024 16:27:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6714F12F585; Wed, 31 Jan 2024 16:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="tPFOoGUC" 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 95D3012BE8F; Wed, 31 Jan 2024 16:25:49 +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=1706718353; cv=none; b=POAj/54xoax5vn2noySHee6yTnX8jrZGXC6kE/NQNacff6SO/RfR7mwreDl+OQdmipANi7BiPj1y7P2jnYnssdj1M8zdmT15EOYMFTztUDCrosN3XRbJS/ND51r7OEH6QMuDkx5igTfgyj+cVRUhW6nYYeDHT0Kc2z0cGlMil68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706718353; c=relaxed/simple; bh=QiUQHVE9OuD7A7XRfq4nHC+crkQnZ8+IZ0u7lnayc8c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QaeRJdyEg3QatJIHmAPF15Yva1YVB6zXFmYZhM1wTKn60uTJ8B39Eb05Mp17z+RWUgny298zd+nuG89EOlkdfKTAwznvtac18b3dfAAcEEVRnOw7ENFwEwdzvMwkqgP2XF0gVmZq78daz6+yGz2es30YtGgJqtVOoEZ3bKis+n0= 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=tPFOoGUC; 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=1706718348; bh=QiUQHVE9OuD7A7XRfq4nHC+crkQnZ8+IZ0u7lnayc8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPFOoGUCQpG6nbDTeV4EO+3l6CQr96GDzwrgBAkFN3BBXvvuVDa7KEgUQVhRO+9UJ OGBfhp6+IHWdIbnDgzb7rp6f5NoCAVT/MC/jdSqh/SbWXQai0GciSCZ5jGzJAZJFn9 zdbBdntL/XW+dTsVqtKTP0pFMFrIkzMRY2EjvD3nxnNlRo8+GV97CGNQTyzuR04/Bv DnVLu22IZhi/FCEikncgvc+r9uRAQtDTq6OOUCYLLFl+SPLOZdSfK/om2/oxbsUHtn heRyE9JrDmR4Al+5f3ZW4R/iVTnsP1/2fKc1z18/UCX+ap0fXxxnWGMUegUer3Cath BZBJCCPLX8AoA== 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 4TQ6ph3nMyzVny; Wed, 31 Jan 2024 11:25:48 -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 2/4] dax: Check for data cache aliasing at runtime Date: Wed, 31 Jan 2024 11:25:31 -0500 Message-Id: <20240131162533.247710-3-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: 1789624053180114566 X-GMAIL-MSGID: 1789624053180114566 Replace the following fs/Kconfig:FS_DAX dependency: depends on !(ARM || MIPS || SPARC) By a runtime check within alloc_dax(). This is done in preparation for its use by each filesystem supporting the "dax" mount option to validate whether DAX is indeed supported. 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 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 | 6 ++++++ fs/Kconfig | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 0da9232ea175..e9f397b8a5a3 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -445,6 +445,12 @@ 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. */ + if (IS_ENABLED(CONFIG_ARM) || + IS_ENABLED(CONFIG_MIPS) || + IS_ENABLED(CONFIG_SPARC)) + return NULL; + 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