diff mbox series

[SRU,Xenial] x86/speculation: Remove redundant arch_smt_update() invocation

Message ID 20190613105628.2609-1-juergh@canonical.com
State New
Headers show
Series [SRU,Xenial] x86/speculation: Remove redundant arch_smt_update() invocation | expand

Commit Message

Juerg Haefliger June 13, 2019, 10:56 a.m. UTC
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>

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 <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <konrad.wilk@oracle.com>
Cc: <dwmw@amazon.co.uk>
Cc: <bp@suse.de>
Cc: <srinivas.eeda@oracle.com>
Cc: <peterz@infradead.org>
Cc: <hpa@zytor.com>
Link: https://lkml.kernel.org/r/e2e064f2-e8ef-42ca-bf4f-76b612964752@default

CVE-2018-12126
CVE-2018-12127
CVE-2018-12130

(cherry picked from commit 34d66caf251df91ff27b24a3a786810d29989eca)
Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 kernel/cpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Kleber Sacilotto de Souza June 26, 2019, 4:44 p.m. UTC | #1
On 6/13/19 12:56 PM, Juerg Haefliger wrote:
> From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> 
> 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 <zhenzhong.duan@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: <konrad.wilk@oracle.com>
> Cc: <dwmw@amazon.co.uk>
> Cc: <bp@suse.de>
> Cc: <srinivas.eeda@oracle.com>
> Cc: <peterz@infradead.org>
> Cc: <hpa@zytor.com>
> Link: https://lkml.kernel.org/r/e2e064f2-e8ef-42ca-bf4f-76b612964752@default
> 
> CVE-2018-12126
> CVE-2018-12127
> CVE-2018-12130
> 
> (cherry picked from commit 34d66caf251df91ff27b24a3a786810d29989eca)
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Juerg,

is this needed for newer series as well?


Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Thank you,
Kleber

> ---
>  kernel/cpu.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 5d48161476a1..d9465123f7ec 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -896,10 +896,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;
>  }
> @@ -910,7 +908,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)))
>
Stefan Bader June 28, 2019, 3:30 p.m. UTC | #2
On 13.06.19 12:56, Juerg Haefliger wrote:
> From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> 
> 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 <zhenzhong.duan@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: <konrad.wilk@oracle.com>
> Cc: <dwmw@amazon.co.uk>
> Cc: <bp@suse.de>
> Cc: <srinivas.eeda@oracle.com>
> Cc: <peterz@infradead.org>
> Cc: <hpa@zytor.com>
> Link: https://lkml.kernel.org/r/e2e064f2-e8ef-42ca-bf4f-76b612964752@default
> 
> CVE-2018-12126
> CVE-2018-12127
> CVE-2018-12130
> 
> (cherry picked from commit 34d66caf251df91ff27b24a3a786810d29989eca)
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---

Likely no, but would be nice to let us know...

>  kernel/cpu.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 5d48161476a1..d9465123f7ec 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -896,10 +896,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;
>  }
> @@ -910,7 +908,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)))
>
Kleber Sacilotto de Souza July 1, 2019, 8:56 a.m. UTC | #3
On 6/13/19 12:56 PM, Juerg Haefliger wrote:
> From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> 
> 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 <zhenzhong.duan@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: <konrad.wilk@oracle.com>
> Cc: <dwmw@amazon.co.uk>
> Cc: <bp@suse.de>
> Cc: <srinivas.eeda@oracle.com>
> Cc: <peterz@infradead.org>
> Cc: <hpa@zytor.com>
> Link: https://lkml.kernel.org/r/e2e064f2-e8ef-42ca-bf4f-76b612964752@default
> 
> CVE-2018-12126
> CVE-2018-12127
> CVE-2018-12130
> 
> (cherry picked from commit 34d66caf251df91ff27b24a3a786810d29989eca)
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>

Applied to xenial/master-next branch.

Thanks,
Kleber

> ---
>  kernel/cpu.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 5d48161476a1..d9465123f7ec 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -896,10 +896,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;
>  }
> @@ -910,7 +908,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)))
>
diff mbox series

Patch

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 5d48161476a1..d9465123f7ec 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -896,10 +896,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;
 }
@@ -910,7 +908,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)))