On 3/4/25 03:00, Borislav Petkov wrote: > On Mon, Mar 03, 2025 at 11:23:58AM -0800, Dave Hansen wrote: >> Here's a plain diff if you just want to squish it in. > >> diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h >> index 5375145eb9596..3bd617c204346 100644 >> --- a/arch/x86/include/asm/tlb.h >> +++ b/arch/x86/include/asm/tlb.h >> @@ -28,6 +28,11 @@ static inline void invlpg(unsigned long addr) >> asm volatile("invlpg (%0)" ::"r" (addr) : "memory"); >> } >> >> +enum invlpgb_stride { > > Right, this is an address stride, as the text calls it. > >> + NO_STRIDE = 0, >> + PTE_STRIDE = 0, > > Ok, so those are confusing. No stride is PTE stride so let's just zap > NO_STRIDE. Passing "PTE_STRIDE" to an operation that doesn't have a stride is pretty confusing too. ... > /* Flush all mappings, including globals, for all PCIDs. */ > @@ -117,21 +126,21 @@ static inline void invlpgb_flush_all(void) > * as it is cheaper. > */ > guard(preempt)(); > - __invlpgb(0, 0, 0, 1, 0, INVLPGB_INCLUDE_GLOBAL); > + __invlpgb(0, 0, 0, 1, PTE_STRIDE, INVLPGB_FLAG_INCLUDE_GLOBAL); > __tlbsync(); > } This one, for example. It's not flushing PTEs an doesn't have a start address or nr>0. So, we could have the enum be totally divorced from the hardware type: NO_STRIDE, PTE_STRIDE, PMD_STRIDE and decode it at the end: if (stride == PMD_STRIDE) foo | PMD_STRIDE_BIT;