Repository navigation
soc: apple: mailbox: Do not sleep past free FIFO space - #596
RyanTheTide wants to merge 1 commit into
Conversation
A sleeping sender that finds the send FIFO full waits on tx_empty for the send-empty interrupt, and gives up after 500 ms. Two things make it miss free space and time out with room in the FIFO: - The interrupt reports an empty FIFO. A firmware that takes some of the queued messages but not all of them frees space without raising it. - Two senders can wait at once, for example a driver starting its endpoints while the RTKit work item acknowledges a syslog message. The handler masks the interrupt and calls complete(), which wakes only one of them. The other sleeps on with the interrupt masked. A sender that timed out also masked it, stranding any sender still waiting. On the J616s (M4 Pro) this delayed the AOP start on some warm boots. One endpoint start failed 504 ms after it was issued, while the AOP firmware was logging over syslog: 2.891389 aop: ep 0x28 init sent 3.395337 aop: Failed to send management message type 0x05: -110 3.395341 aop: Retrying unsent endpoint start 0x29 3.395354 aop: ep 0x2b init sent 3.402107 aop: syslog message: ... AOP IS READY The retry and the next three requests went out within 20 us, so the FIFO had room when the first send gave up, and the firmware reported ready 7 ms later. In an earlier boot the same stall made an AFK init time out after the firmware had reported ready, and the probe failed. Wake every waiter with complete_all(), and check the FIFO again every 2 ms while waiting, until the same 500 ms deadline. A woken sender that still finds the FIFO full rearms the interrupt before it waits, as before. A sender that times out now leaves the interrupt unmasked for the others. tx_irq_unmasked still records the state, so the enable stays balanced: the handler masks it when it fires, and provider removal masks it otherwise. Atomic senders, which poll, are unchanged. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Boot-tested in fleet10 (7.3.0-aurora-fleet10): integration/aurora 1173b79 plus 587, 588, 589, 590, 596, 599, 600, 601, 603, 604, 605, 607 and 608, built with the shipping recipe (Fedora Asahi base + asahi.config, 0 mismatches, all distro gates). apple-dcp host selftests 80/80, and the other host tests match integration/aurora exactly (62 pass, the same 26 pre-existing failures). One-shot boots on the Neo (J700), the M2 and the M1 Pro, compared with each machine's fleet9 boot; fleet10 is now the default on all three. Full dmesg and journals are in aurora-ctl reports/fleet10-20261030. This commit conflicts with integration/aurora, which has the Result on the machines tested: no regression.
|
|
J616s warm-reboot loop on fleet10 (7.3.0-aurora-fleet10, src 46b7a93f, carries this PR). Wi-Fi ssh, no tether, same pattern as the fleet9 baseline (fast, fast, normal reboots). Each boot was a one-shot GRUB entry with fleet9 kept as the saved default.
All 20 boots came up with gdm active, /dev/sep-bio present, PMP ready, 3 DCPs started and The fleet9 hang at boot 15 is not an AOP or mailbox problem: its journal stops at Per-boot dmesg and journals: 🤖 Generated with Claude Code |
|
Merged into aurora-wip as #630, the same change rebased over the TX wait failed report (mailbox.c and mailbox.h identical to the fleet10 commit 46b7a93f14c0 that passed the Neo, M2, M1 Pro boots and the J616s 20-boot loop). integration/aurora still needs it; the fleet10 resolution applies there as is. 🤖 Generated with Claude Code |
A sleeping sender in
apple_mbox_send()can time out after 500 ms with room in the send FIFO. This is the root cause behind the J616s AOP start stall that #547 bounded.Two ways it misses free space:
complete(), which wakes one waiter. The other sleeps on with the interrupt masked until its timeout. A sender that timed out also masked the interrupt and stranded the rest.Evidence, J616s warm boot (aoploop2 boot 5, 7.3.0-aurora-j616s-aopfix1):
The failed send gave up exactly 500 ms after it was issued. The retry and three more requests then went out within 20 us, so the FIFO had room, and the firmware reported ready 7 ms later. The "slow firmware" in the #547 boot (ready at 370 ms, then an AFK init timing out on a full mailbox) has the same shape. The AOP firmware was emitting syslog messages at that moment, so the RTKit work item was sending acks on the same mailbox.
The change:
complete_all()in the send-empty handler, so every waiter rechecks the FIFO. A waiter that still finds it full rearms the interrupt before waiting, as before.tx_irq_unmaskedstill tracks the state, so enable/disable stays balanced (the handler or provider removal masks it). This keeps the fix for the earlier unbalanced-enable bug intact.struct apple_mboxlayout is unchanged (comment only in the header).Testing:
drivers/soc/apple/mailbox.oandrtkit.obuild with W=1 and no warnings. A full Image+modules build (7.3.0-aurora-mboxwake1) is queued on the buildbox.Failed to send management message,AFK init not sentand the AOP ready time.🤖 Generated with Claude Code