Re: [PATCH v13 03/14] x86/mm: add INVLPGB support code

From: Borislav Petkov
Date: Mon Feb 24 2025 - 07:22:18 EST


On Sun, Feb 23, 2025 at 02:48:53PM -0500, Rik van Riel wrote:
> Add invlpgb.h with the helper functions and definitions needed to use

"invlpgb.h" is stale now.

> diff --git a/arch/x86/include/asm/disabled-features.h b/arch/x86/include/asm/disabled-features.h
> index c492bdc97b05..95997caf0935 100644
> --- a/arch/x86/include/asm/disabled-features.h
> +++ b/arch/x86/include/asm/disabled-features.h
> @@ -129,6 +129,13 @@
> #define DISABLE_SEV_SNP (1 << (X86_FEATURE_SEV_SNP & 31))
> #endif
>
> +#ifdef CONFIG_X86_BROADCAST_TLB_FLUSH
> +#define DISABLE_INVLPGB 0
> +#else
> +/* Keep 32 bit kernels smaller by compiling out the INVLPGB code. */

No need for that comment.

> +#define DISABLE_INVLPGB (1 << (X86_FEATURE_INVLPGB & 31))
> +#endif
> +
> /*
> * Make sure to add features to the correct mask
> */

...

> +/* Wait for INVLPGB originated by this CPU to complete. */
> +static inline void __tlbsync(void)
> +{
> + cant_migrate();

I could use a comment above that one...

> + /* TLBSYNC: supported in binutils >= 0.36. */
> + asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory");
> +}
> +

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette