[PATCH 4.18 035/158] cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()

From: Greg Kroah-Hartman
Date: Mon Sep 17 2018 - 19:10:57 EST

4.18-stable review patch. If anyone has any objections, please let me know.


From: Neeraj Upadhyay <neeraju@xxxxxxxxxxxxxx>

commit f8b7530aa0a1def79c93101216b5b17cf408a70a upstream.

The smp_mb() in cpuhp_thread_fun() is misplaced. It needs to be after the
load of st->should_run to prevent reordering of the later load/stores
w.r.t. the load of st->should_run.

Fixes: 4dddfb5faa61 ("smp/hotplug: Rewrite AP state machine core")
Signed-off-by: Neeraj Upadhyay <neeraju@xxxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxx>
Cc: josh@xxxxxxxxxxxxxxxx
Cc: peterz@xxxxxxxxxxxxx
Cc: jiangshanlai@xxxxxxxxx
Cc: dzickus@xxxxxxxxxx
Cc: brendan.jackman@xxxxxxx
Cc: malat@xxxxxxxxxx
Cc: mojha@xxxxxxxxxxxxxx
Cc: sramana@xxxxxxxxxxxxxx
Cc: linux-arm-msm@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
Link: https://lkml.kernel.org/r/1536126727-11629-1-git-send-email-neeraju@xxxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

kernel/cpu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -608,15 +608,15 @@ static void cpuhp_thread_fun(unsigned in
bool bringup = st->bringup;
enum cpuhp_state state;

+ if (WARN_ON_ONCE(!st->should_run))
+ return;
* ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures
* that if we see ->should_run we also see the rest of the state.

- if (WARN_ON_ONCE(!st->should_run))
- return;

if (st->single) {