Repository navigation
drm/asahi: recover from G14 firmware 27.2 command timeouts and faults per client - #3041
RyanTheTide wants to merge 3 commits into
Conversation
… per client
When a command runs past its execution allowance or faults, the G14
firmware 27.2 reports it on the event ring (kind 4 timeout with the named
slot at +0xc, kind 0 fault) and stops every queue in a recovery handshake:
it publishes phase 1 at control +0x4c00, advances the u64 generation at
+0x4bf0 and records the stopped work at +0x4298 as {flags, target} pairs.
It runs nothing until the host answers 2 and, at its phase 3, 0. This is
the order G16 and M3 answer in their firmware data.
The runtime decoded neither event. A stuck command stopped the whole GPU
until the host's own timeout failed every client, so a single test client
took the compositor down with it.
Decode both events and answer the handshake. Mark the stopped work: the
published render pair (a render is always published alone) or the oldest
unretired compute command and the rest of its packet. Clear the TPC storage
of a stopped tiler (snapshot flags 0x9) before answering 2, as G16 does.
Then wait for phase 3 with an unchanged generation, answer 0, and wait for
the stopped work to leave its queue. Its stamp is not written, so its
position is what counts. It fails only its own packet and VM, so the client
sees a lost context. Work queued behind it has its clocks restarted and
retires normally. Further recoveries while the work drains are answered up
to four times. If the firmware does not enter recovery, reach phase 3 or
drain, all work fails as before. A host timeout that finds phase 1 without
a seen event takes the same path. A doomed packet records the error in
its VM status even if a racing scheduler timeout claimed its fence first.
The handshake decisions are G16's: which phase the host may answer, how a
snapshot entry decodes and the recovery-storm window (32 in 10 s) come from
its pure, host-tested g16/recovery/logic.rs, included by path rather than
copied. The G14 27.2 record kinds, recovery offsets and the stopped-tiler
rule move to g14_v27_2_abi.rs with host tests
(tools/asahi/g14-v27-2-abi-tests.rs, registered in run-host-tests.py).
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
MERGETRAIN6 source review at Refresh completion state and correlate the stopped entry with the tracked command or packet before reporting a per-client loss. If the firmware information is ambiguous, keep the existing fail-stop behavior for that case. Please add a host fixture covering a completed entry still in the host list ahead of the stopped entry, plus a generation change while recovery drains. The earlier J473 H4 is good precursor evidence for the exercised ownership pattern. Assisted-by: LLM (Codex) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal adversarial pre-PR review bound to head 8da4dbcce37475e5a8b3db8d0e8a37492fb5d093 (stacked on #3031 / m2gpu/g14-v27-2-render ccde92779a5f0c5e52d43e6ae88547b913afea01).
Verdict: REQUEST_CHANGES
The shared g16/recovery/logic.rs reuse via #[path], commit hygiene (§4), and lack of model/board gating (§1/§2) are clean, but there are concrete correctness, memory-safety, and contract blockers in the recovery path plus missing exact-head hardware/CI evidence.
Blockers (§1 Correctness & Safety)
-
Misattribution and false
Ok(())retirement on pipelined compute work (drivers/gpu/drm/asahi/g14_v27_2.rs:894-912, 991-994, 1020-1044, 1123-1188)service_locked()drains the event ring and callsrecover()before callingadvance(state)and retiring already-completed entries at the front ofstate.inflight.blame()ignores both the event'sslotand every decodedSnapshotEntry { flags, event, target }(only logged / checked forstopped_tiler), and blindly marksstate.inflight.first().- When an innocent VM's compute command has already finished on the GPU (still at
inflight[0]beforeadvance()) and a later VM's command times out/faults,blame()dooms the innocent earlier packet,doomed_retired()immediately observesretired_total >= ordinal(Ok(true)),recover()restartsstartedon the actually stopped command,service_locked()kills the innocent VM viafail_doomed(), and the truly stopped command—never markeddoomed—can then leave the queue without a stamp and retire aspacket.retired()(Ok(())). - Additional attribution/state-machine gaps in
recover():self.blame(...)'sboolreturn is ignored (g14_v27_2.rs:993): a halt with nothing published still answers2 -> 3 -> 0and stays healthy instead of correlating against a last-retired target or fail-stopping.if !blamedskipsblame()on rounds1..=FURTHER_RECOVERIES, so a second recovery while draining that stops a different queued command is never markeddoomedand can likewise retire asOk(()).- The drain loop (
g14_v27_2.rs:1020-1039) checks onlyrecovery_phase()? == 1: it does not verify thathalt_count()advanced to a new generation, does not fail-stop on unexpected phases (!= 0 && != 1), and does not checkstate.peer.is_crashed()during the 1 s drain wait.
- Required fix: Refresh/retire completed work before attributing, correlate firmware snapshot
(flags, event, target)/ eventslot/FaultStatusASID against tracked flights (fail-stopping on ambiguity or unmatched entries asg16/engine.rs::recovery_preparedoes), re-attribute on new-generation drain recoveries, and add host-test fixtures covering (a) a completed entry ahead of the stopped entry and (b) a generation change during drain.
-
Undefined Behavior in
Scene::clear_tpc(drivers/gpu/drm/asahi/buffer.rs:204-213)clear_tpc(&self, bytes)creates an immutable slicelet tpc = self.object.tpc.as_slice();(&[u8]fromslice::from_raw_parts,object.rs:688-691, noUnsafeCell) and then writes throughtpc.as_ptr().cast_mut()withcore::ptr::write_bytes. Mutating through a shared&[u8]reference is Rust UB.clear_tpcis also exposed as a safepub(crate)method onScene::veracross all GPU generations even thoughself.object.tpcis a sharedArc<GpuArray<u8>>cached inBufferInner::tpc(buffer.rs:700-717) and relies on an unchecked caller precondition that no concurrent reader/writer exists.- Required fix: Zero through a raw pointer method on
GpuArray<u8>(without fabricating&[u8]) and document/enforce the exclusivity precondition cleanly.
-
Guilty VM is not actually banned from admission (
drivers/gpu/drm/asahi/g14_v27_2.rs:577-589, 676-712, 880-889,m3_submit.rs:288-359)- The PR claims "the guilty VM is latched" and "only that packet and its VM fail", but
fail_doomed()only withdraws the single doomed packet fromstate.pendingand records the error inVmStatus. - Neither
m3_submit::Queue::submit(),mmu::Vm::retain_job(),Runtime::submit(), norRuntime::pump()checksvm.status().get() != 0(compareg16/engine.rs:695). - Consequently, other packets already queued in
state.pendingor the scheduler from the same guilty VM still publish and run after recovery, and a client that submits again without checkingVM_STATUScontinues executing on the GPU. (status.note_recovery_guilty()is also never called.) - Required fix: Reject new submissions and fail/withdraw queued
state.pendingpackets belonging to any VM whoseVmStatusis non-zero (and callstatus.note_recovery_guilty()when blaming a guilty VM).
- The PR claims "the guilty VM is latched" and "only that packet and its VM fail", but
-
Fallback render recovery in
retire_render()strandsstate.rendering(drivers/gpu/drm/asahi/g14_v27_2.rs:864-869)- When
retire_render()hitsCOMMAND_TIMEOUT_MSand findsrecovery_phase()? == 1 && doomed.is_none(), it executesreturn self.recover(state, ETIMEDOUT, -1);. recover()drains TA and FS to completion and returnsOk(()), after whichretire_render()returnsOk(())without takingstate.renderingor callingfail_doomed().service_locked()then callspump(state), which immediately returns becausestate.rendering.is_some(). With TA/FS already retired, no further EP 0x20 interrupt arrives, leaving the doomed fence unsignaled and starving all other clients'state.pendingwork until the 10 s DRM scheduler timeout fireswake().- Required fix: Re-run the retirement check (or loop, as the compute fallback at
g14_v27_2.rs:1174-1180does) afterrecover()returnsOk(())sostate.renderingis taken, slots are retired, andfail_doomed()runs immediately.
- When
-
DMA / resource retirement witness on aborted commands (
drivers/gpu/drm/asahi/g14_v27_2.rs:832-863, 880-889, 1155-1168vsg16/recovery/logic.rs:51-53)- On an aborted (
doomed) command, no completion stamp is written;render_retired()/advance()only proves queue cursor progress. Yetretire_render()andservice_locked()immediately dropRenderFlight/Inflight(releasingVmBind,scene/aux_fb/scene27/tvb_*,preempt), callpacket.release_guard()(allowing immediate user BO unmap/free), and clearstate.busy(allowing pool slot reuse onceregistered(slot)reads 0). - Contrast with the invariant in
g16/recovery/logic.rs:51-53(imported by this PR) andg16/poll.rs:519-524: "A passed abort proves queue progress only and never permits reuse." Either establish and document the exact G1427.2firmware/hardware quiescence guarantee proving that retired-cursor advance after phase3 -> 0guarantees zero further DMA to client BOs,VmBind,scenebuffers, and pool slots, or quarantine aborted slots/guards/owners instead of releasing them.
- On an aborted (
Non-blocking hardening notes
drivers/gpu/drm/asahi/gpu/v27_2.rs:745-761:control_snapshot()slicesself.control.as_slice()[from..]and runsclean_invalidate_poc(at, out.len() * 4)before bounds-checkingfrom + out.len() * 4 <= self.control.len(). Current internal callers are in-bounds, but as apub(crate)fallible helper it should validate the full byte range before slicing/cache-cleaning (likewisecontrol_store()).drivers/gpu/drm/asahi/g14_v27_2.rs:962-1044: Up to1 + FURTHER_RECOVERIES(5) rounds ×(50 ms + 1000 ms + 1000 ms)holdsself.statemutex for up to ~10.25 s, exceeding the 10 s scheduler timeout and blockingsubmit()/withdraw()/sleep_prepare()/stop(). Consider bounding total recovery wall time under the lock.
Checklist Status (§2–§6)
- §2 Scope & No Hacks: PASS — no chip/board/firmware-version gates, no new cmdline/module params, clean
#[path]reuse ofg16/recovery/logic.rs(compiles withoutCONFIG_DRM_ASAHI_G16), no cross-SoC regressions beyondbuffer.rs::clear_tpc(B2). - §3 Docs & PR Body: Needs update once B1/B3 are fixed so "the guilty VM is latched" and per-client isolation match implementation.
- §4 Commit Hygiene: PASS — single commit
8da4dbcce37475e5a8b3db8d0e8a37492fb5d093has human author/committer (Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, and zero AI trailers in commits. - §5 Hardware Evidence: Missing (blocker before merge) — as noted in "Still to run", exact-head J473 (
27.2, without lab encoder-params edits; covering render + compute fault/timeout recovery, innocent context survival, pipelined compute attribution, and repeated fault stress) and J413 (13.5regression tuple) are still required. - §6 Build & CI: 0 CI checks ran on
8da4dbcce37475e5a8b3db8d0e8a37492fb5d093(host-tests.ymlskips stacked basem2gpu/g14-v27-2-render;sep-source.ymlpath filters do not matchdrivers/gpu/drm/asahi/**ortools/asahi/**). Locally verifiedrustc --testong14_v27_2_abi.rs(6/6 pass) andg16/recovery/logic.rs(9/9 pass); arm64 kernelrust-buildand KUnit (asahi_g14_fw_queues) have not yet run on this head.
Assisted-by: LLM (Gemini 4 Neon)
The recovery blamed the first command still in the host's compute list.
That list can hold a command the firmware already completed but the host
has not yet retired, ahead of the one the firmware stopped, so a healthy
client could lose its context while the guilty one carried on.
Each recovery snapshot entry's target is the completion stamp the stopped
command would have written (on the J473: compute stamp 0x7900 written,
entry {0x7, 0x7a00}; tiler stamp 0x2156500 written, entry {0x1f,
0x2156600}). Refresh the retired position, then match every valid entry
against the published render pair's stamps and the unretired compute
commands' stamps. Blame only when all entries of a round name the same
tracked command. A stopped tiler can only be the render pair. Anything
unnamed, mixed or colliding keeps the fail-stop.
Attribute every round, not just the first: work queued behind the first
stopped command can time out while it drains. A further round must carry
a new recovery generation.
The attribution and round rules live in g14_v27_2_abi.rs, with host
tests for a completed entry ahead of the stopped one, render pairs,
ambiguous snapshots and generation changes while draining.
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks, that's a real bug. Fixed in 52166ad, a new commit on top; no force push.
The H3/H4 snapshots each had one entry naming the stopped command's next stamp, so the earlier rows should attribute the same way. A J473 row at this head is still needed. |
|
Re-review of The other open review findings remain in the code. Queue retirement still releases aborted-command state without a separate quiescence witness. The guilty VM still needs admission and pending-queue enforcement, the render timeout fallback still needs to retire and signal the render flight after recovery, and the shared TPC clear still needs a valid exclusive write path. Keep recovery separate from base render qualification while these are addressed. Assisted-by: LLM (Codex) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Focused §1–§6 re-review at exact head 52166ad98c80677784ee2cd77dcb69cf5bf8e1eb (stacked on 8da4dbcce37475e5a8b3db8d0e8a37492fb5d093, no force push). Posting as COMMENT so the existing CHANGES_REQUESTED hold remains active while the remaining code blockers and hardware evidence are still open.
Verification of 52166ad98c80 (Snapshot Attribution & Round Generation Fix)
Resolved: Blocker #1 (stale-front selection / snapshot attribution) is cleanly addressed with no new regressions introduced:
- Already-retired compute entries:
recover()now refreshesstate.retired_totalviaself.advance(state)?before scanning the snapshot and excludes retired entries viaf.ordinal > retired(drivers/gpu/drm/asahi/g14_v27_2.rs:988-1003). An already-completed innocent command sitting atstate.inflight[0]is no longer blamed and retires normally inservice_locked(). - Render pair & stopped-tiler rules:
Attribution::add()matches[TILER, FRAGMENT]completion stamps toStopped::Render, blocksstopped_tiler(flags)(flags & 9 == 9) from attributing compute, and fails closed (ambiguous = true->None->Err(EIO)fail-stop) on empty (0entries), unnamed, mixed, or dual-match snapshots (drivers/gpu/drm/asahi/g14_v27_2_abi.rs:106-138). - Per-round attribution & generation check: Every drain recovery round is now attributed and enforces
new_round(previous, generation)(generation != p, failing withEPROTOon repeat;g14_v27_2.rs:981-986,g14_v27_2_abi.rs:142-147). - Locking & ordering: Runs exclusively under
self.statemutex;recovery_phase(),halt_count(),progress(), andrecovery_entry()each performclean_invalidate_poc+poc_barrier()+Acquireloads while firmware is halted at phase 1 beforeanswer_recovery(2)(Release+clean_poc+poc_barrier()). - Host tests: Re-ran
rustc --test drivers/gpu/drm/asahi/g14_v27_2_abi.rsat52166ad98c80— 10/10 pass.
Remaining Open Blockers (Verified Unchanged at 52166ad98c80)
- Shared TPC clear UB / exclusivity (
drivers/gpu/drm/asahi/buffer.rs:204-213):Scene::clear_tpc(&self, bytes)still fabricates an immutable&[u8]slice (self.object.tpc.as_slice()) and writes throughtpc.as_ptr().cast_mut()viawrite_byteson a sharedArc<GpuArray<u8>>exposed as a safepub(crate)method. - Guilty VM admission & pending-queue enforcement (
drivers/gpu/drm/asahi/g14_v27_2.rs:578-590, 677-713, 881-890):submit()andpump()still do not reject VMs with non-zeroVmStatus,fail_doomed()still only removes the single doomed packet fromstate.pending(leaving other queued packets from the same guilty VM to publish), andstatus.note_recovery_guilty()is still not called. - Render timeout fallback strands
state.rendering(drivers/gpu/drm/asahi/g14_v27_2.rs:865-870): Returningself.recover(state, ETIMEDOUT, -1)directly leavesstate.renderingpopulated afterrecover()drains TA/FS, blockingpump()and leaving the doomed fence unsignaled until a later wakeup/scheduler timeout. - Queue retirement without a separate quiescence witness on aborted commands (
drivers/gpu/drm/asahi/g14_v27_2.rs:833-864, 881-890, 1178-1192vsg16/recovery/logic.rs:51-53): Aborted commands still immediately dropRenderFlight/Inflight, release packet guards, and clearstate.busyon retired-cursor advance alone without either an established G1427.2firmware/hardware quiescence guarantee or quarantine.
Additional Pre-existing Recovery Note (Worth Fixing Alongside the 4 Blockers)
- Unconsumed
EVENT_RINGrecord after multi-round or fallback recovery (drivers/gpu/drm/asahi/g14_v27_2.rs:965-1068, 1146-1157):state.root.drain()(gpu/v27_2.rs:818-834) drains telemetry rings only, notEVENT_RING. If a further recovery round during drain (rounds >= 1), a fallback timeout recovery, or a racing fault+timeout pair leaves an already-answeredTimeout/Faultrecord inEVENT_RING, the nextservice_locked()pass consumes it, callsrecover(), waitsPHASE1_WAIT_MS(50 ms) while firmware is already back at phase 0, and triggersfail_all(ETIMEDOUT)across healthy clients. (Also, the drain loop atg14_v27_2.rs:1043-1062still does not fast-fail on unexpected phases!= 0 && != 1orstate.peer.is_crashed().)
Checklist Status (§1–§6 at 52166ad98c80)
- §1 No model gating: PASS — no chip, SoC, board, or firmware-version gates.
- §2 Production-ready, no hacks: PASS — default kernel cmdline, no sleeps/retries over races, clean shared
g16/recovery/logic.rs. - §3 Safety: OPEN — 4 code blockers above still open.
- §4 Clean-room & attribution: PASS — both commits (
8da4dbcce374,52166ad98c80) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, zero AI trailers in commit messages, and no force push. - §5 Hardware evidence: OPEN — exact-head J473 (
27.2, without lab encoder-params edits) and J413 (13.5regression tuple) runs are still required before merge. - §6 Naming & CI: Naming PASS (Borealis / Aurora conventions). 0 CI check runs / 0 commit statuses ran on
52166ad98c80(stacked basem2gpu/g14-v27-2-render); locally verifiedg14_v27_2_abi.rsunit tests (10/10 pass).
Assisted-by: LLM (Gemini 4 Neon)
Review of the G14 27.2 per-client recovery found these gaps: - A stopped command leaves its queue without a completion stamp. That proves queue progress, not that the GPU no longer reaches its memory, which is the G16 Retirement::Aborted rule. The runtime still released the command's VM job guard, binding and scene. Now the error completion quarantines the guard, and the stopped command's flight (packet, binding, scene) is kept for the rest of the boot, as stop() does for everything. Pool slots are still reused only after the firmware unregisters them. - The guilty VM was not barred from running more work. Blaming now latches its VmStatus (note_recovery_guilty + record) before the work drains. submit() refuses packets of a failed VM, and pump() fails the ones already queued instead of publishing them, as G16 does. - A render timeout that found the firmware in recovery recovered but left the render flight in place. Nothing then signalled its fence or published the queue behind it until the scheduler timeout. Retire it right after the recovery. - Scene::clear_tpc wrote through a shared slice and was available to every GPU generation. It is now an unsafe fn of the G14 27.2 scene only, and zeroes through a raw-pointer GpuArray<u8> helper with its exclusivity precondition stated. - While stopped work drains, a crashed coprocessor or a phase the protocol does not allow now fails the recovery. The whole recovery starts no round after 5 s, so the state lock is released inside the scheduler's job timeout. Control-object reads and writes validate their byte range first. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Thanks for the thorough review. Everything is addressed at f55ae32 (two new commits on top; no force push):
Hardening notes: control-object reads and writes check their byte range before slicing or cache maintenance. Rounds start only within a 5 s budget, so the lock is held for at most about 7 s, inside the 10 s job timeout. Full arm64 build at f55ae32 is OK with 0 warnings in the changed files. ABI host tests pass 10/10. A J473 row at this exact head is next (kit |
|
Independent source review of One resource lifetime issue remains. Please track retained resources under the runtime and bound their cumulative retention. If that limit is reached, use the existing fail-stop path while preserving the DMA guard until a proven quiescent state. Please keep #3041 separate from the fleet cut. The J473 and J413 hardware rows at this head remain separate. Assisted-by: LLM (Codex) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Focused §1–§6 exact-head re-review at f55ae32f692706ff409508610b3a39e969f3f508 (now rebased/retargeted onto integration/aurora after #3031 merged; 3 human-signed commits, no force push).
Verdict: REQUEST_CHANGES
All 4 code blockers from the 52166ad98c80 review and the prior hardening notes are cleanly addressed, and the base branch is now integration/aurora. However, 3 concrete code issues remain in the recovery/quarantine path (including the unconsumed EVENT_RING note and two quarantine-tracking issues), alongside pending CI runs and exact-head §5 J473/J413 hardware evidence.
Cleared Since 52166ad98c80
Scene::clear_tpcUB / exclusivity (object.rs:722-732,buffer.rs:305-308,g14_v27_2_render.rs:86-89,g14_v27_2.rs:1070-1080): Resolved. Moved off genericimpl Scene::veronto#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)] impl SceneG14V13_5asunsafe fn, zeroing directly throughGpuArray<u8>::zero_prefix(self.rawpointer without fabricating&[u8]) with documented# Safetypreconditions satisfied underself.stateduring firmware phase 1 halt. (Tiny non-blocking nit: duplicate summary doc line atg14_v27_2_render.rs:80-81.)- Guilty VM admission & pending-queue enforcement (
g14_v27_2.rs:415-426, 610, 712-716, 943, 955): Resolved.blame()callslatch_guilty()(status.note_recovery_guilty()+status.record(error)) before drain;submit()rejects failed VMs withErr(EIO);pump()fails already-queued packets from failed VMs viastate.fail_publication(&packet, EIO)instead of publishing them. - Render timeout fallback stranding
state.rendering(g14_v27_2.rs:901-907): Resolved.retire_render()now re-invokesself.retire_render(state)immediately afterself.recover(state, ETIMEDOUT, -1)?succeeds (bounded depth 1 sincedoomedis set), takingstate.rendering, retiring slots, signaling the error fence, and unblockingpump(). - Aborted-command guard/flight quarantine (
g14_v27_2.rs:431-433, 891-893, 925-933, 1247-1249): Primary retirement path resolved (fail_doomed()no longer callspacket.release_guard();Packet::finish(Err(err))quarantines theVmJobGuardandquarantine(flight)retains the flight/binding/scene; pool slots reuse only afterCommandPool::registered(slot)reads 0), subject to the two quarantine-lifetime blockers below. - Hardening notes: Resolved.
RootV27_2::control_range()validates byte bounds and 4-byte alignment before slicing/cache maintenance (gpu/v27_2.rs:745-771),RECOVERY_BUDGET_MS(5 s) bounds lock hold time within the 10 s scheduler timeout (g14_v27_2.rs:81, 1018-1021), and the drain loop fast-fails onstate.peer.is_crashed()or unexpected phases viarecovery_logic::action()(g14_v27_2.rs:1110-1121). - Base branch: Retargeted to
integration/aurora.
Remaining Code Blockers (§3 Safety & Correctness)
Runtime::withdraw()can release a quarantinedVmJobGuard(drivers/gpu/drm/asahi/g14_v27_2.rs:621-634,m3_submit.rs:180-188):quarantine(flight)removes the doomed flight fromstate.rendering/state.inflightand callscore::mem::forget(flight), sostate.owns(packet)becomesfalseeven thoughpacket.vm_jobstill holds the quarantinedVmJobGuard.- If a racing DRM scheduler
Job::timed_out()subsequently sees!runtime.healthy()(e.g., on a later failure or duringRuntime::stop()betweenself.healthy.store(false)atg14_v27_2.rs:1346andguard.take()at line1359) and callsruntime.withdraw(&job.packet),withdraw()sees!state.owns(packet)and callspacket.release_guard(), dropping the quarantinedVmJobGuardand allowingdrain_mappings()to unmap the quarantined VM's user pages.
- Unbounded
core::mem::forgetquarantine retention (aligning with#7125073939,drivers/gpu/drm/asahi/g14_v27_2.rs:431-433, 893, 1249):- Because
recovery_logic::admit()resets its counter every 10 s window, slow faults can retainVmBindcontext slots, buffer slots, and scenes indefinitely viacore::mem::forget(flight)with no cumulative cap. - Combined fix for #1 and #2: Track quarantined flights inside
Stateup to a bounded cumulative cap (failing closed viafail_all()when exhausted while keeping guards quarantined), and include quarantined flights instate.owns(packet)(and/or guardPacket::release_guard()against releasing a quarantined guard).
- Because
- Unconsumed
EVENT_RINGrecord after multi-round (rounds >= 1) or fallback timeout recovery (drivers/gpu/drm/asahi/g14_v27_2.rs:905, 1010-1134, 1212-1223, 1266,gpu/v27_2.rs:827-844):- Still open at
f55ae32f6927.state.root.drain()drains telemetry rings only, notEVENT_RING. - When a second recovery round occurs during drain (
rounds >= 1) or when a fallback timeout recovery runs fromretire_render()/ compute timeout afterprocess_events(), firmware'sTimeout/Faultrecord for that already-answered recovery remains unread inEVENT_RING. On the nextservice_locked()wakeup,process_events()consumes that stale record and callsrecover(), which waitsPHASE1_WAIT_MS(50 ms) against phase 0 and triggersfail_all(ETIMEDOUT)across every innocent client. - Fix: Drain/consume stale
Timeout/Faultrecords belonging to the handled recovery (without droppingGroworChannelErrorrecords) or verify recovery phase/generation before escalating a stale event record tofail_all(ETIMEDOUT).
- Still open at
Checklist Status (§1–§6 at f55ae32f6927)
- §1 No model gating: PASS — no chip, SoC, board, or firmware-version gates.
- §2 Production-ready, no hacks: PASS — default kernel cmdline, clean shared
g16/recovery/logic.rs. - §3 Safety: OPEN — 3 code blockers above (
withdraw()guard release on quarantined packet, bounded quarantine tracking inState, and unconsumedEVENT_RINGrecord). - §4 Clean-room & attribution: PASS — all 3 commits (
8da4dbcce374,52166ad98c80,f55ae32f6927) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>), humanSigned-off-by:, 0 AI commit trailers, no force pushes. - §5 Hardware evidence: OPEN — exact-head J473 (
27.2, default cmdline, without lab encoder-params edits) and J413 (13.5regression tuple: 0 SELinux denials, 0 failed units, 0 new kernel errors) runs are still pending. - §6 Naming & CI: Naming PASS (Borealis / Aurora conventions; zero forbidden naming in diff/PR body). Base is now
integration/aurora, but 0 CI check runs / 0 commit statuses have executed onf55ae32f6927yet. Locally verifiedrustc --test drivers/gpu/drm/asahi/g14_v27_2_abi.rs(10/10 pass) andrustc --test drivers/gpu/drm/asahi/g16/recovery/logic.rs(9/9 pass).
Assisted-by: LLM (Gemini 4 Neon)
|
J473 row at the exact head f55ae32 passes. Our own traces; default cmdline; GNOME on both monitors with a bystander glxgears; same repro as H4 but no lab changes.
A first attempt ran the runner's default three s2idle cycles on the lab Stage 2 and reset during the second, before the repro, so it gave no recovery result. That Stage 2 has no #2953 fix. Still open: the J413 regression row, and CI on the integration base. |
|
Proposal for the remaining retention finding at
Smallest bound I can see: a per-boot count of doomed flights, checked in
Sketch// g14_v27_2_abi.rs (host-tested with the other ABI rules)
/// Stopped commands one boot may keep (`quarantine`): each pins a VM binding (a user UAT
/// context) and, for render, a scene. Half the user contexts, so innocent clients keep the rest.
pub(crate) const QUARANTINE_LIMIT: u32 = 31;
/// Whether `more` newly stopped commands still fit next to the `kept` ones.
pub(crate) const fn quarantine_fits(kept: u32, more: u32) -> bool {
match kept.checked_add(more) { Some(total) => total <= QUARANTINE_LIMIT, None => false }
}
#[test]
fn quarantine_is_bounded_per_boot() {
assert!(quarantine_fits(0, 1));
assert!(quarantine_fits(QUARANTINE_LIMIT - 1, 1));
assert!(!quarantine_fits(QUARANTINE_LIMIT, 1));
assert!(!quarantine_fits(QUARANTINE_LIMIT - 1, 2));
assert!(!quarantine_fits(u32::MAX, 1));
assert!(quarantine_fits(QUARANTINE_LIMIT, 0)); // a re-named, already doomed packet
}// g14_v27_2.rs
const _: () = assert!(g14_v27_2_abi::QUARANTINE_LIMIT as usize <= mmu::UAT_USER_CTX / 2);
// (mmu::UAT_USER_CTX becomes pub(crate))
struct State {
// ...
/// Commands doomed by a recovery this boot; each is kept until shutdown (`quarantine`).
quarantined: u32,
}
fn blame(&self, state: &mut State, error: Error, slot: i32, work: Stopped) -> Result {
match work {
Stopped::Render => {
let Some(flight) = state.rendering.as_mut() else { return Err(EIO); };
let more = u32::from(flight.doomed.is_none());
if !g14_v27_2_abi::quarantine_fits(state.quarantined, more) {
return self.quarantine_spent(state);
}
state.quarantined += more;
flight.doomed = Some(error);
// ... unchanged
}
Stopped::Compute(stamp) => {
let Some(packet) = /* unchanged */ else { return Err(EIO); };
let more = state.inflight.iter()
.filter(|f| Arc::ptr_eq(&f.packet, &packet) && f.doomed.is_none())
.count() as u32;
if !g14_v27_2_abi::quarantine_fits(state.quarantined, more) {
return self.quarantine_spent(state);
}
state.quarantined += more;
// ... unchanged: mark doomed, latch_guilty, log
}
}
Ok(())
}
/// Recovery would keep more stopped work than one boot may: fail all work instead (the
/// caller's fail-all path keeps published work owned, as before recovery existed).
fn quarantine_spent(&self, state: &State) -> Result {
dev_err!(self.dev, "GPU: {} stopped commands kept this boot; not recovering more\n",
state.quarantined);
Err(EIO)
}Hardware check: the existing H5 repro, run 32 times in one boot (spaced more than 10 s apart, so the storm limit never trips). The first 31 recover per client. The next one fails all work with the new message and 0 Oops, and the host stays up. This does not address the separate Assisted-by: LLM (Claude:Opus 5.5 via Antigravity) |
|
Merge readiness at
Areas: Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels. |
1 similar comment
|
Merge readiness at
Areas: Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels. |
|
Merge readiness at
Areas: Updated by pr-readiness on every push, edit and review, and every 30 minutes. Rules: merge policy · labels. |
|
Code review of head 1. Unread
|
What: When a command runs past its allowance or faults, the G14 firmware 27.2 reports it on the event ring (kind 4 timeout, kind 0 fault) and stops every queue until the host answers its recovery handshake: generation +0x4bf0, phase +0x4c00 (1 -> 2 -> 3 -> 0), snapshot of the stopped work at +0x4298. The 27.2 runtime ignored both events. One stuck client therefore stalled the GPU until the host timeout failed every client, taking gnome-shell down with it. This change answers the handshake and fails only the client that owns the stopped command.
Tested: J473 (M2 mini, firmware 27.2) at
f55ae32f(row H5), default cmdline, GNOME on both monitors with a bystander glxgears:The host tests pass 10/10.
Risk: two-way · only Macs running the G14 firmware 27.2 runtime (J473 today). The handshake decisions are G16's existing
g16/recovery/logic.rs, included by path; no g15/g16 file is changed.Not yet:
main.Details
Retirement::Abortedrule: its VM job guard stays quarantined, and its flight (packet, binding, scene) is kept for the rest of the boot. Pool slots are reused only after the firmware unregisters them.submit()refuses it, andpump()fails its queued packets.GpuArray<u8>::zero_prefix(unsafe, precondition stated) before the host answers 2.52166ad9andf55ae32f.Evidence
Our own traces,
traces/gpu/20261124-m2gpu-hang/:20261124-190100-j473-h5): exact head, as above.