diff options
author | Jiri Kosina <jkosina@suse.cz> | 2018-07-13 10:23:23 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-07-13 10:29:55 -0400 |
commit | 8e1b706b6e819bed215c0db16345568864660393 (patch) | |
tree | d26ce3c19992b9bd85676bb3bef68c8854acc7d9 /kernel/cpu.c | |
parent | 895ae47f9918833c3a880fbccd41e0692b37e7d9 (diff) |
cpu/hotplug: Expose SMT control init function
The L1TF mitigation will gain a commend line parameter which allows to set
a combination of hypervisor mitigation and SMT control.
Expose cpu_smt_disable() so the command line parser can tweak SMT settings.
[ tglx: Split out of larger patch and made it preserve an already existing
force off state ]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Jiri Kosina <jkosina@suse.cz>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20180713142323.039715135@linutronix.de
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index d79e24df2420..8453e31f2d1a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -347,13 +347,23 @@ EXPORT_SYMBOL_GPL(cpu_hotplug_enable); | |||
347 | enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; | 347 | enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; |
348 | EXPORT_SYMBOL_GPL(cpu_smt_control); | 348 | EXPORT_SYMBOL_GPL(cpu_smt_control); |
349 | 349 | ||
350 | static int __init smt_cmdline_disable(char *str) | 350 | void __init cpu_smt_disable(bool force) |
351 | { | 351 | { |
352 | cpu_smt_control = CPU_SMT_DISABLED; | 352 | if (cpu_smt_control == CPU_SMT_FORCE_DISABLED || |
353 | if (str && !strcmp(str, "force")) { | 353 | cpu_smt_control == CPU_SMT_NOT_SUPPORTED) |
354 | return; | ||
355 | |||
356 | if (force) { | ||
354 | pr_info("SMT: Force disabled\n"); | 357 | pr_info("SMT: Force disabled\n"); |
355 | cpu_smt_control = CPU_SMT_FORCE_DISABLED; | 358 | cpu_smt_control = CPU_SMT_FORCE_DISABLED; |
359 | } else { | ||
360 | cpu_smt_control = CPU_SMT_DISABLED; | ||
356 | } | 361 | } |
362 | } | ||
363 | |||
364 | static int __init smt_cmdline_disable(char *str) | ||
365 | { | ||
366 | cpu_smt_disable(str && !strcmp(str, "force")); | ||
357 | return 0; | 367 | return 0; |
358 | } | 368 | } |
359 | early_param("nosmt", smt_cmdline_disable); | 369 | early_param("nosmt", smt_cmdline_disable); |