lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6_3O75TzANMFrKN@google.com>
Date: Sat, 15 Feb 2025 02:08:59 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Rik van Riel <riel@...riel.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
	Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org, bp@...en8.de,
	dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com,
	nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com,
	linux-mm@...ck.org, akpm@...ux-foundation.org, jackmanb@...gle.com,
	jannh@...gle.com, mhklinux@...look.com, andrew.cooper3@...rix.com,
	Manali Shukla <Manali.Shukla@....com>
Subject: Re: [PATCH v11 06/12] x86/mm: use INVLPGB for kernel TLB flushes

On Fri, Feb 14, 2025 at 08:25:51PM -0500, Rik van Riel wrote:
> On Fri, 2025-02-14 at 11:55 -0800, Dave Hansen wrote:
> > 
> > Fair enough. If we don't have a better name, we can at least do:
> > 
> > 	if (new_bad_name()) {
> > 		new_thing();
> > 	} else {
> > 		old_thing();
> > 	}
> > 
> > My real heartburn is with:
> > 
> > 	if (new_bad_name()) {
> > 		new_thing();
> > 	} else if (need_thing_1()) {
> > 		old_thing1();
> > 	} else {
> > 		old_thing2();
> > 	}
> > 
> > Where new and old are logically squished together.
> > 
> Do we want to group this code by history, or
> by function?
> 
> I would argue that new_thing() and old_thing1()
> are closer to each other functionally (they both
> do remote TLB invalidation) than they are to 
> old_thing2(), which does local-only invalidation.
> 
> I can organize the code however people want,
> but I would like a second opinion on this idea :)

IIUC the discussion is about:

	if (broadcast_kernel_range_flush(info))
       		; /* Fall through. */
	else if (info->end == TLB_FLUSH_ALL)
		on_each_cpu(do_flush_tlb_all, NULL, 1);
	else
		on_each_cpu(do_kernel_range_flush, info, 1);

In this case I agree with Dave. old_thing1() and old_thing2() are both
sending IPIs, the difference is that old_thing1() is doing a full flush
while old_thing2() is doing a range flush. Not sure why you mentioned
that old_thing2() does local invalidation.

broadcast_kernel_range_flush() also decides between full and range
flushes internally. So the main difference between 'new' and 'old' here
is using the broadcast flush vs the IPI flush.

So I think what Dave wants (and I agree) is:
	if (!broadcast_kernel_range_flush(info))
		ipi_kernel_range_flush(info)

Where ipi_kernel_range_flush() contains old_thing1() and oldthing2().

> -- 
> All Rights Reversed.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ