Repository navigation
arm64: spin table: close the holding pen behind each released CPU (deep-sleep wake panic) - #2192
m0d16l14n1 wants to merge 1 commit into
Conversation
|
Tested on J813 as the first commit of #2193 (head 8e270f6 on
|
|
Blockers: 1. The ordering is sound.
HW row: J815 (2 deep sleeps, burst start) and J813 (8 deep sleeps) cover the new path. The smp.c hunk is generic arm64, so also boot one plain spin-table Mac (M1 or M2) on this kernel with all CPUs online. Add the regression line for the J815 run: 0 failed units, 0 SELinux denials, 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
secondary_holding_pen_release is written with a CPU's MPIDR to let it out of the pen and never reset, so after boot it still names the last CPU released. secondary_data.task likewise keeps that CPU's idle task: __cpu_up() only clears it on failure. With the restartable spin table (aurora,rvbar-spin-table) a CPU comes back through the pen whenever the SoC restarts it at its reset vector: after a system sleep's commit, and at the wake. The CPU whose MPIDR is still in the pen walks straight through into secondary_startup, ahead of its own bring-up, and runs secondary_start_kernel() as that CPU with the stale task. The hotplug state machine has not started it, so no STARTING callback runs (no arch timer, no tick device), yet it marks itself online and completes cpu_running, so the real bring-up returns at once. It idles quietly while cpuidle is paused and faults at the first menu_select() after cpuidle_resume(): Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 CPU: 9 UID: 0 PID: 0 Comm: swapper/9 pc : tick_nohz_get_sleep_length+0x68/0xd4 Call trace: tick_nohz_get_sleep_length+0x68/0xd4 (P) menu_select+0x414/0x774 cpuidle_select+0x1c/0x28 do_idle+0x1e8/0x310 cpu_startup_entry+0x34/0x38 secondary_start_kernel+0x198/0x1bc Kernel panic - not syncing: Attempted to kill the idle task! Seen on a J815 (MacBook Air 15" M5) when every core was started at the end of the wake, as macOS does, instead of one by one at its bring-up. Reset the release to INVALID_HWID in the released CPU's cpu_postboot, which runs before complete(&cpu_running), so it can't race with the next bring-up; and again before a suspend's hold and after the wake, before any CPU is started. Clear secondary_data.task after a successful bring-up too, as kernels before 5.x did, so a core that still reaches __secondary_switched without a bring-up of its own waits in __secondary_too_slow instead of running as another CPU. Tested on J815: two real deep sleeps (256 s and 172 s) with all nine secondary cores started together at the wake, all back online, where the same kernel without this change panicked on the first wake. Signed-off-by: Nick <nekreshen@yandex.ru>
3cf4478 to
c5daf57
Compare
|
@RyanTheTide fixed: one human Rebased onto cc14570, and Assisted-by: LLM (Claude:Opus 5.5) |
|
Re-review of c5daf57: No blockers. Earlier point 1 resolved: the commit has one human Signed-off-by and no co-author trailer, and the PR body ends with HW row (still owed): one plain spin-table Mac (M1 or M2) booted on this kernel with all CPUs online, since the smp.c hunk is generic arm64; and the regression line for the J815 run: 0 failed units, 0 SELinux denials, 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
The spin-table holding pen is never closed after a CPU is released. After boot,
secondary_holding_pen_releasestill holds the last CPU's MPIDR, andsecondary_data.taskstill holds its idle task (__cpu_up()only clears it on failure).With the restartable spin table (
aurora,rvbar-spin-table), a CPU comes back through the pen whenever the SoC restarts it at its reset vector: after a sleep's commit, and at the wake. The CPU whose MPIDR is still in the pen goes straight through it, ahead of its own bring-up:secondary_start_kernel()as that CPU, with no STARTING callbacks run, so it has no tick device.menu_select()aftercpuidle_resume().The J815 hit this when every core was started together at the end of the wake, as macOS does (the next PR in this series). The same stale value can let a core through after the commit too, because the pen checks the release before
secondary_pen_deep.Change
INVALID_HWIDincpu_postboot. That runs beforecomplete(&cpu_running), so it can't race with the next bring-up.secondary_data.taskis cleared after a successful bring-up, as before 5.x, so a stray core parks in__secondary_too_slow.Tested on J815 (MacBook Air 15" M5):
integration/auroracc14570:W=1adds no warnings inarch/arm64/kernel/.checkpatch --strictgives one warning, for the quoted oops line in the commit message, which is kept unwrapped.J813 (sithglan, gig3m): 8 deep sleeps with this as the first commit of #2193, in their comments there.
Still owed (HW rows): the
smp.chunk is generic arm64, so one plain spin-table Mac (M1 or M2) booted on this kernel with all CPUs online; and the regression line for the J815 run (0 failed units, 0 SELinux denials, 0 new kernel errors).Part of the J815 bring-up; board results are summarised in #135.
Assisted-by: LLM (Claude:Opus 5.5)