Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/mm: Add a 'noinvpcid' boot option to turn off INVPCID

This adds a chicken bit to turn off INVPCID in case something goes
wrong. It's an early_param() because we do TLB flushes before we
parse __setup() parameters.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/f586317ed1bc2b87aee652267e515b90051af385.1454096309.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andy Lutomirski and committed by
Ingo Molnar
d12a72b8 060a402a

+18
+2
Documentation/kernel-parameters.txt
··· 2566 2566 2567 2567 nointroute [IA-64] 2568 2568 2569 + noinvpcid [X86] Disable the INVPCID cpu feature. 2570 + 2569 2571 nojitter [IA-64] Disables jitter checking for ITC timers. 2570 2572 2571 2573 no-kvmclock [X86,KVM] Disable paravirtualized KVM clock driver
+16
arch/x86/kernel/cpu/common.c
··· 162 162 } 163 163 __setup("nompx", x86_mpx_setup); 164 164 165 + static int __init x86_noinvpcid_setup(char *s) 166 + { 167 + /* noinvpcid doesn't accept parameters */ 168 + if (s) 169 + return -EINVAL; 170 + 171 + /* do not emit a message if the feature is not present */ 172 + if (!boot_cpu_has(X86_FEATURE_INVPCID)) 173 + return 0; 174 + 175 + setup_clear_cpu_cap(X86_FEATURE_INVPCID); 176 + pr_info("noinvpcid: INVPCID feature disabled\n"); 177 + return 0; 178 + } 179 + early_param("noinvpcid", x86_noinvpcid_setup); 180 + 165 181 #ifdef CONFIG_X86_32 166 182 static int cachesize_override = -1; 167 183 static int disable_x86_serial_nr = 1;