On Thu, Feb 13, 2025 at 11:13:56AM -0500, Rik van Riel wrote: > Add invlpgb.h with the helper functions and definitions needed to use > broadcast TLB invalidation on AMD EPYC 3 and newer CPUs. > > Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx> > Tested-by: Manali Shukla <Manali.Shukla@xxxxxxx> > Tested-by: Brendan Jackman <jackmanb@xxxxxxxxxx> > Tested-by: Michael Kelley <mhklinux@xxxxxxxxxxx> > --- > arch/x86/include/asm/disabled-features.h | 8 +- > arch/x86/include/asm/invlpgb.h | 101 +++++++++++++++++++++++ > arch/x86/include/asm/tlbflush.h | 1 + > 3 files changed, 109 insertions(+), 1 deletion(-) > create mode 100644 arch/x86/include/asm/invlpgb.h > > diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h > index c492bdc97b05..625a89259968 100644 > --- a/arch/x86/include/asm/disabled-features.h > +++ b/arch/x86/include/asm/disabled-features.h > @@ -129,6 +129,12 @@ > #define DISABLE_SEV_SNP (1 << (X86_FEATURE_SEV_SNP & 31)) > #endif > > +#ifdef CONFIG_X86_BROADCAST_TLB_FLUSH > +#define DISABLE_INVLPGB 0 > +#else > +#define DISABLE_INVLPGB (1 << (X86_FEATURE_INVLPGB & 31)) > +#endif > + What does that bring you really in savings? > /* > * Make sure to add features to the correct mask > */ > @@ -146,7 +152,7 @@ > #define DISABLED_MASK11 (DISABLE_RETPOLINE|DISABLE_RETHUNK|DISABLE_UNRET| \ > DISABLE_CALL_DEPTH_TRACKING|DISABLE_USER_SHSTK) > #define DISABLED_MASK12 (DISABLE_FRED|DISABLE_LAM) > -#define DISABLED_MASK13 0 > +#define DISABLED_MASK13 (DISABLE_INVLPGB) > #define DISABLED_MASK14 0 > #define DISABLED_MASK15 0 > #define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \ > diff --git a/arch/x86/include/asm/invlpgb.h b/arch/x86/include/asm/invlpgb.h > new file mode 100644 > index 000000000000..a1d5dedd5217 > --- /dev/null > +++ b/arch/x86/include/asm/invlpgb.h I remember asking you to add all that gunk to arch/x86/include/asm/tlb.h. Please do so. > +#define INVLPGB_VA BIT(0) > +#define INVLPGB_PCID BIT(1) > +#define INVLPGB_ASID BIT(2) > +#define INVLPGB_INCLUDE_GLOBAL BIT(3) > +#define INVLPGB_FINAL_ONLY BIT(4) > +#define INVLPGB_INCLUDE_NESTED BIT(5) > + > +/* Flush all mappings for a given pcid and addr, not including globals. */ > +static inline void invlpgb_flush_user(unsigned long pcid, > + unsigned long addr) Please drop this unused function. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette