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: <ab55a809-e0d2-4364-84ce-917a40ee299a@intel.com>
Date: Fri, 14 Feb 2025 10:35:40 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Rik van Riel <riel@...riel.com>, x86@...nel.org
Cc: linux-kernel@...r.kernel.org, bp@...en8.de, peterz@...radead.org,
 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 2/13/25 08:13, Rik van Riel wrote:
> -	if (info->end == TLB_FLUSH_ALL)
> +	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);

We've got to find a better name for broadcast_kernel_range_flush().
Because IPIs are broadcast too. The naming makes it confusing. Why would
be broadcast, and then start trying IPIs that are also broadcast?

This hunk really the crux of the patch and we need to make sure the
semantics are crystal clear. What do folks think about something like this:

/*
 * Try to use a hardware assist for flushing the TLB.
 * This is expected to be cheaper than using an IPI
 * to do flushes.
 *
 * Returns True if the assisted method succeeded.
 */
static bool assisted_kernel_range_flush(struct flush_tlb_info *info)
{
	...
}

static do_ipi_tlb_flush(...info)
{
	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);
}

Then we end up with:

	/*
	 * Assisted flushes are assumed to be faster. Try
	 * them first and fall back to IPIs if not available.
	 */
	flush_success = assisted_kernel_range_flush(info);
	if (!flush_success)
		do_ipi_tlb_flush(info);

I think that's a *LOT* more clear:

 1. Try assisted flush
 2. If it fails fall back to an IPI-based flush



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ