x86/speculation: Remove redundant arch_smt_update() invocation [Linux 5.0]

This Linux kernel change "x86/speculation: Remove redundant arch_smt_update() invocation" is included in the Linux 5.0 release. This change is authored by Zhenzhong Duan <zhenzhong.duan [at] oracle.com> on Thu Jan 17 02:10:59 2019 -0800. The commit for this change in Linux stable tree is 34d66ca (patch).

x86/speculation: Remove redundant arch_smt_update() invocation

With commit a74cfffb03b7 ("x86/speculation: Rework SMT state change"),
arch_smt_update() is invoked from each individual CPU hotplug function.

Therefore the extra arch_smt_update() call in the sysfs SMT control is
redundant.

Fixes: a74cfffb03b7 ("x86/speculation: Rework SMT state change")
Signed-off-by: Zhenzhong Duan <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 kernel/cpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 91d5c38..c0c7f64 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2090,10 +2090,8 @@ static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
         */
        cpuhp_offline_cpu_device(cpu);
    }
-   if (!ret) {
+   if (!ret)
        cpu_smt_control = ctrlval;
-       arch_smt_update();
-   }
    cpu_maps_update_done();
    return ret;
 }
@@ -2104,7 +2102,6 @@ static int cpuhp_smt_enable(void)

    cpu_maps_update_begin();
    cpu_smt_control = CPU_SMT_ENABLED;
-   arch_smt_update();
    for_each_present_cpu(cpu) {
        /* Skip online CPUs and CPUs on offline nodes */
        if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))

Leave a Reply

Your email address will not be published. Required fields are marked *