提交 73d5e2b4 编写于 作者: J Josh Poimboeuf 提交者: Peter Zijlstra

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: NJoe Mario <jmario@redhat.com>
Tested-by: NJiri Kosina <jkosina@suse.cz>
Fixes: f048c399 ("x86/topology: Provide topology_smt_supported()")
Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
上级 1949f9f4
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册