From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 1D4C2211C for ; Sat, 4 Jan 2025 16:27:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736008067; cv=none; b=cLMTQvVB0LqWSukfZkB4c5xZaWb7cD8if/t5QrpGHoOG3ewglGaUVHL5IGQ2U5mM1TiwbgBQbN/K2D8CuSJoKPePSHj1lteAtu/5uPx70LP3QlkPTnI2gGr9Hl4MZ/A08AkBEd2pGOKoWcsWT/MScYEiC8rYclXPlJAa/tCaLys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736008067; c=relaxed/simple; bh=KHp0mmyC8XGVDiGE0bhfbPlFKrbfjHHuXToRq/m9Sd8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cmMyzNh7DrYZhvJJShtEl55OC3ZEoQ6kJKJBLQxu+CZJQQtQF/g2Vku0u3sh7PbSIJYy1ai8A4uhFVqSlrcG44H5VpjI8N/c+oQ2/1CjDk+Oinr2DIza/sj4INphPucSmwt7EzaPFIsjc4It62jNB2wWKdcMb1njvaI0hGBrrQM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=vA+Id1XC; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vA+Id1XC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+AB0mgBgoYiRiqb3qkGBo0XZC0jbbLlU3i7QwZfKwbg=; b=vA+Id1XCC3ndWqI3AYvJuaeY86 sgc/PLZWakc5bDVhvjdylmGRFfVVE0vhmJLXCzb6AmD9Ac8X+6914tEVSDoLbBX6wBqLmO8RWTcCm AHwxpKNhGf93ScQ/LVHRk7Wildlf1Q1RXbrjUyMYNPLYTBUT23bcsOtnJrllYjFlF4DRaLeXnmXse f48sb/39rqU0cscDowEIcuD1dE3YGx6LgGD+gdEmbrw2eUXLuvlwIZkva8DmphUZdwGp9K3/5BIPk KlilX7p/2aH8n9dscxse3X32E3LC5RA1a6RagUMGMFvvp0wQ6uFLG5mtmls1+0zNEiYgAzPJHS+kE xZh8sbVw==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tU6za-00000003Sfh-1abN; Sat, 04 Jan 2025 16:27:14 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id C40803005D6; Sat, 4 Jan 2025 17:27:13 +0100 (CET) Date: Sat, 4 Jan 2025 17:27:13 +0100 From: Peter Zijlstra To: Borislav Petkov Cc: Rik van Riel , x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, dave.hansen@linux.intel.com, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.org, nadav.amit@gmail.com, zhengqi.arch@bytedance.com, linux-mm@kvack.org Subject: Re: [PATCH 01/12] x86/mm: make MMU_GATHER_RCU_TABLE_FREE unconditional Message-ID: <20250104162713.GA22803@noisy.programming.kicks-ass.net> References: <20241230175550.4046587-1-riel@surriel.com> <20241230175550.4046587-2-riel@surriel.com> <20241230184118.GMZ3LpTn3dHvu_bq-p@fat_crate.local> <20250102195609.GB7274@noisy.programming.kicks-ass.net> <20250103121843.GDZ3fVo0r0JRsGImBS@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250103121843.GDZ3fVo0r0JRsGImBS@fat_crate.local> On Fri, Jan 03, 2025 at 01:18:43PM +0100, Borislav Petkov wrote: > On Thu, Jan 02, 2025 at 08:56:09PM +0100, Peter Zijlstra wrote: > > Well, I've already answered why we need this in the previous thread but > > it wasn't preserved :-( > > ... and this needs to be part of the commit message. And there's a similar > comment over tlb_remove_table_smp_sync() in mm/mmu_gather.c which pretty much > explains the same thing. > > > Currently GUP-fast serializes against table-free by disabling > > interrupts, which in turn holds of the TLBI-IPIs. > > > > Since you're going to be doing broadcast TLBI -- without IPIs, this no > > longer works and we need other means of serializing GUP-fast vs > > table-free. > > > > MMU_GATHER_RCU_TABLE_FREE is that means. > > > > So where previously paravirt implementations of tlb_flush_multi might > > require this (because of virt optimizations that avoided the TLBI-IPI), > > this broadcast invalidate now very much requires this for native. > > Right, so this begs the question: we probably should do this dynamically only > on TLBI systems - not on everything native - due to the overhead of this > batching - I'm looking at tlb_remove_table(). > > Or should we make this unconditional on all native because we don't care about > the overhead and would like to have simpler code. I mean, disabling IRQs vs > batching and allocating memory...? The disabling IRQs on the GUP-fast side stays, it acts as a RCU-read-side section -- also mmu_gather reverts to sending IPIs if it runs out of memory (extremely rare). I don't think there is measurable overhead from doing the separate table batching, but I'm sure the robots will tell us.