Re: [PATCH] add tlbi=off to disable INVLPGB
From: Borislav Petkov
Date: Wed Jul 29 2026 - 21:44:55 EST
On Wed, Jul 29, 2026 at 08:43:41PM -0400, Rik van Riel wrote:
> With the recently found INVLPGB / TLBSYNC issue, there has been some
> interest in disabling invlpgb TLB flushing, in order to rule out
> that CPU issue as a cause of userspace crashes.
>
> The top search result shows "clearcpuid=invlpgb"
>
> However, invlpgb is not actually in x86_cap_flags, so booting with
> clearcpuid=invlpgb results in an error message:
>
> clearcpuid: unknown CPU flag: invlpgb
>
> Add a kernel commandline option to turn off AMD TLBI, to make it
> easier to rule out INVLPGB as a cause of userspace crashes.
>
> Verified by booting a Bergamo system with tlbi=off and checking
> that the INVLPGB bit is clear in boot_cpu_data.x86_capability
>
> Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
> Suggested-by: Borislav Petkov <bp@xxxxxxxxx>
> ---
> arch/x86/mm/init_64.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
I'll take that and raise you with v2:
The rationale for moving it to amd.c is that it won't be there on builds which
don't enable AMD code. And we could still raise it up somewhere
vendor-agnostic later if the other vendor wants to be able to disable their
version if TLB invalidation glue implementation.
From: Rik van Riel <riel@xxxxxxxxxxx>
Date: Wed, 29 Jul 2026 20:43:41 -0400
Subject: [PATCH] x86/CPU/AMD: Add a tlbi= cmdline switch
With the recently found INVLPGB / TLBSYNC issue, there has been some
interest in disabling INVLPGB-based TLB flushing, in order to rule out
that CPU issue as a cause of userspace crashes.
Add a kernel command line option to control AMD TLBI.
[ bp: Rewrite commit message, move to amd.c, add documentation. ]
Suggested-by: Borislav Petkov <bp@xxxxxxxxx>
Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Link: https://patch.msgid.link/20260729204341.3eb0b5ea@fangorn
---
Documentation/admin-guide/kernel-parameters.txt | 5 +++++
arch/x86/kernel/cpu/amd.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 87bb1fb31696..4e3c5fa411d2 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -7568,6 +7568,11 @@ Kernel parameters
See Documentation/admin-guide/mm/transhuge.rst for more
details.
+ tlbi= [X86-64]
+ Format: {off}
+ Control the AMD TLBI feature support (INVLPGB-based
+ TLB flushing).
+
topology= [S390,EARLY]
Format: {off | on}
Specify if the kernel should make use of the cpu
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 54e14ed276b5..a3cde941a81d 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1440,3 +1440,13 @@ static __init int print_dmi_agesa(void)
return 0;
}
late_initcall(print_dmi_agesa);
+
+/* Control TLBI feature (INVLPGB-based TLB flushing) */
+static int __init tlbi_setup(char *str)
+{
+ if (!strcmp(str, "off"))
+ setup_clear_cpu_cap(X86_FEATURE_INVLPGB);
+
+ return 1;
+}
+__setup("tlbi=", tlbi_setup);
--
2.53.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette