From mboxrd@z Thu Jan 1 00:00:00 1970 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 B5A75C46CD2 for ; Tue, 30 Jan 2024 15:14:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E86206B0072; Tue, 30 Jan 2024 10:14:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E36536B0074; Tue, 30 Jan 2024 10:14:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D24676B0075; Tue, 30 Jan 2024 10:14:52 -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 C42F76B0072 for ; Tue, 30 Jan 2024 10:14:52 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 81A2016047A for ; Tue, 30 Jan 2024 15:14:52 +0000 (UTC) X-FDA: 81736324824.28.4F017AC Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf11.hostedemail.com (Postfix) with ESMTP id 975FE4000B for ; Tue, 30 Jan 2024 15:14:49 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Y9S9PIym; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf11.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=1706627689; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JJUufBkVY9PC87c757UM9v//3UuX9aRWCwvKKJwZnaE=; b=DshviBG6WWauSCxjeELJMkGIBympWHnCGdK4PHMFjQRJMJ14Klw+LthxCg1FHeXR7/KrQz TlHIERA893r2uGOrL+l02WtaqrIuMTttpLhqEkDkKz048qZlxoFBbM2Xiyd0vxRHPE6Ltf bNjAqis7U4Jv+2n7/1mZ3Au7vrUht5w= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=Y9S9PIym; dmarc=pass (policy=none) header.from=efficios.com; spf=pass (imf11.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=1706627689; a=rsa-sha256; cv=none; b=MtuKYPUp/Y70aZ5vukSL2bpbAdQRLOA7o+ObOgDfnRbV0/HMog7RuMoYvABg5uG0xxMuaI RbJuwLCS6K5vqBco9glEdMUWmSIn9KMCjWoBImUDxZgSTQh4iDVoKVPI2MF8/6yHD2Tag3 pi31PHgGp1bDnP6OnWOS5ZzjldMubZY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706627688; bh=h5FQ47qXuTnmiZi7uPNXxphsw2Z8nkL44QsJTo8DKRI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Y9S9PIymVF4suOMYwobbgiBkRbKBBpk+lSnLQgDi5x0UZQnEHvkB2GbNcpIsxHIl9 zt4Ov/FW+piBKUXcQsoIw1lRpiOvLwI3Srw9Iy6vOf+6/5Oc4fb+oNjV1FcCO//FNH SiBzGEkDMAIX5xX1HV4RVe9HVq+ecKqbxt8MG03uhxg7sjyA7FTVxrDkdqL81qSJcB 3cDn/r7Y+FYLN8CLkAJ3X69mcH32qOpZwineik64Gbgyb3NBIAA7njWqW3bxsB23Hz swS2z0WS2yz6PmT55k/kMJ8SBqkjnlxd38S6u0LS2R/uAD5DKpeZdGh7+BR12WcCV4 Nsu4VHJnlGPVQ== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TPTHD1wnPzVgJ; Tue, 30 Jan 2024 10:14:48 -0500 (EST) Message-ID: Date: Tue, 30 Jan 2024 10:14:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/7] Introduce cache_is_aliasing() to fix DAX regression Content-Language: en-US To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, Linux-Fsdevel References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> <65b8173160ec8_59028294b3@dwillia2-mobl3.amr.corp.intel.com.notmuch> From: Mathieu Desnoyers In-Reply-To: <65b8173160ec8_59028294b3@dwillia2-mobl3.amr.corp.intel.com.notmuch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 975FE4000B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: n11wu35m5me75fyg4qwf5fgok4px7nze X-HE-Tag: 1706627689-711579 X-HE-Meta: U2FsdGVkX19SGx0zArVFKziqOzF1y1y+2JpFZa9N6gEox6RUVnNfpNUNivqXzh026K07gEo9IQGZc51XBBvacaAkalB2DGKq8WWVNq3sADNMEQub5Miu4Lr3DdQXCLNcXijbzZHtc+0g/yYs6IDyQzHM+hhQu3cL+0DF1wbnsMFz/bU5T8w+zlKjerBB0u1Av8K2Q9L4YFByGxUe14gxaCUJ/dRdV7z17I2TcFG84EGgMIUK9tm63VS4JI+IjQSXF0Wcu/Hkyy2qgURKeVKHBhx5Br3KTYh1iYTE+x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=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024-01-29 16:22, Dan Williams wrote: > Mathieu Desnoyers wrote: >> 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 cache_is_aliasing() with new Kconfig >> options: >> >> * ARCH_HAS_CACHE_ALIASING >> * ARCH_HAS_CACHE_ALIASING_DYNAMIC >> >> and implements it for all architectures. The "DYNAMIC" implementation >> implements cache_is_aliasing() as a runtime check, which is what is >> needed on architectures like 32-bit ARMV6 and ARMV6K. >> >> With this we can basically narrow down the list of architectures which >> are unsupported by DAX to those which are really affected. >> >> Feedback is welcome, > > Hi Mathieu, this looks good overall, just some quibbling about the > ordering. Thanks for having a look ! > > I would introduce dax_is_supported() with the current overly broad > interpretation of "!(ARM || MIPS || SPARC)" using IS_ENABLED(), then > fixup the filesystems to use the new helper, and finally go back and > convert dax_is_supported() to use cache_is_aliasing() internally. Will do. > > Separately, it is not clear to me why ARCH_HAS_CACHE_ALIASING_DYNAMIC > needs to exist. As long as all paths that care are calling > cache_is_aliasing() then whether it is dynamic or not is something only > the compiler cares about. If those dynamic archs do not want to pay the > .text size increase they can always do CONFIG_FS_DAX=n, right? Good point. It will help reduce complexity and improve test coverage. I also intend to rename "cache_is_aliasing()" to "dcache_is_aliasing()", so if we introduce an "icache_is_aliasing()" in the future, it won't be confusing. Having aliasing icache-dcache but not dcache-dcache seems to be fairly common. So basically: If an arch selects ARCH_HAS_CACHE_ALIASING, it implements dcache_is_aliasing() (for now), and eventually we can implement icache_is_aliasing() as well. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com