Skip to content

Commit 73d5e2b

Browse files
jpoimboePeter Zijlstra
authored andcommitted
cpu/hotplug: detect SMT disabled by BIOS
If SMT is disabled in BIOS, the CPU code doesn't properly detect it. The /sys/devices/system/cpu/smt/control file shows 'on', and the 'l1tf' vulnerabilities file shows SMT as vulnerable. Fix it by forcing 'cpu_smt_control' to CPU_SMT_NOT_SUPPORTED in such a case. Unfortunately the detection can only be done after bringing all the CPUs online, so we have to overwrite any previous writes to the variable. Reported-by: Joe Mario <jmario@redhat.com> Tested-by: Jiri Kosina <jkosina@suse.cz> Fixes: f048c39 ("x86/topology: Provide topology_smt_supported()") Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org>
1 parent 1949f9f commit 73d5e2b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/cpu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,15 @@ static const struct attribute_group cpuhp_smt_attr_group = {
21252125

21262126
static int __init cpu_smt_state_init(void)
21272127
{
2128+
/*
2129+
* If SMT was disabled by BIOS, detect it here, after the CPUs have
2130+
* been brought online. This ensures the smt/l1tf sysfs entries are
2131+
* consistent with reality. Note this may overwrite cpu_smt_control's
2132+
* previous setting.
2133+
*/
2134+
if (topology_max_smt_threads() == 1)
2135+
cpu_smt_control = CPU_SMT_NOT_SUPPORTED;
2136+
21282137
return sysfs_create_group(&cpu_subsys.dev_root->kobj,
21292138
&cpuhp_smt_attr_group);
21302139
}

0 commit comments

Comments
 (0)