All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add tlbi=off to disable INVLPGB
@ 2026-07-30  0:43 Rik van Riel
  2026-07-30  1:44 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Rik van Riel @ 2026-07-30  0:43 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, x86, linux-kernel, kernel-team

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@surriel.com>
Suggested-by: Borislav Petkov <bp@alien8.de>
---
 arch/x86/mm/init_64.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index d57f29ca23a5..412ad9cd5fe2 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -130,6 +130,19 @@ static int __init nonx32_setup(char *str)
 }
 __setup("noexec32=", nonx32_setup);
 
+/*
+ * tlbi=off
+ *
+ * Control AMD TLBI feature (INVLPGB 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);
+
 static void sync_global_pgds_l5(unsigned long start, unsigned long end)
 {
 	unsigned long addr;
-- 
2.53.0-Meta


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] add tlbi=off to disable INVLPGB
  2026-07-30  0:43 [PATCH] add tlbi=off to disable INVLPGB Rik van Riel
@ 2026-07-30  1:44 ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2026-07-30  1:44 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, x86, linux-kernel, kernel-team

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@surriel.com>
> Suggested-by: Borislav Petkov <bp@alien8.de>
> ---
>  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@surriel.com>
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@alien8.de>
Signed-off-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-30  1:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30  0:43 [PATCH] add tlbi=off to disable INVLPGB Rik van Riel
2026-07-30  1:44 ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.