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 F00C21854 for ; Wed, 1 Jan 2025 16:23:27 +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=1735748616; cv=none; b=YzfmU4CA3/wgrNEGvsHjhk7wfpIHKabeALDa7qMKYQ0RM2nkNrUXLFsAyPbe3jitNdF8Td749eVq4P8nDLGmnt/vqaVSfUEMKkr73+4gniKSf4map+QtINNtGNIDyes0YR6xte+1pTUtFENtl0NCPGNOSgBVxhAjzndYt/xbi7s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735748616; c=relaxed/simple; bh=/syA+GqHaTCmcCjy0k9geA5OWfVDg8Cf7ydH3S7V+kA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=WcgbsDYl02uYhAlexQA7qX+nUnhODataPs6/2paAENc0Z+Tu2M+cAUqiD0ImtZiIcqSshps55emd0dBp2BBfCXSmkz1A0d2YPBPLzqSLiiEMCSuashfnybJsONQPMffdjihwdpRCnhJaqkPUFV/yfSjAuascO6rX2HJtlnkAqOE= 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 1tT1V0-000000006W3-16kJ; Wed, 01 Jan 2025 11:23:10 -0500 Message-ID: <7be55c4eb33aac4f9b99c70bfd4578934fbdd0ea.camel@surriel.com> Subject: Re: [PATCH 09/12] x86/mm: enable broadcast TLB invalidation for multi-threaded processes From: Rik van Riel To: Karim Manaouil , Nadav Amit Cc: the arch/x86 maintainers , Linux Kernel Mailing List , kernel-team@meta.com, Dave Hansen , luto@kernel.org, peterz@infradead.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , zhengqi.arch@bytedance.com, "open list:MEMORY MANAGEMENT" Date: Wed, 01 Jan 2025 11:23:09 -0500 In-Reply-To: <20250101161556.lniuomixy75vmj5g@ed.ac.uk> References: <20241230175550.4046587-1-riel@surriel.com> <20241230175550.4046587-10-riel@surriel.com> <95b614577f5475a919c878d6906d721004c83584.camel@surriel.com> <24c9b4b6-e07b-4cee-aa7f-6f317a1b7ef6@gmail.com> <20250101161556.lniuomixy75vmj5g@ed.ac.uk> 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 Wed, 2025-01-01 at 16:15 +0000, Karim Manaouil wrote: > On Wed, Jan 01, 2025 at 05:20:01PM +0200, Nadav Amit wrote: > >=20 > >=20 > > On 01/01/2025 6:42, Rik van Riel wrote: > > > Fixed for the next version. > >=20 > > Thanks Rik, > >=20 > > Admittedly, I don't feel great about my overall last review - it > > mostly > > focused on style and common BKMs. > >=20 > > I still don't quite get the entire logic. To name one thing that I > > don't > > understand: why do we need broadcast_asid_list and the complicated > > games of > > syncing it with broadcast_asid_used. Why wouldn't > > broadcast_asid_used > > suffice? >=20 > If I uderstand correctly from Rik's patch, I think the list is needed > to > save the flush for only when we run out of the ASID space (wrap > around). > Without the list, whenever the ASID bit is cleared, you also have to > flush > the TLBs. That's exactly it. The list will only contain processes that are active on multiple CPUs, and hit a TLB flush "at the right moment" to be assigned a broadcast ASID, which will be true for essentially every process that does a lot of TLB flushes and is long lived. However, something like a kernel build has lots of short lived, single threaded processes, for which we should not be using broadcast TLB flushing, and which will not need to remove themselves from the list at exit time. --=20 All Rights Reversed.