linux/arch
Vitaly Kuznetsov 8cdddd182b ACPI: processor: Fix CPU0 wakeup in acpi_idle_play_dead()
Commit 496121c021 ("ACPI: processor: idle: Allow probing on platforms
with one ACPI C-state") broke CPU0 hotplug on certain systems, e.g.
I'm observing the following on AWS Nitro (e.g r5b.xlarge but other
instance types are affected as well):

 # echo 0 > /sys/devices/system/cpu/cpu0/online
 # echo 1 > /sys/devices/system/cpu/cpu0/online
 <10 seconds delay>
 -bash: echo: write error: Input/output error

In fact, the above mentioned commit only revealed the problem and did
not introduce it. On x86, to wakeup CPU an NMI is being used and
hlt_play_dead()/mwait_play_dead() loops are prepared to handle it:

	/*
	 * If NMI wants to wake up CPU0, start CPU0.
	 */
	if (wakeup_cpu0())
		start_cpu0();

cpuidle_play_dead() -> acpi_idle_play_dead() (which is now being called on
systems where it wasn't called before the above mentioned commit) serves
the same purpose but it doesn't have a path for CPU0. What happens now on
wakeup is:
 - NMI is sent to CPU0
 - wakeup_cpu0_nmi() works as expected
 - we get back to while (1) loop in acpi_idle_play_dead()
 - safe_halt() puts CPU0 to sleep again.

The straightforward/minimal fix is add the special handling for CPU0 on x86
and that's what the patch is doing.

Fixes: 496121c021 ("ACPI: processor: idle: Allow probing on platforms with one ACPI C-state")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: 5.10+ <stable@vger.kernel.org> # 5.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-04-01 13:37:55 +02:00
..
alpha io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
arc arch: setup PF_IO_WORKER threads like PF_KTHREAD 2021-02-21 17:25:22 -07:00
arm ARM: SoC fixes for v5.12 2021-03-26 11:19:38 -07:00
arm64 ARM: SoC fixes for v5.12 2021-03-26 11:19:38 -07:00
csky ftrace: Fix spelling mistake "disabed" -> "disabled" 2021-03-16 21:19:40 -07:00
h8300 arch: setup PF_IO_WORKER threads like PF_KTHREAD 2021-02-21 17:25:22 -07:00
hexagon io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
ia64 ia64: fix format strings for err_inject 2021-03-25 09:22:55 -07:00
m68k m68k: Fix virt_addr_valid() W=1 compiler warnings 2021-03-06 14:15:07 +01:00
microblaze io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
mips MIPS: vmlinux.lds.S: Fix appended dtb not properly aligned 2021-03-16 22:53:08 +01:00
nds32 io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
nios2 io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
openrisc io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
parisc arch/parisc/kernel: remove duplicate include in ptrace 2021-03-04 09:12:29 +01:00
powerpc powerpc: Force inlining of cpu_has_feature() to avoid build failure 2021-03-14 20:32:24 +11:00
riscv riscv: Correct SPARSEMEM configuration 2021-03-16 22:15:21 -07:00
s390 s390/pci: fix leak of PCI device structure 2021-03-15 19:10:56 +01:00
sh io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
sparc Merge git://git.kernel.org:/pub/scm/linux/kernel/git/davem/sparc 2021-03-09 17:08:41 -08:00
um io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
x86 ACPI: processor: Fix CPU0 wakeup in acpi_idle_play_dead() 2021-04-01 13:37:55 +02:00
xtensa io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
.gitignore
Kconfig kbuild: remove LLVM=1 test from HAS_LTO_CLANG 2021-03-11 14:52:55 +09:00