Re: [PATCH v9 00/12] AMD broadcast TLB invalidation

Rik van Riel
2025-02-07T17:47:56Z

On Fri, 2025-02-07 at 09:16 +0100, Peter Zijlstra wrote:
> On Thu, Feb 06, 2025 at 09:48:25AM -0500, Rik van Riel wrote:
>
>
> > we can just round up the
> > end address to the nearest stride boundary
> > there, with a comment explaining why?
>
> Well, why are we rounding at all? I don't think I've seen an
> explanation
> for that anywhere yet.
>
> What made you do this?

The only real reason is to not end up with a 0
value for nr in these loops:

for (addr = info->start; addr < info->end; addr += nr <<
PAGE_SHIFT) {
nr = min((info->end - addr) >> PAGE_SHIFT,
invlpgb_count_max);
invlpgb_flush_addr_nosync(addr, nr);
}

Which makes me think we could just insert a
"nr = max(nr, 1)" in there, and round up
partial pages that way?

Looking further, I already did that on the
userspace flushing side. Let me do the same
thing on the kernel side, and remove the
other code related to partial pages being
passed in.

--
All Rights Reversed.