cpu/hotplug: Fix acquire of st->should_run in cpuhp_thread_fun()
Subsystems (2)
PATCH 1/1 cpu/hotplug: Fix acquire of st->should_run in cpuhp_thread_fun()
The smp_mb() in cpuhp_thread_fun() appears to be misplaced, and need 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.
--- kernel/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cpu.c +3 -3
@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu)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. */ smp_mb (); -if (WARN_ON_ONCE (!st->should_run)) -return ; -cpuhp_lock_acquire (bringup);if (st->single) {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 4 lines · Neeraj Upadhyay
The
smp_mb()incpuhp_thread_fun()appears to be misplaced, and need to be after the load ofst->should_run, to prevent reordering of the later load/stores w.r.t. the load ofst->should_run.
I'm tempted to say this changelog needs improvement, but given the comment that goes with the smp_mb(), yes this is obviously right.
Quoted 28 lines
Signed-off-by Neeraj Upadhyay <[email protected]>--- kernel/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/cpu.c +3
-3@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu)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. */ smp_mb (); -if (WARN_ON_ONCE (!st->should_run)) -return ; -cpuhp_lock_acquire (bringup);if (st->single) {
tip-bot for Neeraj Upadhyay
merge bot[tip:smp/urgent] cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
In reply to Neeraj Upadhyaycpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
Commit-ID: f8b7530aa0a1def79c93101216b5b17cf408a70a Gitweb: https://git.kernel.org/tip/f8b7530aa0a1def79c93101216b5b17cf408a70a Author: Neeraj Upadhyay <[email protected]> AuthorDate: Wed, 5 Sep 2018 11:22:07 +0530 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 6 Sep 2018 15:21:37 +0200
cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
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.
--- kernel/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/cpu.c +3 -3
@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu)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. */ smp_mb (); -if (WARN_ON_ONCE (!st->should_run)) -return ; -cpuhp_lock_acquire (bringup);if (st->single) {