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()

Changed files
+6 -5
kernel
+6 -5
kernel/cpu.c
··· 607 607 bool bringup = st->bringup; 608 608 enum cpuhp_state state; 609 609 610 + if (WARN_ON_ONCE(!st->should_run)) 611 + return; 612 + 610 613 /* 611 614 * ACQUIRE for the cpuhp_should_run() load of ->should_run. Ensures 612 615 * that if we see ->should_run we also see the rest of the state. 613 616 */ 614 617 smp_mb(); 615 - 616 - if (WARN_ON_ONCE(!st->should_run)) 617 - return; 618 618 619 619 cpuhp_lock_acquire(bringup); 620 620 ··· 916 916 ret = cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); 917 917 if (ret) { 918 918 st->target = prev_state; 919 - undo_cpu_down(cpu, st); 919 + if (st->state < prev_state) 920 + undo_cpu_down(cpu, st); 920 921 break; 921 922 } 922 923 } ··· 970 969 * to do the further cleanups. 971 970 */ 972 971 ret = cpuhp_down_callbacks(cpu, st, target); 973 - if (ret && st->state > CPUHP_TEARDOWN_CPU && st->state < prev_state) { 972 + if (ret && st->state == CPUHP_TEARDOWN_CPU && st->state < prev_state) { 974 973 cpuhp_reset_state(st, prev_state); 975 974 __cpuhp_kick_ap(st); 976 975 }