Repository navigation
drm/asahi: g16: fall back to extended render tiers when tier-0 slots are quarantined - #4185
Conversation
…are quarantined A firmware recovery quarantines the render pass slots of the work it aborts until the next boot. A fresh VM learns only whether a base slot is quarantined, one bit, and answers it by backing Tier 0 (slots 0..8). Once all of those are quarantined too, the engine finds nothing it could ever claim among the VM's slots and cancels its job (ECANCELED), although Tiers 1 to 3 (slots 8..48) have free slots. On a J516s with 15 of 48 slots quarantined and 32 reusable, every new single-pass render client failed that way. Give SUBMIT the mask of quarantined render slots instead of the bit, as it already has for PB slots, and back the smallest tier whose slots outside the mask cover the live passes, this submission and one displacement slot. Where no tier covers them, back the one with the most, so a VM never grows into a tier that has none. Nothing changes while no slot is quarantined, and the PB heap still follows the VM's own demand. A quarantined slot stays quarantined: the mask is only read, and the slot ledger is unchanged. Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
The render tier selection counts usable slots across all 48 positions while leaving the quarantine ledger and slot claims alone. The zero-mask path keeps the previous target, and the healthy count cannot choose a smaller tier. The host tests cover an exhausted first tier, mixed masks and full exhaustion. Hardware qualification remains pending.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Independent review of cc7c4893660f by a reviewing agent that didn't write it. No code blocker. Not mergeable yet because no hardware run exists.
Checked
- A quarantined slot can't be reused. The mask is read-only capacity accounting.
Lifetime::available()is false forQuarantined,claim()goes through it, andcancel(),publish_on()andretire()each need a state a quarantined slot can't be in.quarantine()is the only writer of that state and nothing writes it back. The ledger is created once with the firmware object, so its mask starts empty and only grows. - The render and compute masks stay apart. They are separate fields (
AtomicU64andAtomicU32) filled from separate ledgers.as u32on the compute mask loses nothing: 24 units. - All three places that quarantine slots publish the new mask afterwards (
poll.rstwice,engine.rsonce). - No quarantine, no change: the new step returns its input for mask 0. A target the VM already has is never lowered.
- T8132, T6030 and T8122 all use this path (
resources.rshas no chip check), so G16 is affected as well as G15.
Run on the merge with main dbfe45ac89b6 (Ubuntu 24.04 CI image): asahi-m4 1/1, g16 2/2. Main's commits since the base touch none of these files, so your arm64 build of this head stands.
Left before merge
- J516s (T6030): a run that reaches a quarantined tier 0 (at least 8 quarantined render slots,
render_ownersin debugfs), then a new single-pass client renders instead ofECANCELED. - J773g (T8132): a no-regression run at this head (gpubench render rows, CTS smoke,
render_ownersquarantined 0, 0 recoveries). The normal path is shared, so a second generation is owed.
Small note: the storage for the quarantined Tier 0 is real memory cost (55 MiB) but only after recoveries.
|
J516s (Apple MacBook Pro 16-inch, M3 Pro,
|
|
Keeping this PR in draft until the two remaining hardware rows run. What is left before leaving draft
Merge status
|
|
J773g (Apple Mac mini M4, T8132, G16G B0, os-fw 27.2, 24 GB RAM) no-regression hardware row for head
|
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merged as
The body now lists both hardware rows. Still open: the fallback path on hardware (8 or more quarantined render slots on a J516s). |
What: After enough firmware recoveries quarantine render pass slots 0 to 7, every new single-pass render client fails with
ECANCELED, although slots 8 to 47 have free slots. A fresh VM only learns "a base slot is quarantined" (one bit), backs Tier 0 (slots 0..8), and the engine then finds nothing in those slots it could ever claim. Pass the mask of quarantined render slots instead, as PB slots already do, and back the smallest tier that has enough slots outside it. See aurora-silicon/mesa#1585.A faulted slot stays quarantined. The mask is only read; the slot ledger (
Lifetime), claim, pick and quarantine code is unchanged. The new test checks at its end that all 8 slots are still quarantined and still refuse a claim.Tested: J773g (M4 mini, T8132) at this head merged with main: vulkaninfo, gpubench 14 of 14, Vulkan CTS 15 of 15, 0 quarantined slots, 0 recoveries (row). J516s (M3 Pro, T6030) at this head: 0 recoveries and 0 quarantined slots after 113k+ CTS cases (row). Host tests (failing before, passing after) and the arm64 W=1 build of
drivers/gpu/drm/asahi/pass, also on the merge with mainebfc4f60bdd1(Evidence).Risk: two-way · M3, M3 Pro, M4 (the GPUs on the g16 runtime). Nothing changes while no render slot is quarantined.
Not yet: the fallback itself on hardware. It needs at least 8 quarantined render slots; the one J516s attempt hit a firmware fail-stop on its first fault, before any slot was quarantined. So far the fallback has run only in the host tests.
Details
Root cause. Seen on a J516s after 11 recoveries:
render_owners: retired 33 quarantined 15 reusable 32, and each new client failing at once.Shared::base_render_quarantinedis oneAtomicBool, handed to SUBMIT asPrepareHints::expand_render_ext.active_passes0, one render)target_render_slots()then wants 3 slots and stops at Tier 0's end, 8.render_exhausted_within(8)is true when nothing in 0..8 can become claimable: all quarantined, or one healthy slot left that nothing can displace.publish_checked()completes the job withECANCELED. Every later SUBMIT does the same, as the VM never grows.The change.
quarantined_render_mask(u64,RENDER_SLOTSis 48) replaces the bit, fromLifetime::quarantined_mask(), which now covers 64 owners instead of 32. The compute mask is unchanged (24 units).target_render_slots_for()counts only slots outside the mask against live passes + this submission + one displacement slot, and takes the smallest tier that covers them (skip_quarantined_render_slots()). Two such slots always make progress: once the engine drains, the older of two retired owners is displaced.render_exhausted()), as today.single_vm_targetis computed as before, so a fallback tier alone doesn't grow the PB heap to 256 MiB.Cost. A VM that falls back to Tier 1 backs Tiers 0 and 1 (55 MiB): the slots are contiguous, so the quarantined Tier 0 slots get storage they won't use. Only after Tier 0 has been used up by recoveries.
Limits. A job that was accepted before the recovery and holds only exhausted slots is still cancelled; the next SUBMIT of that VM grows. Storage growth stays best effort: if its allocation fails, the job fails as before. This does not address what causes the recoveries.
Evidence
Head
cc7c4893660fed0a015c8f5e09f5f216b754a798ona05d99c9dbc2(main has moved 10 commits since, none in these files).Merge with main
ebfc4f60bdd1(tree854b8bcafc56; itsg16/is the same as in the J773g kernel's merge8967201e3ddf):asahi-m426 of 26 scripts (test-resources100 passed),g162 of 2,g1519 of 19 andm3-recovery2 of 2 in the hosted-CI image; arm64LLVM=1 W=1 drivers/gpu/drm/asahi/(G15 and G16 on) builds with the same 38 warnings as main.Host tests,
asahi-m4/test-resources.py(compiles the production slot ledger and tier code), in the hosted-CI image (ubuntu 24.04, rust 1.96.0):a05d99c9dbc2+ the new tests (calling its 1-bit hint)quarantined_tier0_backs_a_fresh_vm_from_a_higher_tier: "a fresh VM backs 8 slots, all quarantined: ECANCELED"quarantined_tier0_backs_a_fresh_vm_from_a_higher_tier: publishes and quarantines slots 0..8, prepares a fresh single-pass VM, checks it backs 18 slots, renders 54 times from slots 8..18 only, and that slots 0..8 are still quarantined and refuse a claim.render_tiers_count_only_slots_outside_quarantine: the tier for partial and full quarantines, multi-pass demand, the 15-slot census, the fewest healthy slots, and no change over every demand without a quarantine.all_render_slots_quarantined_stays_exhausted: all 48 quarantined stays exhausted, with nothing to pick (passes before and after).tools/asahi/run-host-tests.py --only:asahi-m41/1 (the whole suite),g162/2,g15-display-order1/1,m3-recovery2/2.arm64
LLVM=1 W=1 drivers/gpu/drm/asahi/(asahi profile,DRM_ASAHI=m, G15 and G16 on, clang 23, rustc 1.100): builds, no new warning. Base and head print the same 39 warnings of that newer toolchain, line for line;asahi_core.odiffers between them. checkpatch on the diff: 0 errors, 0 warnings.