Commit e0a0d058 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull cpu hotplug fixes from Thomas Gleixner:
 "Two fixes for the hotplug state machine code:

   - Move the misplaces smb() in the hotplug thread function to the
     proper place, otherwise a half update control struct could be
     observed

   - Prevent state corruption on error rollback, which causes the state
     to advance by one and as a consequence skip it in the bringup
     sequence"

* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu/hotplug: Prevent state corruption on error rollback
  cpu/hotplug: Adjust misplaced smb() in cpuhp_thread_fun()
parents 3243a89d 69fa6eb7
...@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu) ...@@ -607,15 +607,15 @@ static void cpuhp_thread_fun(unsigned int cpu)
bool bringup = st->bringup; bool bringup = st->bringup;
enum cpuhp_state state; enum cpuhp_state state;
if (WARN_ON_ONCE(!st->should_run))
return;
/* /*
* ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures * 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. * that if we see ->should_run we also see the rest of the state.
*/ */
smp_mb(); smp_mb();
if (WARN_ON_ONCE(!st->should_run))
return;
cpuhp_lock_acquire(bringup); cpuhp_lock_acquire(bringup);
if (st->single) { if (st->single) {
...@@ -916,7 +916,8 @@ static int cpuhp_down_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st, ...@@ -916,7 +916,8 @@ static int cpuhp_down_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st,
ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL);
if (ret) { if (ret) {
st->target = prev_state; st->target = prev_state;
undo_cpu_down(cpu, st); if (st->state < prev_state)
undo_cpu_down(cpu, st);
break; break;
} }
} }
...@@ -969,7 +970,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen, ...@@ -969,7 +970,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
* to do the further cleanups. * to do the further cleanups.
*/ */
ret = cpuhp_down_callbacks(cpu, st, target); ret = cpuhp_down_callbacks(cpu, st, target);
if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) {
cpuhp_reset_state(st, prev_state); cpuhp_reset_state(st, prev_state);
__cpuhp_kick_ap(st); __cpuhp_kick_ap(st);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment