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 EBBC1C19F32 for ; Wed, 5 Mar 2025 19:36:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 573A8280024; Wed, 5 Mar 2025 14:36:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 523B6280008; Wed, 5 Mar 2025 14:36:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C568280024; Wed, 5 Mar 2025 14:36:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 19F5E280008 for ; Wed, 5 Mar 2025 14:36:00 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D4E07510D7 for ; Wed, 5 Mar 2025 19:36:00 +0000 (UTC) X-FDA: 83188502880.11.96E919B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf21.hostedemail.com (Postfix) with ESMTP id 0384B1C001D for ; Wed, 5 Mar 2025 19:35:58 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DlI0YgwR; spf=pass (imf21.hostedemail.com: domain of will@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=will@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741203359; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9Vc6Y+34DoHf9KvelGXYXSEIFKxVelF1v+ZsJHAVBGE=; b=MJIsZZZOV9kHaiYzFpeFfdi08nBDPLUWXNuXrJNJ06lp4/xLxUiD/LrRhe7VtfO5UTizmf 4DwdzRbCZfdx+geZJm0JtrkmiPXgTo+J59Zr/6xWDQ8J+fbLNET6XB+L9La7K6Tjg2xDLr +qBFX1Qgm+gNQ30/6wF+e1xGL8WhP80= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DlI0YgwR; spf=pass (imf21.hostedemail.com: domain of will@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=will@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741203359; a=rsa-sha256; cv=none; b=hiNlMeevaLelSESLMJ1lyorCYkUjM2mAhutrxd/fixq+W/iQGLAv7pNpqYX6ZJoGJig0BY n/QXQBcbem5uB7fchCNkYmMbXJF2LRFqhyhVanvi5OnWkPjqwIq3poYt6WRD0Qz2I5ODL9 YVHFpI+Xuagx1arDD38JuY4domVUQWA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 74929A45C66; Wed, 5 Mar 2025 19:30:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DF4BC4CEE0; Wed, 5 Mar 2025 19:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741203357; bh=opvlMC7/dJjo3sftbWz3StojmcMoaNBHavqjKNA8v6k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DlI0YgwRiawZxVfrzvh4EJlkNqVQ1InEA61nj5QxoxVAjruJi1q2XRqZC7mlmXb1Q a+xEx2hFlaU+nsxDoVMo26p5IUrVsnpaAqNXcoT3WKFjo2PVyFA4RneQVwmOjqclqU RFmHzOxsMcNiNG3HSoCU/AslAXoM/l8y0dDxq5virnG8fZInzdVcZO8ivDc8npM1b1 j9FkaqKHxs7W+AJ5v8+pMpWDkqnBuZJhceyCj2IMjl5d1dAbig0QCpplvQ5y+Zy25T LOlrl5dZWUq7BWZgaCSpPiayGmXJrhqnTpQcfeEw3WjdAQVX/YmljeMmjwjv+YjgLk cL8L7w0omJlPw== Date: Wed, 5 Mar 2025 19:35:52 +0000 From: Will Deacon To: Catalin Marinas Cc: Piotr Jaroszynski , linux-arm-kernel@lists.infradead.org, Robin Murphy , Alistair Popple , Raghavendra Rao Ananta , SeongJae Park , Jason Gunthorpe , John Hubbard , Nicolin Chen , iommu@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] [arm64/tlb] Fix mmu notifiers for range-based invalidates Message-ID: <20250305193551.GB32246@willie-the-truck> References: <20250304085127.2238030-1-pjaroszynski@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspam-User: X-Rspamd-Queue-Id: 0384B1C001D X-Rspamd-Server: rspam09 X-Stat-Signature: mmi6jasee8rhfcf3gaqk1hfc9imnc487 X-HE-Tag: 1741203358-527713 X-HE-Meta: U2FsdGVkX18+Y/Vdtfyxkf07z5kO3mcccQ0PEswUYpql1/wAcClqNKg+SfmHF1SrS09mfwUj2nwoUrEeEtKaSGfoT7JV2BLMf3MoIN2nD4kYKjU12CJPUUrkHUcXoX2hXMtvbCmVsfrumsF0S6Ol/PC55X2pUr3uPSVptu1S8aTd7E8O7bCT1doUX3yS5QIrurNb2E11nw5g0LQqoGcGqCqz5LLsb83pS8cNpcI0RzZsBATt87mNZEjGsYf/vCIR48TFGKKU9n9IKlRsB4/QTCFOsphZv3bsR0q/vgNUNqu9QmcWh5UTLjT+5YcKxywUqogawxWhD2nSoJopZeEs5DIyDajZZV0FdU2nazy1Xxc1mg4yM+ne5xAIk/vBg1AA0p9QPrPmgEBRNqLMNNxxzjaTrFkAjciZOgB0zItE3WZmvGgQMDrmVUzdCqQgSdvu5gdqhLX2cKAUWmKl1tLwUfG9EKzZE3hcFOMEhDk5iALRNPIr0Y4NRiS7QztfueMlxTP/S31H9ucsN4UNYn/fkwlhpPHfNyE7/bVW5FsBjZdeeOyL0Kp4f0XvWaITmjrxW/XiAChnhuTvzLXOw1jmxSoxeuYtsHvx+zRQVky3lh4EJey094m4EBck1+/CP/0DkMAE9jVNTTwRx2i46UTqZO+EgbPvrXSENL0qczB+cgNsvRGTDAse+b959cnHd1dHN7xFhxubrRiHo/3/646gNez/A6lgLZa5qTCEzlwZHIMRmipmbOEDJYT59YqDDSmaKY1dgTtVpgwJKOllPnv4rILVF49wtBH/JK74N4bktIvaERr7MZFYRR0WTp1D1uyBxRB8Ok/Xn9S9HI6Rrc4WC1ScMjMG+WdVekiYzZCIDLDuPgvVHUI+FoQeSjFypJixxAw5OQ4Owc0l5Es54fLd8SvVoLBPuPIuQr8+z+ODvXTNVsW3k+HnKnJ+X7BcVlupbJ/gZErvRyIVH4c9Kit amDI8JBJ 44yl7iZCRKB7PcQFL2c3aCo1lkH6Y11m7lKxbJ4YzsYRhwnuVsU51s+DFaO0S+0xnV5/iRg4X1zKIAsHq1b0mzgNmCGiulAXOEmLatnqlH/RXgSkbXW876cMLpFKOYPKnPwezvtagENSvcsLHnjwbubdjx00Ats23Kw2a6bBx7FwVFjPkcj3xP8ExP7Jd1a+FBdUPBo1mfS2KXWCi+6Q4ilSluLq4GVV80x4a6jJf3DY3N6n+DfKh16fVN5vmo2uh4dp/mbURLiyPW0BkBTfnE+tEMg== 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: On Wed, Mar 05, 2025 at 06:48:19PM +0000, Catalin Marinas wrote: > On Tue, Mar 04, 2025 at 12:51:27AM -0800, Piotr Jaroszynski wrote: > > Update the __flush_tlb_range_op macro not to modify its parameters as > > these are unexepcted semantics. In practice, this fixes the call to > > mmu_notifier_arch_invalidate_secondary_tlbs() in > > __flush_tlb_range_nosync() to use the correct range instead of an empty > > range with start=end. The empty range was (un)lucky as it results in > > taking the invalidate-all path that doesn't cause correctness issues, > > but can certainly result in suboptimal perf. > > > > This has been broken since commit 6bbd42e2df8f ("mmu_notifiers: call > > invalidate_range() when invalidating TLBs") when the call to the > > notifiers was added to __flush_tlb_range(). It predates the addition of > > the __flush_tlb_range_op() macro from commit 360839027a6e ("arm64: tlb: > > Refactor the core flush algorithm of __flush_tlb_range") that made the > > bug hard to spot. > > That's the problem with macros. > > Reviewed-by: Catalin Marinas > > Will, do you want to take this as a fix? It's only a performance > regression, though you never know how it breaks the callers of the macro > at some point. Yeah, I'll pick it up but I'm travelling atm so it may have to wait until next week. Will