lkml.org 
[lkml]   [2020]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC 4/7] x86: cpu: bugs.c: update cpu_smt_disable to be callable at runtime
Date
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
\
 
 \ /
  Last update: 2020-07-02 17:24    [W:0.061 / U:1.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site