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 AEF7380B for ; Sun, 22 Dec 2024 15:14:12 +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=1734880457; cv=none; b=fliQMYzotOzqEboyl/ja+CctDYCfZdf7Kf8iEym0oX8movMFve3h1Wpdz/U+dCpD8TCVhSkCwqHLD5RkCwgSEwQJN46B1Y7gMDV1s5EkpPKjYWoqcqZns75wnZx3tuayUR9BEI1QzwOnXuGwB43p2AnHKqPd8sUZGtmvJTBw+OA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734880457; c=relaxed/simple; bh=5Vfjn01rNtghUw0uCLoIDZHDXaAUb9NATgiT5FyDJY4=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=EKpZa8Rp7iV+c90biVjeVQCVkpUvNd0sAsjUO4tIH6cqgjNTjJ8wMc6XOPmdkB1RS8EnG2VTacM9Lu1EQIKIkieBKcOJIAxtWdpMPKYxYLNfV55kgxgyum0GucXGezGSmiMvbdMSkuH4avfHMOf6SYHh2i9+ECRAj6aiF4M7KEk= 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 1tPNdY-000000001Kk-314C; Sun, 22 Dec 2024 10:12:56 -0500 Message-ID: <86a2ca80d2be3a943566473ea156180abf3b2557.camel@surriel.com> Subject: Re: [PATCH 04/10] x86,mm: use INVLPGB for kernel TLB flushes From: Rik van Riel To: 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, bp@alien8.de, hpa@zytor.com, akpm@linux-foundation.org Date: Sun, 22 Dec 2024 10:12:56 -0500 In-Reply-To: <20241222111606.GU11133@noisy.programming.kicks-ass.net> References: <20241222040717.3096835-1-riel@surriel.com> <20241222040717.3096835-5-riel@surriel.com> <20241222111606.GU11133@noisy.programming.kicks-ass.net> 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 Sun, 2024-12-22 at 12:16 +0100, Peter Zijlstra wrote: > On Sat, Dec 21, 2024 at 11:06:36PM -0500, Rik van Riel wrote: > > Use broadcast TLB invalidation for kernel addresses when available. > >=20 > > +static void broadcast_kernel_range_flush(unsigned long start, > > unsigned long end) > > +{ > > + unsigned long addr; > > + unsigned long maxnr =3D boot_cpu_data.invlpgb_count_max; > > + unsigned long threshold =3D tlb_single_page_flush_ceiling * > > maxnr; > > + > > + /* > > + * TLBSYNC only waits for flushes originating on the same > > CPU. > > + * Disabling migration allows us to wait on all flushes. > > + */ > > + migrate_disable(); >=20 > So how expensive is all this? That is, I think I would feel better is > this were preempt_disable(). Either should work. If preempt_disable() is cheaper, I'm happy to use that. --=20 All Rights Reversed.