From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 173C115C120 for ; Mon, 6 Jan 2025 15:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178457; cv=none; b=rDsQ5kL9TjIGGEM8e+mPGVFfs1Y3xCWCr34KsTUXLkXPYVcGHgjlEDiy/9I3ymWcb0zfxqF3FVlh+ibO8lqkKJlTGtqrJB110JDNl9A2FYduusdmGvPEsa7hIRK/KtwJPffcT1mWB/MFp2mzE8XDuyg7hbKNFt2MmrOnfp08TRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178457; c=relaxed/simple; bh=DO4ja5s3+VGS15OAIRFtZ2JjNP2PKOwocf9C6Cp6cI0=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=sNiBTWswpboaTyTiC0L5oo1rRcknpvE8L/nmQYoOUpvZlVfuN0ZENU8X21C/zDu5ExuFte3Goa8zv09Gtww6hCOUDMMmp+fCFYu1oCe/YvVbc2W4qtBVBk2xW5LFqCqUFM7kWyKx6jMSZULNKySnRyXFauOQ6r8M9X+EkeNL0yo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=shelob.surriel.com; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shelob.surriel.com Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tUpJt-000000003Nm-475c; Mon, 06 Jan 2025 10:47:09 -0500 Message-ID: Subject: Re: [PATCH 01/12] x86/mm: make MMU_GATHER_RCU_TABLE_FREE unconditional From: Rik van Riel To: Borislav Petkov , Peter Zijlstra Cc: 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 Date: Mon, 06 Jan 2025 10:47:09 -0500 In-Reply-To: <20250103121843.GDZ3fVo0r0JRsGImBS@fat_crate.local> 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> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.1 (3.54.1-1.fc41) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: riel@surriel.com On Fri, 2025-01-03 at 13:18 +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 :-( >=20 > ... 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. >=20 > > Currently GUP-fast serializes against table-free by disabling > > interrupts, which in turn holds of the TLBI-IPIs. > >=20 > > 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. > >=20 > > MMU_GATHER_RCU_TABLE_FREE is that means. > >=20 > > 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. >=20 > 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(). >=20 > 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...? Given the cost of IPIs on systems where we don't technically need MMU_GATHER_RCU_TABLE_FREE, the batching might still be cheaper. --=20 All Rights Reversed.