Skip to content

drm/asahi: g17: order cross-pair partial renders and advertise feature on two-pair M5 - #3991

Merged
DjDeveloperr merged 5 commits into
mainfrom
feat/g17-m5-ordered-partial
Dec 3, 2026
Merged

DjDeveloperr merged 5 commits into
mainfrom
feat/g17-m5-ordered-partial

Conversation

@erikwb

@erikwb erikwb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

What: Order cross-pair fragment render dependencies, same-VM attachment hazards, and fragment-only compute waits on the tiling kick whenever variant.fragment_busy is supported, close recovery/replay ordering gaps for parked render and compute producers, fix the local fragment_types stack array bound, and advertise DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS on two-pair M5 parts (G17C/G17D).

Tested:

  • J716c (T6050, M5 Max / G17C) at dc93841f2283 (trial kernel built from main d3de772ac0c1 + this PR + CLPC T6050 fabric 3 PR, default cmdline):
    • Booted cleanly to Hyprland desktop; DRM_IOCTL_ASAHI_GET_PARAMS reports feat_compat = 0x0000393e7cfe7c07 (DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS bit 45 = 1) by default.
    • Vulkan CTS (aurora-wip Borealis 212dc19e1b35): renderpasses 20,102/20,102 (16,381 Pass / 3,721 NS / 0 Fail) + synchronization 1,499/1,499 (1,498 Pass / 1 NS / 0 Fail) — 21,601/21,601, 0 fails, 0 dmesg GPU errors.
    • Cyberpunk 2077 2.5 T2 (2560x1600, cur-fex-main-vkmain, run-ab.py): 55.38 FPS (3,559 frames), 0 Asahi GPU faults, 0 pstate-1 clamps.
  • KUnit & host tests at dc93841f2283:
    • 419/419 asahi_g17_* Rust KUnit tests PASS in QEMU (including asahi_g17_render_ordered_partial and expanded publication_barriers replay-hazard cases).
    • g17-direct-stage-prefixes-tests.py, g17-m5-cross-qid-direct-tests.py, g17-compute-multi-channel-feature-tests.py PASS.

Risk: two-way door · M5 / G17 two-pair Macs (G17C/G17D) and G17 render/compute recovery paths.

Not yet: G17D (M5 Ultra) hardware run; dedicated hardware fault-injection stress forcing simultaneous cross-pair tiler overflow during recovery.

Details
  • DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS promises that every fragment pass of a render command (including partial renders triggered by tiler-heap overflow) starts only after earlier work its fragment half waits on has completed. On M5, fragment_busy drains only the same physical pair's fragment ring, so two-pair parts previously withheld the feature bit.
  • Barrier promotion (g17/queue/render.rs):
    • When variant.fragment_busy is true, promote cross-pair fragment render waits (dep.qid() != own_fragment_qid), same-VM attachment hazards, and fragment_compute waits into tiling_barriers before class-aware deduplication, while keeping same-pair render waits off tiling so TA still overlaps 3D on the same pair and independent renders keep both pairs.
    • Size RenderBarriers::tiling/tiling_types and the local fragment_types buffer in Pair::publish (fixing a pre-existing bound missing COMPUTE_CHANNELS_MAX and guarding the G17D ancestor write on ancestor.is_some()).
  • Recovery and replay ordering (g17/queue/{admission,compute,render}.rs, g17/runtime/{render,compute_replay,render/*}.rs):
    • Refuse take_pair() while a pair has parked replay work and preserve borrowed_replay across all pair loans so parked sibling predecessors stay visible to owner_parked_through / owner_parked_other_through / replay_parked.
    • Serialize parking (reset_publication_for_replay) and normal execution retirement (note_render_executed) against direct publication via Host::with_render_lock (port.render_lock()).
    • Track monotonic published_order, parked, and later_consumer_executed in admission hazard footprints so parked producers clear discarded kicks, replays preserve original hazard direction across both live and parked overlapping entries, and producers whose later overlapping consumer already executed fail spared with ENODATA.
    • Record (sequence, Fence) of failed compute commands whose Deferred::Retired signal is still queued in compute::Queue::pending_failed (cleared on clear_owner/stopped and pruned once signalled, without retaining Packet/Context), return EAGAIN from dependency_checked() while covered compute commands are parked or pending-failed, order multi-channel compute replays, drain non-idle DeferredBatch off-lock before retrying/waiting in compute_packet() and render/submit.rs, and check producer fences before replay/direct/mutex publication.
Evidence
KUnit (dc93841f2283):
  ./tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 --kunitconfig drivers/gpu/drm/asahi 'asahi_g17_*'
  -> Testing complete. Ran 419 tests: passed: 419

Host tests (dc93841f2283):
  python3 tools/asahi/g17-direct-stage-prefixes-tests.py -> PASS
  python3 tools/asahi/g17-m5-cross-qid-direct-tests.py   -> PASS
  python3 tools/asahi/g17-compute-multi-channel-feature-tests.py -> PASS

J716c runtime (main d3de772ac0c1 + dc93841f2283 + 23cd587389ae, default cmdline):
  DRM_IOCTL_ASAHI_GET_PARAMS feat_compat = 0x0000393e7cfe7c07 (bit 45 = 1)
  Vulkan CTS renderpasses:    20102/20102 (16381 Pass, 3721 NS, 0 Fail), 0 dmesg GPU errors (8s)
  Vulkan CTS synchronization:  1499/1499  ( 1498 Pass,    1 NS, 0 Fail), 0 dmesg GPU errors (8s)
  Cyberpunk 2077 2.5 T2:      55.38 FPS (min 46.03, p99 23.1 ms, V=2.06ms F=6.57ms C=17.37ms(96%)), 0 Asahi faults, 0 pstate-1 samples

…e on two-pair M5

DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS promises that every fragment
pass of a render command, including partial renders triggered by
tiler-heap overflow, starts only after earlier fragment work its
fragment half waits on has completed. On M5, the firmware flag
fragment_busy drains only the same physical render pair's fragment ring,
so two-pair parts (G17C, G17D) previously withheld the feature bit.

When variant.fragment_busy is supported, promote cross-pair fragment
render dependencies (dep.qid != own_fragment_qid), same-VM attachment
hazard waits, and fragment-only compute waits into the tiling kick's
barriers while keeping same-pair render dependencies off tiling so
tiling still overlaps fragment work on the same pair and independent
renders keep both pairs. Also defer publication and replay while a
covered sibling predecessor is parked for recovery, fix the local
fragment_types stack array bound, and advertise
DRM_ASAHI_FEATURE_ORDERED_PARTIAL_RENDERS whenever variant.fragment_busy
is true.

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested review from a team and DjDeveloperr as code owners December 2, 2026 20:39
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at f6dc9411: not ready yet

Check Detail
CI at head ok 9 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at f6dc9411
Conflicts ok none
PR text ok Risk: two-way · M5 / G17 two-pair Macs (G17C/G17D) and G17 render/compute recovery paths.

Areas: area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at dc93841f. The ordering idea and the array-bound fixes look right to me. Three things need to change or be measured first.

1. Host tests break (blocking). run-host-tests.py --only g17 passes 333/333 on main 2a6502ff and 263/333 with this head merged. All 70 failures are compile errors in harnesses that extract the code this PR changes, because their stubs lack the new names: with_render_lock, note_render_executed, note_pending_failed, borrowed_replay, replay_frontier, replay_front and DeferredBatch::is_idle. The six scripts are g17-render-owed-stamp (35), g17-compute-owed-stamp (18), g17-render-return-observe (14), g17-capacity-fault, g17-compute-deadline and g17-unpublished (1 each). The hosted host-tests job is still queued and will go red. Please update the stubs, and add a mutation for the new lock and parking steps where the script has them.

2. The TA promotion is not limited to two-pair M5 (needs a measurement or a narrower condition). fragment_busy is true in V26A428 (fw/variant.rs:179), and the M5 variants inherit it. So render_barriers (queue/render.rs:794, :830, :842) also changes every single-pair board: J714s, J813 and the Neo J700. Those already advertised the bit and gain nothing new from it.

  • On those boards a fragment-only compute wait now also holds the tiling kick (:823-834). That removes the TA/compute overlap that stage prefixes were added for, and a blocked TA holds every later render on that pair's ring. The UAPI text promises ordering against fragment work and renders named by fragment barriers. It does not mention compute.
  • The comment gives two reasons for promoting compute: a transitive wait on another pair, which a one-pair owner does not have, and writes to attachments. If the second is a real hole on one-pair boards, please say so and show it, because it is then a separate fix. If not, limit the compute and hazard promotion to queues with more than one pair (pairs::per_owner(); the count is already sampled per queue).
  • The risk line says "M5 / G17 two-pair Macs" and the label is blast:m5. The Neo is in scope too.

3. A render can spin while a compute replay is parked. Queue::dependency_checked now returns EAGAIN for a parked or pending-failed compute command (queue/compute.rs:2738-2745) with no recovery pending. In render_with_lease, a sleeping caller that gets EAGAIN without recovery and without outer_wait falls through runtime/render/submit.rs:577-581 and retries at once. Each retry takes the device mutex, prepares and discards. The compute replay it waits for needs that same mutex and may stay parked for up to CONSUMER_WAIT_NS (300 ms), or longer on ring backpressure. No deadline covers this arm. Please wait as the EBUSY arm does. The compute path already waits here.

Smaller

  • publication_barriers returns EBUSY to a new render that overlaps a parked one (admission.rs:1780). The submitter appears to give up after WORK_RING_WAIT_NS (2 s), while a parked replay may stay for 10 s (background_stalled). An unrelated submission could fail before the replay does. Please check or align the two bounds.
  • later_consumer_executed turns a silent wrong-order replay into ENODATA for everything parked on that pair. That is better than wrong pixels, but it is a visible change for innocent clients after a recovery. Please put it in the What line.
  • checkpatch --strict: 0 errors, 5 long-line warnings. No module params, runtime switches or board checks added. The new sizes are derived from existing constants and stay under KICK_BARRIERS_MAX.

Local checks (head merged on main 2a6502ff, LLVM=1 arm64, asahi.config)

  • make W=1 drivers/gpu/drm/asahi/: pass, and the same 40 warnings as main (warning diff 0 lines).
  • KUnit arm64 build and link with drivers/gpu/drm/asahi/.kunitconfig: pass, new suite present. Not run (no emulator on our hosts).
  • Host tests --only g17: 263/333 (main 333/333). --only asahi: 3/3.
  • Main has since moved to 53732c47. It merges clean, and the only drm/asahi files that changed there are fwid.rs and g16/hw.rs.

Other work

  • linux#3985 (compute QID headroom) overlaps only in runtime.rs. The two merge clean and do not share logic. #3985 can land first.
  • The M5 A2 phase-2 work (firmware waits on multi-command and render sources from other queues) touches completion.rs, job.rs, queue/compute.rs, queue/render.rs, runtime.rs and runtime/render.rs. Its current working diff applies cleanly on this head. Two things to watch: it makes more compute publish early behind another queue's render, so the TA promotion in point 2 would block for longer; and it also edits g17-render-owed-stamp-tests.py. Whichever lands second must rerun the g17 host tests and the cross-queue rows.
  • mesa#1556 and mesa#1557 do not use this feature bit and do not depend on this PR. In Borealis the bit is read by load_hazard_frag (hk_device.c), which is already in aurora-wip.

Hardware rows owed (at the final head, not dc93841f)

  1. J716c (T6050, G17C): repeat renderpasses + synchronization CTS. Add a Cyberpunk T2 A/B against the same main without this PR: the 55.38 FPS here has no control on the same kernel base. Add one recovery run with a guilty hang and an innocent client on both pairs.
  2. M5 Pro J714s (T6050, G17S, one pair per queue): renderpasses + synchronization CTS, a GTA V benchmark A/B against main (FPS and GPU busy), and a guilty-hang recovery row with an innocent client.
  3. Neo J700 (T8140, G17P): the same CTS subset, a gpubench or game no-regression A/B, and the same recovery row. This is shared g17 code.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES at dc93841

Failure: The current code makes the existing run-host-tests.py --only g17 pass 263/333 cases versus 333/333 on the matched base, as recorded in the exact-head review 6160345189. The 70 compile failures are in the existing helpers after this patch removes or introduces interfaces across the publication and replay paths. Restore the existing suite to passing.

Failure: A render in the sleeping submission path busy-retries a compute dependency parked for replay. dependency_checked() returns EAGAIN. With recovery idle and no outer ring-space wait, render_with_lease() only calls the wait helper for EBUSY and immediately repeats the loop. The replay producer requires the same mutex, so each retry competes with the work needed to satisfy it. Route the parked-dependency case through a bounded wait.

Follow-ups: Please split independent queue-ordering and recovery changes into reviewable pieces when sending the next version.

…esses

Six harnesses stopped compiling once the code they extract started to
park replays under the render lock, to note failed compute commands
until their fences signal and to drain a publication attempt's batch
before it retries.

Extract the new helpers next to their callers instead of stubbing them
where that is possible: the admission record notes and the publication
reset, the pending failures of a compute queue and their owner change,
and the parked frontier of resident and borrowed render pairs. Give
the modelled device mutex, render lock, completion fences and deferred
batch the state those paths depend on.

Add cases and mutations for the new steps: parking and execution are
recorded once and only under the render lock, a pair with parked
replays is not lent, a borrowed pair's frontier stays visible to
its owner only, a failed command stays noted until its fence signals
or its owner changes, and a failed predecessor is signalled off the
device mutex before any retry or wait.

Signed-off-by: DjDeveloperr <hey@djdev.me>
A render that waits for a compute command parked for replay is refused
with EAGAIN, as is one behind a failed command whose fence has not
signalled.  render_with_lease() only waits for EBUSY, so without a
recovery a sleeping publisher prepares, takes the device mutex and
discards again at once, against the event pass that needs the same
mutex to republish or fail that command.

Wait for the next notification of `progress` instead, which a finished
replay and every event pass behind a waiter signal, after one further
attempt for a missed one. The wait ends at the deadline a compute
publication behind the same command has. The submitting ioctl still
falls back to the scheduler.

The new host test runs the publication loop and the refusal from this
tree against a modelled event worker. Without this change a refused
publication does not wait before it retries.

Signed-off-by: DjDeveloperr <hey@djdev.me>
`fragment_busy` is set for every M5 and the A18 Pro, so ordering
partial renders across pairs also made a fragment-only compute wait
and a same-VM attachment overlap hold the tiling kick on boards with
one render pair per queue. They gain nothing from it: the promise
covers the pair's own earlier fragment work, which `fragment_busy`
drains, and the renders the fragment barriers name, and a queue of
one pair has no render on another pair that a compute wait could
stand for. A held tiling kick holds every later render of that ring,
and the overlap of tiling with compute is lost.

Promote those two waits only where a queue may hold several pairs,
from the count sampled at probe. A fragment wait that names a render
of another pair is still promoted everywhere.

The new host test runs render_barriers() with the arguments publish()
gives it for each cluster count.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Pushed three small commits on top of dc93841f for the two blockers in the App's review and the single-pair point in ours. erikwb's commit is unchanged, nothing was rebased or merged in, and GitHub shows no conflict with main. New head: a3e795ed0f10.

1. Host tests (53cf5f99a256, tools only). The six harnesses compile again and no case was dropped or relaxed. Where possible they now extract the new production code instead of stubbing it: note_pending_failed, clear_owner, reset_publication_for_replay, note_render_parked_for_replay, note_render_executed, replay_front, replay_through, replay_frontier, owner_parked_through, owner_parked_other_through and replay_parked. The modelled device mutex, render lock, fences and batch carry the state these paths depend on. New cases and mutations: parking and execution are recorded once and only under the render lock, a pair with parked replays isn't lent, a borrowed pair's frontier stays visible to its owner, a failed command stays noted until its fence signals, and a failed predecessor is signalled off the device mutex before any retry or wait.

2. Render spinning on a parked compute dependency (a90c9a8e2f96). render_with_lease() now also waits on EAGAIN when no recovery is pending. It waits on progress, which a finished replay signals, after one further attempt. It uses the same 30 s budget as a compute publication behind the same command, which wait_deadline() caps at 26 s. The EBUSY arm's 2 s would be too short: a replay can stay parked for 300 ms behind a live consumer and then 2 s for ring room. The submitting ioctl still falls back without waiting. The new g17-render-parked-dependency-tests.py runs the real loop and the real dependency_checked() against a modelled event worker. On the dc93841f sources 4 of its 8 cases fail with "a refused publication waits before it retries".

3. Fragment-only compute waits on single-pair boards (a3e795ed0f10). The finding was right: fragment_busy is also set on the A18 Pro and on one- and two-cluster M5, where a queue has one pair. Those boards now keep main's behaviour for compute waits and for attachment overlaps with another queue. Both are promoted to tiling only when a queue may hold more than one pair (pairs::per_owner(), sampled at probe). A fragment wait that names a render on another pair is still promoted everywhere, and the feature bit is unchanged. The new g17-render-partial-order-tests.py runs the real render_barriers() with the arguments publish() passes, for each cluster count. It fails on the dc93841f sources. I extended the KUnit suite in queue/render.rs the same way.

Run

  • Host tests --only g17 (pinned Ubuntu 24.04 container): main 37a63062 333/333, the new head 368/368, the new head merged with main 37a63062 372/372, and with drm/asahi: g17: give each open queue a compute channel before headroom #3985 (f3eee42b) on top 372/372. --only asahi: 3/3.
  • make W=1 drivers/gpu/drm/asahi/ (arm64, LLVM, J700 config) on the merge with main cebaa8a6: passes. The warning set is identical to main built the same way (40 warnings).
  • The same merge with CONFIG_KUNIT=y compiles drivers/gpu/drm/asahi/, with the extended ordered-partial suite in the object. The KUnit cases were not run (no emulator on our hosts), so the hosted job is the first run.
  • checkpatch --strict: 0 errors. Two "does MAINTAINERS need updating?" warnings for the new test files.
  • drm/asahi: g17: give each open queue a compute channel before headroom #3985 lands first. It merges clean with this head and the two share no logic.

Question for erikwb: on a single-pair board, can a partial render of one queue touch an attachment that another queue's pair is still rendering, in a way you want ordered? I kept main's behaviour there. If the answer is yes, main has that hole today, so please send it as its own PR with a test that shows it.

Still owed

  • Hardware at this head: J716c (author), then J714s and the Neo J700. No hardware was used for these commits. The J716c numbers in the PR body are for the first commit only.
  • From our earlier review, still with the author: the 2 s bound of a new render that overlaps a parked one against the 10 s a parked replay may stay, and the What and Risk lines (the visible ENODATA after a recovery, and the Neo and single-pair M5 in scope).
  • The App's request to split the queue-ordering and recovery changes. I didn't restructure the original commit.
  • A review from someone other than us, since we pushed last.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at a3e795e

Checked: All eight exact parked-dependency tests passed, including progress wake, bounded deadline, cancellation and nonblocking fallback. The exact render-barrier test also passed. The recovery path releases the device lease before waiting; the single-pair path keeps its fragment dependencies and avoids unnecessarily delaying the tiler. The maintainer reports exact host results of 368/368 and 372/372 after merging the tested base. The two earlier findings are addressed.

@erikwb

erikwb commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

We carry this PR in our unified daily kernel across J716c (M5 Max, T6050), J713 (M4 Air, T8132), and J313 (M1 Air, T8103).

Ordering cross-pair partial renders and advertising the feature on two-pair M5 lets the two render pairs on J716c overlap partial renders without serializing on the host, directly lifting GPU utilization and frame rate in heavy Vulkan workloads (part of the unified daily stack that reached 60.14 FPS in Cyberpunk 2077 2.5 T2 on J716c with default kernel parameters).

Booted and verified on J716c, J713, and J313 (5/5 Vulkan CTS smoke pass on all three Macs, zero GPU faults).

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 3, 2026
@DjDeveloperr

DjDeveloperr commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo, T8140, G17P) at a3e795ed0f10: no regression found. Recovery from a GPU hang was not exercised

Four one-shot trial boots on 2026-12-03 (base1, head1, head2, base2). Both arms carry #2196 (299b3771) and #3985 (f3eee42b). Base is the sealed batch kernel without this PR, head is the same source plus a3e795ed0f10 (release 7.3.0-pr2196-299b3771-pr3985-f3eee42b-pr3991-a3e795ed), stock aurora_defconfig. Only this PR's 23 files differ between the two trees.

The hang rounds count as INCOMPLETE, not as a product failure (added 07:27Z): the hang client most likely can't show its own progress to the host while it runs, and 30.7 s is the driver's designed renewal limit (2 s × (1 + 14)). A corrected client will rerun them.

The kit's own verdict is FAIL, because the recovery rounds failed on head2. They failed identically on base2 (three rounds each, same kernel lines, same timing), so nothing here points at this PR. Everything else passed. bit 45 is 1 in both arms (0x0000397a6001fc07), as expected on the single-pair G17P, where the PR doesn't advertise the feature newly.

Check Result
CTS, the full lists (not sampled): renderpasses 81,687 and synchronization 64,872 146,559 of 146,559 recorded on base1 and head1. 76,607 Pass, 69,952 NotSupported on both, 0 statuses differ, 0 new failures
GPUBench (9 cases, 3 interleaved rounds, all four boots), exact outputs PASS on all four boots. 0 of 10 rows worse. Compute beside render (concurrent.cr queues): compute −0.34 %, render −0.76 %. Interleave: −3.25 % (better; the base boots differ from each other by 13 %). The other seven rows are within −0.76 % to +0.73 % of base
Health, watchdog (all four boots up to the recovery part) 0 GPU fault, recovery or lost-device lines, 0 WARN, BUG or Oops, watchdog armed and fed
Recovery rounds, head2 (first run of this hang client on any GPU) and base2 FAIL on both, in all 3 rounds. See below

What the recovery rounds did. An innocent client runs four lanes of linked render/compute chains. After 4 s a second process submits one dispatch that loops until the host sets a flag (set at 24 s) or its bound is reached.

  • In all 6 rounds the hang client's dispatch never reported any progress (started false, 0 beats). The client ended with a lost device after 30.7 to 30.8 s.
  • The kernel printed watchdog gave up on a compute command … at the head of its queue for 30672 ms; not long work; sharing renewals 14/14, last command retired 0 ms ago and failed only that client (ETIMEDOUT).
  • The innocent client was not affected: all 6 rounds passed, about 20,000 to 22,600 chains, 0 spared, 0 canceled, 0 wrong. The four final chains were right. No other client was found guilty, no thread spun (the highest rec-client thread was 32 to 37 %).
  • The round is FAIL because of one line outside the kit's list: GPU work of a client failed (ETIMEDOUT, …), client hang-client; the client sees a lost device. It is the driver's message about the client it had just given up on, and it is the same on base.
  • It is INCOMPLETE on the recovery question: the dispatch looks never started (a running loop would have shown beats and would have ended when the host released it), so no GPU recovery ran in any of the 6 rounds. I can't rule out a fault in the hang client itself: this was its first run. So this row says nothing about recovery from a hang with this PR.

Not covered: GPU recovery (above), s2idle, and what the PR does on two-pair M5 parts (G17C/G17D). The J700 is a single-pair G17P, so it shows only that the shared code didn't change behaviour.

How it ran: dead-man-only recovery (30 min in base1/head1, 10 min in head2/base2), reset route checked before each slot, no reset used. Stock restored after each boot: boot-ctxr.bin byte-identical, no trial marker left, PMU boot-error count 00, kernel 7.3.0-41. Trial features value and build IDs are pinned in the kit (manifest 9d9f5ee9…).

@DjDeveloperr

Copy link
Copy Markdown
Contributor

For the two-pair J716c run at a3e795e, could you compare the same kernel, #3985, DTB, Mesa and default settings with and without this PR? Please report feature bit 45 (0 → 1), cross-pair partial-render ordering and CRCs, and whether innocent work on both pairs completes during recovery from a guilty hang. The daily-kernel report covers normal operation. The J700 hang client did not expose progress in either arm, so that part needs a rerun with a visible progress signal. The hosted failure was in the unrelated PMGR inherited-power fixture.

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 3, 2026
Keep the ENODATA replay classification and read the frontier through the ParkedReplay wrapper from main. Use the same wrapper in the return-observation fixture.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Forward-merged main 2533c76f02e3 as f6dc94111fcf. The replay-queue hunk keeps the ENODATA spared classification and reads the frontier through main’s ParkedReplay wrapper. The return-observation fixture now uses that same type with all controls intact. The nine affected host fixtures passed 113/113 including negative controls. The J716c row needs this head on the same #3985 base: feature bit 45, cross-pair ordering and CRCs, and innocent work completing on both pairs during recovery. The prior J700 row did not exercise recovery.

@github-actions github-actions Bot removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026
@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed the forward merge at f6dc94111fcf. The replay tracker and frontier now carry main's ParkedReplay type through the existing retirement path. The ENODATA spared classification still reaches the fixture, and the affected host tests passed 113/113. A maintainer who did not push this head still needs to approve.

J716c is the positive two-pair ordering, CRC and innocent-work recovery row. J714s can check the single-pair path with bit 45 clear and unchanged ordering. Neo owns the J700 recovery repeat.

@satchlj

satchlj commented Dec 3, 2026

Copy link
Copy Markdown
Member

J775c (M5 Max, T6050, two-pair G17C B1) A/B at f6dc94111fcf: pass, bit 45 0 -> 1, 0 regressions

Paired one-shot trial boots on the same machine, default kernel command line, byte-identical t6050-j775c.dtb (ecfc28023ecefc4ae9e8c8668b79cb9656a59be011f2609434fbe69790057733), and identical Borealis Mesa (1:26.3.0_devel.20261203.320298169939-1):

  • Base (7.3.0-1-3991.0-ARCH): linux@main dc68a27f33d8 + #3985 (f3eee42b75be)
  • Head (7.3.0-1-3991.1-ARCH): exact same base + #3991 (f6dc94111fcf)

Both arms booted cleanly (0 failed units) and returned unaided.

Check Base (#3985 only) Head (#3985 + #3991 f6dc94111fcf) Diff
DRM_IOCTL_ASAHI_GET_PARAMS feat_compat / bit 45 (ORDERED_PARTIAL_RENDERS) 0x0000193e7cfe7c07 (bit 45 = 0) 0x0000393e7cfe7c07 (bit 45 = 1) 0 -> 1
Vulkan CTS dEQP-VK.renderpasses.* (81,687, -j 2) 52,645 Pass / 29,042 Skip / 0 Fail / 0 Flake (1m57s) 52,645 Pass / 29,042 Skip / 0 Fail / 0 Flake (1m56s) 0 status diffs
Vulkan CTS dEQP-VK.synchronization.* (64,872, -j 2) 37,442 Pass / 8 Warn / 27,422 Skip / 0 Fail / 0 Flake (2m09s) 37,442 Pass / 8 Warn / 27,422 Skip / 0 Fail / 0 Flake (2m09s) 0 status diffs
gpubench-rt-vk rt.scene CRCs (medium / heavy, d=2) 3d294d0e (613.4 FPS) / 74914715 (199.7 FPS) 3d294d0e (613.6 FPS) / 74914715 (199.8 FPS) exact CRC match
gpubench-vk concurrent.cr (d=4) overlap 1.0876x (compute 176.68, render 255.36 us) overlap 1.0930x (compute 176.43, render 256.15 us) +0.5%
gpubench-vk render.heavy (d=1 / d=4) 259.88 / 61.21 us (541.99 Gpix/s) 259.88 / 60.93 us (544.51 Gpix/s) flat / +0.5%
gpubench-vk render.tvb (d=1 / d=4, tiler growth) 9259.26 / 4807.69 us 9259.26 / 4807.69 us identical
gpubench-stress-vk (xq.order, xq.chain, cr.concurrent, render.tiler, 40 s) 4/4 PASS, 0 errors (render.tiler: 1,294 frames / 143.99 Mtris; cr.concurrent: 84,400 checks; xq.chain: 78.95M checks) 4/4 PASS, 0 errors (render.tiler: 1,127 frames / 127.62 Mtris; cr.concurrent: 88,630 checks; xq.chain: 77.10M checks) 0 errors
Kernel log (dmesg) GPU faults / timeouts / refusals / WARNs 0 0 0

Not exercised in this row: gpubench-stress-vk --test life.fault --duration 20 passed on both arms (572,436 / 552,047 iterations, 0 innocent errors, 0 kernel fault lines), but all OOB attempts were reported as faulter.faults_ignored (74 / 63, faults_device_lost=0), so no kernel GPU recovery ran. Guilty-hang recovery under simultaneous two-pair work was not triggered by life.fault.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 3, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: merge at f6dc94111fcf.

Forward merge. The one conflict, the fail_replay loop, is resolved correctly. It walks main's ParkedReplay and still marks parked groups that aren't guilty as Spared on ENODATA (g17/queue/render.rs:2826-2831). replay_frontier reads .packet.order.sequence (:2512). One nit: the merge dropped the executable bit of tools/asahi/g17-render-return-observe-tests.py (755 on both parents, 644 now). The runner starts it with python3 -I, so nothing breaks.

Can a partial render on pair B wait forever after recovery kills a guilty job on pair A? No. Here is the reasoning:

  • Firmware waits. The tiling barrier this PR adds is the same kick dependency that B's fragment kick already carried (queue/render.rs:823-831, hazards :872-880). Moving it from 3D to TA doesn't change how a recovery ends it. Firmware ends waits on the kicks a restart retires (replay_abandoned relies on this, :2580-2581), and the watchdog bound is per job, not per stage. A render held at TA is also untouched at the restart, so it can replay instead of failing.

  • Host waits on the new parked state. A guilty pair is quarantined and skipped (queue/admission.rs:1753). A parked producer that later fails drops its lease when its Deferred::Retired runs: completion.rs:1101 → complete() → release_healthy() → RenderLease::drop (admission.rs:1806-1811). That also clears the EBUSY it caused. A parked replay that can't publish fails Spared with ENODATA after 10 s (fail_stalled_replay, queue/render.rs:2840). A new same-VM render held behind it waits at most 2 s once recovery has settled (runtime/render/submit.rs:956). A render held by a parked compute command waits at most the recovery cap (wait_compute_dependency, :306). Compute replays held by a parked sibling (compute_replay.rs:71-85) follow sequence order, so the oldest always moves.

  • Locks. Parking and normal retirement take the device mutex, then the render lock: the same order as mutex publication (submit.rs:834). Direct publication drops the render lock before it takes the device mutex (direct.rs:495, :541, :560). Pair::publish never reaches retire_front or replay_abandoned, so the new with_render_lock (render.rs:2470, :2683) can't deadlock on itself. The J775c CTS run went through it about 146k times.

  • Admission check. I ran a throwaway harness built from the real publication_barriers, note_publication, note_parked_for_replay, note_executed, quarantine and Drop for RenderLease. It confirms four cases:

    • a producer that is parked and then fails releases the other pair;
    • a quarantined guilty pair holds nothing;
    • with both renders parked, the earlier one republishes first and the later one waits on its new kick;
    • a later consumer that already executed makes the parked producer fail with ENODATA, and the producer then releases.

    Removing the footprint drop or the quarantine skip makes it fail.

Checks (pc, pinned Ubuntu 24.04 host-test container, arm64 LLVM):

  • Host tests --only g17 at this head: 382/382.
  • Full host suite on this head merged with main ebfb5226c9fb (clean merge): 1126/1127. The one failure, ave-recovery-old, comes from my archive checkout: git show <rev>:./ave.h needs a work tree. It fails the same way on this head alone. Hosted host-tests at this head passed.
  • make W=1 drivers/gpu/drm/asahi/ (G18/M5 config, warm tree): main, this head and the merge each give 38 warnings and 0 errors, with identical warning sets.
  • Hosted KUnit asahi at this head: 593 run, 592 pass, 1 skipped, including asahi_g17_render_ordered_partial and asahi_g17_owner_pairs.

Hardware.

  • satchlj's J775c A/B at this exact head: bit 45 goes 0→1, renderpasses + synchronization are identical, RT CRCs are equal, stress 4/4, 0 faults.
  • The J700 no-regression row at a3e795ed: the forward merge changed only the conflict lines.

Still owed (follow-up, doesn't hold this PR): no Mac has yet run a real GPU recovery with this PR. All the life.fault faults were ignored, and the J700 hang client never started. The missing row, on a two-pair M5 (J775c or J716c):

  • Setup: a guilty compute dispatch that really starts and hangs (with visible progress), while one innocent client renders with partial renders on both pairs.
  • Pass: the kernel logs one recovery; only the guilty client loses its device; the innocent client finishes every frame, either with matching CRCs or as Spared ENODATA, with no ETIMEDOUT and no WARN.

That row checks firmware behaviour that main already depends on for the fragment kick.

@DjDeveloperr
DjDeveloperr merged commit 571a6c4 into main Dec 3, 2026
12 checks passed
@DjDeveloperr
DjDeveloperr deleted the feat/g17-m5-ordered-partial branch December 3, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants