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 SMT/hotplug related fixes:

- Prevent crash when HOTPLUG_CPU is disabled and the CPU bringup
aborts. This is triggered with the 'nosmt' command line option, but
can happen by any abort condition. As the real unplug code is not
compiled in, prevent the fail by keeping the CPU in zombie state.

- Enforce HOTPLUG_CPU for SMP on x86 to avoid the above situation
completely. With 'nosmt' being a popular option it's required to
unplug the half brought up sibling CPUs (due to the MCE wreckage)
completely"

* 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y
cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n

Changed files
+19 -9
arch
x86
kernel
+1 -7
arch/x86/Kconfig
··· 2217 2217 If unsure, leave at the default value. 2218 2218 2219 2219 config HOTPLUG_CPU 2220 - bool "Support for hot-pluggable CPUs" 2220 + def_bool y 2221 2221 depends on SMP 2222 - ---help--- 2223 - Say Y here to allow turning CPUs off and on. CPUs can be 2224 - controlled through /sys/devices/system/cpu. 2225 - ( Note: power management support will enable this option 2226 - automatically on SMP systems. ) 2227 - Say N if you want to disable CPU hotplug. 2228 2222 2229 2223 config BOOTPARAM_HOTPLUG_CPU0 2230 2224 bool "Set default setting of cpu0_hotpluggable"
+18 -2
kernel/cpu.c
··· 564 564 cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL); 565 565 } 566 566 567 + static inline bool can_rollback_cpu(struct cpuhp_cpu_state *st) 568 + { 569 + if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) 570 + return true; 571 + /* 572 + * When CPU hotplug is disabled, then taking the CPU down is not 573 + * possible because takedown_cpu() and the architecture and 574 + * subsystem specific mechanisms are not available. So the CPU 575 + * which would be completely unplugged again needs to stay around 576 + * in the current state. 577 + */ 578 + return st->state <= CPUHP_BRINGUP_CPU; 579 + } 580 + 567 581 static int cpuhp_up_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st, 568 582 enum cpuhp_state target) 569 583 { ··· 588 574 st->state++; 589 575 ret = cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL); 590 576 if (ret) { 591 - st->target = prev_state; 592 - undo_cpu_up(cpu, st); 577 + if (can_rollback_cpu(st)) { 578 + st->target = prev_state; 579 + undo_cpu_up(cpu, st); 580 + } 593 581 break; 594 582 } 595 583 }