Repository navigation
drm/asahi: g17: discard a collateral blame's render without a lost device - #3573
Conversation
…vice A reason-0 restart on G17P names one queue, and the firmware picks it without knowing whose work hangs the GPU. Since bb68e88 a blame that no evidence confirms (no slot keys, no latched MMU fault, no pass record that names the VM) is collateral the first time: the VM is not found guilty and only a repeat before any of the pair's work retires makes it so. That commit meant the bystander to keep its device. It did not: service() still failed the blamed render with EIO, and a spared command's EIO reaches the VM status (Completion::report), which Borealis reads as a lost device. On the J616s (m4.201, 2026-11-28 23:46:02 UTC, storm chain, gen 8) deqp-vk's memory_model spin held 32 groups on its pair through gens 8 and 9. The firmware blamed t3code's queue 41, whose tiler had started. The keys read 0 and the oldest running render had other VMs' compute beside it, so nothing confirmed or moved the blame. t3code's VM stayed innocent, as designed, but its oldest render failed with EIO and t3code lost its device. Gen 9 blamed another deqp-vk client. Have classify() return the error for the blamed render. Collateral blame fails it with ECANCELED, the error of every other command a recovery discards: it is still never replayed (note_blamed), and its client is not told. Confirmed blame, a repeat, and blame on work whose owner cannot be resolved still fail it with EIO. The recovery log says "unconfirmed: discarding its oldest render" for the collateral case. A real culprit blamed first, without evidence, now keeps submitting until its second blame. The commit above already counted on that extra restart; now it actually happens. The test stand-in now keeps a discarded command out of the status as Completion::report does. A new case replays gen 8 and checks that t3code keeps its device and turns guilty on a repeat. The bystander cases now also check that the client is not told. Without the change, the new case and the m4.179 and retiring-bystander cases fail. Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
|
J616s (M4 Pro): the bystander case passes, up to an unrelated firmware crash. Kernel: our test kernel 7.3.0-m4.202. It carries this PR as Run: 2026-11-29 03:30:23-03:34:15 UTC, as one guarded chain. The #2504 memory_model spin case ran about every 10 s beside the live desktop (Hyprland, quickshell, a chromium-based app, a browser). Results:
On m4.201 without this change, the same chain lost a desktop client at its first unconfirmed blame (gen 8, 22 s in). Caveat: the chain did not finish cleanly. 4 minutes in, the firmware crashed (agx_scheduler) 46 ms after a compute-exit kill of a context whose render pair held guilty work. That crash belongs to a separate firmware-crash investigation, not to this change. Every client, Hyprland included, lost its device at the crash itself, as with any firmware crash. So "no lost device after an unconfirmed blame" is shown for the 4 minutes before the crash, not for a full run. |
|
m4.205 storm run (J616s M4 Pro, three dq-fast passes plus the #2504 memory_model spin, 493 recoveries): I classified every repeat that poisoned a VM. A repeat is an echo when the firmware's guilty record names a render the pair had already published at the earlier, unconfirmed discard. It is new work when the render was published after the discard.
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: MERGE at 6c6c246 on code.
Checked:
- The recovery classifier uses
ECANCELEDfor a collateral discard. Explicit, corroborated, repeated or unresolved blame retains the existingEIOhandling. - The settlement path clears the replay flag for discarded work. Completion of that work keeps the spared VM usable and preserves device-lost reporting for actual hangs.
- The exact-head host and Apple/KUnit checks passed.
Follow-ups:
- Track a repeat blame for render work already discarded in #4369.
RyanTheTide
left a comment
There was a problem hiding this comment.
Approving under the merge gate: the App review passed at 6c6c2466 (adversarial pass by a non-author lane), the real CI is green at this head, and there's a hardware row at this head.
What: A G17P restart whose blame only the firmware gives (no slot keys, no latched MMU fault, no pass record that names the VM) is collateral the first time, so the VM is not found guilty. But the blamed render still failed with EIO. A spared command's EIO reaches the VM status, and Borealis reads that as a lost device, so a desktop client the firmware blamed by mistake lost its device anyway. Now a collateral blame discards that render with ECANCELED, like every other command a recovery discards: it is never replayed, and its client is not told. Confirmed blame, a repeat, and blame on work whose owner can't be resolved still fail with EIO.
Tested: J616s M4 Pro (14-core, 16K pages), on test kernel 7.3.0-m4.202 with this change backported onto main a851ca0 as 05b8830f2d65, not the exact head: the #2504 memory_model spin beside the live desktop, 29 recoveries, 7 unconfirmed firmware blames each logged "unconfirmed: discarding its oldest render", 0 desktop clients lost their device before an unrelated firmware crash 4 min in (result). QEMU arm64 KUnit (asahi kunitconfig) at 6c6c246: 929 run, 928 pass, 1 skip, 0 fail. tools/asahi host tests: no g17 failures (29 failure lines, all outside g17, same as on the base). A mutation that puts collateral back to EIO fails 3 cases: the new gen-8 case, the m4.179 case and the retiring-bystander case.
Risk: two-way door · M4 and M5 (the shared G17 recovery
classify/servicepath). A real culprit that is blamed first without evidence now keeps submitting until its second blame, which costs one more restart. bb68e88 already counted on that restart. An echo blame can still cost a bystander its device: the firmware blames a pair again for its own already-failed, pre-discard groups, and the repeat rule takes that as confirmation (1 of 41 repeat poisons in the m4.205 storm run, a desktop chromium process).Not yet: a hardware run at the exact head on current main. Not run on M5. The echo case is not fixed: in the m4.205 storm run, chromium's pair was blamed at two reason-3 restarts 123 ms apart, both firmware-only. The second blame landed on a group already queued (and already failed) at the first, so the repeat rule poisoned the VM and chromium lost its device. The root fix is being researched: stop the firmware running a pair's already-failed groups after a collateral discard. Until then this PR keeps today's repeat rule. A root fix for the echo is being probed on the M4 Pro: whether its firmware can be stopped from running a pair's already-failed groups. A repeat rule that counts only newer work waits for that probe and ships only with a working fix.
Details
classify()worked out whether the blamed QID was guilty before its collateral check. Soservice()calledsettle_blamed_render(qid, EIO)even when the blame was collateral. The packet is Spared, sofail_while_owned→!discarded(EIO)→VmStatus::report_failure(EIO), which writes the status word the client reads.classify()now returns the error for the blamed render:None: attribution cleared it (unchanged);ECANCELED: the blame is collateral.settle_blamed_renderstill marks the packet blamed (no replay) and fails it through the same pathsettle_cancelled_rendersuses for spared cancelled work;EIO: evidence, a repeat or an earlier guilt confirms the blame, or ownership is unresolved.The collateral mark and the repeat rule (
note_collateral/collateral_before) are unchanged: a pair blamed again before any of its work retires still makes its VM guilty, and only then is its client told.The decision uses only what the firmware and GPU report (slot keys, MMU fault banks, pass records, the recovery table), plus the host's own record of earlier blames. No chip, board or process-name gates.
The
Cascadetest stand-in now fails the blamed render before the listed commands, asservice()does, and keeps a discarded command out of the status asCompletion::reportdoes.Evidence
The case, from the kernel log of one recovery (reason 0) during a dEQP-VK run beside a desktop:
Firmware.render_culpritreturned None because other VMs' compute was in flight.dEQP-VK.memory_model.write_after_read.ext.u64.coherent.atomic_atomic.atomicrmw.queuefamily.payload_local.image.guard_local.physbuffer.frag) held 32 groups on its queue in this restart and the next one. The next restart blamed another deqp-vk client, and the spin case passed.firmware blamed queue 41, failing its oldest render, thenGPU work of a client failed (EIO, reported at g17/completion.rs:1064, client …); the client sees a lost device.New KUnit case:
asahi_g17_recovery_snapshot.the_m4_201_gen_8_bystander_keeps_its_device.