linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpu/hotplug: Fix rollback during error-out in takedown_cpu()
@ 2018-09-04  6:33 Neeraj Upadhyay
  2018-09-04 12:12 ` Mukesh Ojha
  2018-09-05 11:33 ` Thomas Gleixner
  0 siblings, 2 replies; 14+ messages in thread
From: Neeraj Upadhyay @ 2018-09-04  6:33 UTC (permalink / raw)
  To: tglx, josh, peterz, mingo, jiangshanlai, dzickus, brendan.jackman, malat
  Cc: linux-kernel, sramana, linux-arm-msm, Neeraj Upadhyay

If takedown_cpu() fails during _cpu_down(), st->state is reset,
by calling cpuhp_reset_state(). This results in an additional
increment of st->state, which results in CPUHP_AP_SMPBOOT_THREADS
state being skipped during rollback. Fix this by not calling
cpuhp_reset_state() and doing the state reset directly in
_cpu_down().

Fixes: 4dddfb5faa61 ("smp/hotplug: Rewrite AP state machine core")
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
---
 kernel/cpu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index aa7fe85..9f49edb 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -970,7 +970,14 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
 	 */
 	ret = cpuhp_down_callbacks(cpu, st, target);
 	if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) {
-		cpuhp_reset_state(st, prev_state);
+		/*
+		 * As st->last is not set, cpuhp_reset_state() increments
+		 * st->state, which results in CPUHP_AP_SMPBOOT_THREADS being
+		 * skipped during rollback. So, don't use it here.
+		 */
+		st->rollback = true;
+		st->target = prev_state;
+		st->bringup = !st->bringup;
 		__cpuhp_kick_ap(st);
 	}
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-09-06 13:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-04  6:33 [PATCH] cpu/hotplug: Fix rollback during error-out in takedown_cpu() Neeraj Upadhyay
2018-09-04 12:12 ` Mukesh Ojha
2018-09-05 11:33 ` Thomas Gleixner
2018-09-05 12:09   ` Mukesh Ojha
2018-09-05 13:14     ` Thomas Gleixner
2018-09-05 12:23   ` Thomas Gleixner
2018-09-05 12:51     ` Neeraj Upadhyay
2018-09-05 13:17       ` Thomas Gleixner
2018-09-06  2:56         ` Neeraj Upadhyay
2018-09-06  8:18           ` Thomas Gleixner
2018-09-06  9:00             ` Neeraj Upadhyay
2018-09-05 14:53     ` Sudeep Holla
2018-09-05 15:19       ` Geert Uytterhoeven
2018-09-06 13:52     ` [tip:smp/urgent] cpu/hotplug: Prevent state corruption on error rollback tip-bot for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).