Messages in this thread Patch in this message | | | From | Mihai Carabas <> | Subject | [PATCH RFC 4/7] x86: cpu: bugs.c: update cpu_smt_disable to be callable at runtime | Date | Thu, 2 Jul 2020 18:18:24 +0300 |
| |
If the microcode late loading and bug mitigation logic needs to turn off SMT, it must use the hot plug infrastructure, not the boot time call "cpu_smt_disable".
Update "cpu_smt_disable" to use the hot plug infrastructure to turn off SMT when the system is in state running.
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com> --- kernel/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/kernel/cpu.c b/kernel/cpu.c index fe67a01..719670f 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -393,9 +393,25 @@ void __weak arch_smt_update(void) { } void cpu_smt_disable(bool force) { + int ret; + if (!cpu_smt_possible()) return; + if (system_state == SYSTEM_RUNNING) { + if (force) + ret = cpuhp_smt_disable(CPU_SMT_FORCE_DISABLED); + else + ret = cpuhp_smt_disable(CPU_SMT_DISABLED); + + /* If SMT disable did not succeed, print a warning*/ + if (ret) + pr_warn("SMT: not disabled %d\n", ret); + else + pr_info("SMT:%s disabled\n", force ? " Force" : ""); + return; + } + if (force) { pr_info("SMT: Force disabled\n"); cpu_smt_control = CPU_SMT_FORCE_DISABLED; -- 1.8.3.1
| |