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: 13539643 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 4DD62C47258 for ; Wed, 31 Jan 2024 16:25:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D699F6B007D; Wed, 31 Jan 2024 11:25:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D18B28D0001; Wed, 31 Jan 2024 11:25:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBC336B0095; Wed, 31 Jan 2024 11:25:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A7A546B007D for ; Wed, 31 Jan 2024 11:25:51 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 567EF14060A for ; Wed, 31 Jan 2024 16:25:51 +0000 (UTC) X-FDA: 81740132502.24.BC18B4D Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf06.hostedemail.com (Postfix) with ESMTP id BB89118000D for ; Wed, 31 Jan 2024 16:25:49 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tPFOoGUC; spf=pass (imf06.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706718349; 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=6wJ6k+XVGp97QkRoYqu73O7Askxr2TglC0OY8izxSN4=; b=oOjbOxCaxZ5PJ5bL+v/p0MyC8VraIDlqFYexDXxfnqA20EuyHbmUd2g8cpF0SfBOEJX292 //FozHu6bCXOZPBsdyK4KjwufFbw3veKhYEx2hp8yTW/M+a4WmDw+zhSPAC51Zuyo5ZTTN xuIiivEkv1PYWN/Ezi51Dz4S5H28u4g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706718349; a=rsa-sha256; cv=none; b=T6tZKCXOckvcutK+ETViN0WAsl+HVHkF+2aKhjcd9TuT11MyOg+82FwumhNUjU47czdibU dlEADm2toMei6yDRxIF+54GgZY/gGqZqEs6mCF6T82koP9iBf7Oy47aK7+XyjTZCOKssJT Vnbmu+nu6zRz2Uu3LqsVF/QVjY4ZHmM= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=tPFOoGUC; spf=pass (imf06.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=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> MIME-Version: 1.0 X-Stat-Signature: mpyd5yuc5ufmtjewyzefmxruxg6knyfs X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BB89118000D X-Rspam-User: X-HE-Tag: 1706718349-292008 X-HE-Meta: U2FsdGVkX1++mqR6014KTBHKUPZNsvzWL6F77dJHBgYys9xf8Q3iBO1fK6ZuLahDv+0XEV+zdGY942Ozelpp/ZrnogzvCXbjbHfG8AvHBTiuiOJ4kO8r9GTuYEFaBcwU06NlqXK923B2uRiKYYjNTocimXc6aX15vF1GLwbov5ZKml5GCZZz2G8tdO6LA0/s6cFBD3DZ3kKqTHUx+QnPL5cqa14yhzoqu77hq6YAanr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jFwEXDmn4jjAHB/nWYsaDcO+GixVKI4Lm/iRGaRhp3wB693S8lDp5pDskmJXlFCGZCvEJii3vZ1F5SwHf2lFUHfdTQbm1nnND4cXlCSaU4v9dfWZbmvnoUcr+eWra8gRByeO8XTcNRTjI/ZKzXp/jIo629m7vIEdQroMCf2z7bxWGPYlVbtZvAHGk6OubvYoYzQrbJMu24erjiJckrYZXNyIsdrmJ02JnOmBoowuVdbHCyOk5LiRZNZdtnDqJoEt1Zpu1X 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: 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 Signed-off-by: Dan Williams --- 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