]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/CPU: Add a tlbi= cmdline switch
authorRik van Riel <riel@surriel.com>
Thu, 6 Aug 2026 15:54:57 +0000 (08:54 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 10 Aug 2026 14:09:18 +0000 (07:09 -0700)
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 the TLB flushing behavior.

If the need arises, we will add a "tlbi=broadcast" for the case when TLB
invalidation broadcasts need to be explicitly selected, but this is not
needed now yet.

  [ bp: Rewrite commit message, move to cpu/common.c, add documentation. ]

Fixes: 767ae437a32d ("x86/mm: Add INVLPGB feature and Kconfig entry")
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>
Cc: <stable@kernel.org>
Link: https://patch.msgid.link/20260729204341.3eb0b5ea@fangorn
Documentation/admin-guide/kernel-parameters.txt
arch/x86/kernel/cpu/common.c

index 3d35270dddefc519541727bf088df513d444b212..e8ff36982d97bc23847a570d4fec0a11523fab49 100644 (file)
@@ -7568,6 +7568,10 @@ Kernel parameters
                        See Documentation/admin-guide/mm/transhuge.rst for more
                        details.
 
+       tlbi=           [X86-64]
+                       Format: {ipi}
+                       ipi: switch to IPI-based TLB flushing
+
        topology=       [S390,EARLY]
                        Format: {off | on}
                        Specify if the kernel should make use of the cpu
index a3df21d26460606ae502d2108202e2c7a774f0f4..a3caddd411ec6869b2863a42268d5478793be071 100644 (file)
@@ -2664,3 +2664,13 @@ void __init arch_cpu_finalize_init(void)
         */
        mem_encrypt_init();
 }
+
+/* Control TLB flushing methods */
+static int __init tlbi_setup(char *str)
+{
+       if (!strcmp(str, "ipi"))
+               setup_clear_cpu_cap(X86_FEATURE_INVLPGB);
+
+       return 1;
+}
+__setup("tlbi=", tlbi_setup);