From patchwork Tue Jan 30 16:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13537740 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 C768BC47DA9 for ; Tue, 30 Jan 2024 16:53:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B6E26B009F; Tue, 30 Jan 2024 11:53:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9210B6B00A0; Tue, 30 Jan 2024 11:53:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80E4B6B00A1; Tue, 30 Jan 2024 11:53:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 71D2D6B009F for ; Tue, 30 Jan 2024 11:53:06 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 45E241A020C for ; Tue, 30 Jan 2024 16:53:06 +0000 (UTC) X-FDA: 81736572372.07.FAD2138 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf27.hostedemail.com (Postfix) with ESMTP id A4D284001D for ; Tue, 30 Jan 2024 16:53:03 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=O3j0OrZH; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf27.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=1706633583; 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:references:dkim-signature; bh=NaBMNzr+cAg9HARQ76XDRr+NTvdKYaoOi19UN7075Pg=; b=G2P7NQGeIzXhkjIajMxgHoe5SeFPQVgcD9+W7nw57xBUdAmAoNn4x38gt3T6fGUrZ0cKc8 BrFuIj/GlpwgYQq2EHNJp+4ep3aXX1wf3uIW4itrGwgIroDQVlXptwIU8wkiD7h99DLl6q U4mFW7kseU05e6kEZEDLh8YoqeRxNmc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=O3j0OrZH; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf27.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=1706633583; a=rsa-sha256; cv=none; b=afHPWHdIhRs7GBkf5OTp4Fkv7h8RNS8xHHTptJbcPpWm+VUWwnodW7ejdIGoyJBskhtCBJ e3vX4AHmkDvZunlYHIJ5Hx0o7eRVt4nzhhwKgUhXWKMZER9EIiFK+wk9SKVbx00cFu/g6p YO7EwOY7/5R8sol1+5A1dUImcz+k730= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706633582; bh=Y0wTQsFQxBGihii2XUTlKjm4PLqLm9Iv8iRpB5W6oiU=; h=From:To:Cc:Subject:Date:From; b=O3j0OrZHAaPVHqKNJDlGd9sdFDBgJv7ZTPNfF/geXnNU8X+vdyJrGNeG7jc2PmFcT vHVBTx2cw/X2mEB4vo+xPPWOPtfj3AJKyF1VL4ekbW/3UeTl1bhrPL7GJsbsUA4Xjf QN5n1PkrJytSFnG4MMAUxz0Hshp1lnfrHlGiViw5dhz+dbt5tSbQFQdUYOVz5zEo+z dkhR8Eo1aBMX3GoMv7Wy6G2ZBwdyZyWjGByfMC4pdfKcGaepdNqVweTXxNJdIP/9Jx 3w/wriketsu8SXr0KY8sxsTXpUqpeoZdN4oQeD4+Ioed20ctoxadZGPgNX63/gVKyG 2ldjjViqgwmkA== 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 4TPWSZ2LkgzVCQ; Tue, 30 Jan 2024 11:53:02 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , Arnd Bergmann , Russell King , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v2 0/8] Introduce dcache_is_aliasing() to fix DAX regression Date: Tue, 30 Jan 2024 11:52:47 -0500 Message-Id: <20240130165255.212591-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: A4D284001D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: niaj3b5m6gjfno3dk4tt4wkz18dubkwj X-HE-Tag: 1706633583-707097 X-HE-Meta: U2FsdGVkX1/TZp6Ty/4JCpOjH//ncYFRxoDt2tg/PcTiMX3tBE6W4O+dL8HdDIP404iTD7y3o+vhFuTWpu0zS9lhwL89ZRoxxrtnYhJk6hhyYjOyqqA8Zs7tDw8HKOytgI5IKFgFxFDPCJU5l7HW1J82HS2THWHQ+atYKBNvk9VJCdv+rAdrhj1X2rK+fyaP3gqmLWuGnlgAozDw7F2HEotnDsHQrQjH8JBmuJHwZ2tL9FcqleyU5jNkuA91je+1mVy9ELd3DDgLjaXlt/7TRY6H96YXghnVm48eyroO1LZDtbcCGFCgvE5rOOG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xqZn0I2fDA4rreGPg3lyXuCzIU0wGb6hFL2Vkg4R22QfyOwgcfD5LeNGNuAHtliLjh+Yo7YxrBepGTnXA4PfJJF+mC801lgHdgGNiRnV45piQzl+xejwH3yATkC1Pkmh4HSI/cU9y7tarsusSe+o25HoJOJ/GX/Q== 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: This commit introduced in v5.13 prevents building FS_DAX on 32-bit ARM, even on ARMv7 which does not have virtually aliased dcaches: commit d92576f1167c ("dax: does not work correctly with virtual aliasing caches") It used to work fine before: I have customers using DAX over pmem on ARMv7, but this regression will likely prevent them from upgrading their kernel. The root of the issue here is the fact that DAX was never designed to handle virtually aliased dcache (VIVT and VIPT with aliased dcache). It touches the pages through their linear mapping, which is not consistent with the userspace mappings on virtually aliased dcaches. This patch series introduces dcache_is_aliasing() with the new Kconfig option ARCH_HAS_CACHE_ALIASING and implements it for all architectures. The implementation of dcache_is_aliasing() is either evaluated to a constant at compile-time or a runtime check, which is what is needed on ARM. With this we can basically narrow down the list of architectures which are unsupported by DAX to those which are really affected. Note that the order of the series was completely changed based on the feedback received on v1, cache_is_aliasing() is renamed to dcache_is_aliasing(), ARCH_HAS_CACHE_ALIASING_DYNAMIC is gone, dcache_is_aliasing() vs ARCH_HAS_CACHE_ALIASING relationship is simplified, and the dax_is_supported() check was moved to its rightful place in all filesystems. Feedback is welcome, Thanks, Mathieu 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: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev Cc: linux-fsdevel@vger.kernel.org Mathieu Desnoyers (8): dax: Introduce dax_is_supported() erofs: Use dax_is_supported() ext2: Use dax_is_supported() ext4: Use dax_is_supported() fuse: Use dax_is_supported() xfs: Use dax_is_supported() Introduce dcache_is_aliasing() across all architectures dax: Fix incorrect list of dcache aliasing architectures arch/arc/Kconfig | 1 + arch/arc/include/asm/cachetype.h | 9 +++++++++ arch/arm/Kconfig | 1 + arch/arm/include/asm/cachetype.h | 2 ++ arch/csky/Kconfig | 1 + arch/csky/include/asm/cachetype.h | 9 +++++++++ arch/m68k/Kconfig | 1 + arch/m68k/include/asm/cachetype.h | 9 +++++++++ arch/mips/Kconfig | 1 + arch/mips/include/asm/cachetype.h | 9 +++++++++ arch/nios2/Kconfig | 1 + arch/nios2/include/asm/cachetype.h | 10 ++++++++++ arch/parisc/Kconfig | 1 + arch/parisc/include/asm/cachetype.h | 9 +++++++++ arch/sh/Kconfig | 1 + arch/sh/include/asm/cachetype.h | 9 +++++++++ arch/sparc/Kconfig | 1 + arch/sparc/include/asm/cachetype.h | 14 ++++++++++++++ arch/xtensa/Kconfig | 1 + arch/xtensa/include/asm/cachetype.h | 10 ++++++++++ fs/Kconfig | 1 - fs/erofs/super.c | 5 ++++- fs/ext2/super.c | 6 +++++- fs/ext4/super.c | 5 ++++- fs/fuse/dax.c | 7 +++++++ fs/xfs/xfs_iops.c | 2 +- include/linux/cacheinfo.h | 6 ++++++ include/linux/dax.h | 9 +++++++++ mm/Kconfig | 6 ++++++ 29 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 arch/arc/include/asm/cachetype.h create mode 100644 arch/csky/include/asm/cachetype.h create mode 100644 arch/m68k/include/asm/cachetype.h create mode 100644 arch/mips/include/asm/cachetype.h create mode 100644 arch/nios2/include/asm/cachetype.h create mode 100644 arch/parisc/include/asm/cachetype.h create mode 100644 arch/sh/include/asm/cachetype.h create mode 100644 arch/sparc/include/asm/cachetype.h create mode 100644 arch/xtensa/include/asm/cachetype.h