Skip to content

Commit

Permalink
cpu/hotplug: detect SMT disabled by BIOS
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Jiri Kosina <[email protected]>
Fixes: f048c39 ("x86/topology: Provide topology_smt_supported()")
Signed-off-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
  • Loading branch information
jpoimboe authored and Peter Zijlstra committed Jul 24, 2018
1 parent 1949f9f commit 73d5e2b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,15 @@ static const struct attribute_group cpuhp_smt_attr_group = {

static int __init cpu_smt_state_init(void)
{
/*
* If SMT was disabled by BIOS, detect it here, after the CPUs have
* been brought online. This ensures the smt/l1tf sysfs entries are
* consistent with reality. Note this may overwrite cpu_smt_control's
* previous setting.
*/
if (topology_max_smt_threads() == 1)
cpu_smt_control = CPU_SMT_NOT_SUPPORTED;

return sysfs_create_group(&cpu_subsys.dev_root->kobj,
&cpuhp_smt_attr_group);
}
Expand Down

0 comments on commit 73d5e2b

Please sign in to comment.