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()
This commit is contained in:
commit
e0a0d05848
11
kernel/cpu.c
11
kernel/cpu.c
|
@ -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) {
|
||||
|
@ -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);
|
||||
if (ret) {
|
||||
st->target = prev_state;
|
||||
undo_cpu_down(cpu, st);
|
||||
if (st->state < prev_state)
|
||||
undo_cpu_down(cpu, st);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -969,7 +970,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
|
|||
* to do the further cleanups.
|
||||
*/
|
||||
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_kick_ap(st);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue