Re: [PATCH v11 06/12] x86/mm: use INVLPGB for kernel TLB flushes

From: Dave Hansen
Date: Fri Feb 14 2025 - 14:56:07 EST


On 2/14/25 11:40, Peter Zijlstra wrote:
> On Fri, Feb 14, 2025 at 10:35:40AM -0800, Dave Hansen wrote:
>> 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?
> IIRC the more general name is indeed broadcast tlbi; as in other
> architectures use this naming to mean this very thing too.
>
> But yes, I see the confusion, but I don't think changing the naming
> really helps a lot here :-/

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.