Skip to content

a13: replay immediate IPIs dropped while the destination was busy (port from MakrSas/Inferno) - #58

Merged
dylanneve1 merged 1 commit into
masterfrom
port/a13-ipi-replay
Oct 22, 2026
Merged

dylanneve1 merged 1 commit into
masterfrom
port/a13-ipi-replay

Conversation

@dylanneve1

@dylanneve1 dylanneve1 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Ported from MakrSas/Inferno ios branch, commit 901384f ("a13: recover immediate IPIs dropped while the destination was busy"), by Makr. Commit authorship is kept, and Pyre's trace_apple_a13_ipi_deliver call is kept too.

What it fixes

apple_a13_deliver_ipi drops an immediate fast IPI when the target's one-deep IPI_SR slot is still occupied. Deferred and no-wake IPIs are retried on every IPI_CR tick, but a dropped immediate IPI is never revisited. The sender is now recorded per destination (pendingImmediateIPI), and one recorded sender is replayed from apple_a13_ipi_write_sr when the destination acknowledges.

Expected impact (honest version)

In Pyre the IPI registers are ARM_CP_IO, so they are serialized under the BQL. XNU acknowledges IPI_SR and only then reads its per-CPU signal word, so a coalesced IPI should not lose work. At worst, the replay costs one extra FIQ that finds nothing to do. MakrSas reported early "Spinlock timeout" panics on iOS 16 boots and says this replay fixed them. Scion-Project/scion#51 already ruled out lost fast IPIs, so this is not expected to fix the ~3 s restore stall. It is cheap hardening.

Testing

Android cross build, on the Android emulator. Tested together with #57:

🤖 Generated with Claude Code

…rt from MakrSas/Inferno)

apple_a13_deliver_ipi silently drops an immediate fast IPI when the target
CPU's one-deep IPI_SR slot is still occupied, and nothing revisits that
drop. Deferred and no-wake sends are retried on every IPI_CR tick by
apple_a13_cluster_tick, but an immediate send has nowhere else to go.

The sender is now recorded per destination (pendingImmediateIPI, one bit per
source CPU), and one recorded sender is replayed from apple_a13_ipi_write_sr
as soon as the destination acknowledges and frees its slot.

In Pyre the IPI registers are ARM_CP_IO, so senders and the acknowledging
CPU are already serialized by the BQL, and XNU reads its per-CPU signal word
after acknowledging. A coalesced IPI should therefore not lose work for
XNU. At worst the replay adds one FIQ that finds nothing to do. MakrSas
reported that the drop led to early "Spinlock timeout" panics in iOS 16
boots, and the replay ends that report. Scion issue #51 (the fixed ~3 s
restore stall) already ruled out lost fast IPIs, so this is not expected to
change it.

Ported from MakrSas/Inferno commit 901384f ("a13: recover immediate
IPIs dropped while the destination was busy", branch ios), under the same
licence as the files it touches. Original author: Makr <ngrom33@gmail.com>.
Pyre's trace_apple_a13_ipi_deliver call is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dylanneve1
dylanneve1 merged commit 2c7e0c4 into master Oct 22, 2026
5 checks passed
@dylanneve1
dylanneve1 deleted the port/a13-ipi-replay branch November 2, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants