]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early
authorThomas Gleixner <tglx@linutronix.de>
Fri, 13 Jul 2018 14:23:24 +0000 (16:23 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 8 Aug 2018 12:08:07 +0000 (14:08 +0200)
The CPU_SMT_NOT_SUPPORTED state is set (if the processor does not support
SMT) when the sysfs SMT control file is initialized.

That was fine so far as this was only required to make the output of the
control file correct and to prevent writes in that case.

With the upcoming l1tf command line parameter, this needs to be set up
before the L1TF mitigation selection and command line parsing happens.

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.121795971@linutronix.de
CVE-2018-3620
CVE-2018-3646

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
arch/x86/kernel/cpu/bugs.c
include/linux/cpu.h
kernel/cpu.c

index 2cfa599d7b6eaa3d1bfd5adabbb8c1558208014a..c4e896dc8ddb960a20bd645023f3d229a14727ad 100644 (file)
@@ -58,6 +58,12 @@ void __init check_bugs(void)
 {
        identify_boot_cpu();
 
+       /*
+        * identify_boot_cpu() initialized SMT support information, let the
+        * core code know.
+        */
+       cpu_smt_check_topology();
+
        if (!IS_ENABLED(CONFIG_SMP)) {
                pr_info("CPU: ");
                print_cpu_info(&boot_cpu_data);
index c9b23ad27b3897025a9c7c4923bc27ee371c975c..ccdf3a67ce5621e15aae3b5cba5444316b07cf57 100644 (file)
@@ -178,9 +178,11 @@ enum cpuhp_smt_control {
 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
 extern enum cpuhp_smt_control cpu_smt_control;
 extern void cpu_smt_disable(bool force);
+extern void cpu_smt_check_topology(void);
 #else
 # define cpu_smt_control               (CPU_SMT_ENABLED)
 static inline void cpu_smt_disable(bool force) { }
+static inline void cpu_smt_check_topology(void) { }
 #endif
 
 #endif /* _LINUX_CPU_H_ */
index 1ec89eb55097151260adf34b1813aecf6059517f..be5af5723e2bb3c109499ef5f10ac2983c169d02 100644 (file)
@@ -365,6 +365,16 @@ void __init cpu_smt_disable(bool force)
        }
 }
 
+/*
+ * The decision whether SMT is supported can only be done after the full
+ * CPU identification. Called from architecture code.
+ */
+void __init cpu_smt_check_topology(void)
+{
+       if (!topology_smt_supported())
+               cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
+}
+
 static int __init smt_cmdline_disable(char *str)
 {
        cpu_smt_disable(str && !strcmp(str, "force"));
@@ -2127,9 +2137,6 @@ static const struct attribute_group cpuhp_smt_attr_group = {
 
 static int __init cpu_smt_state_init(void)
 {
-       if (!topology_smt_supported())
-               cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
-
        return sysfs_create_group(&cpu_subsys.dev_root->kobj,
                                  &cpuhp_smt_attr_group);
 }