Skip to content

drm/asahi: g17: say what a timed-out render waited for - #3568

Draft
RyanTheTide wants to merge 3 commits into
mainfrom
k114s-gpu/g17-timeout-report-2
Draft

RyanTheTide wants to merge 3 commits into
mainfrom
k114s-gpu/g17-timeout-report-2

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem. On the M5 Pro (K114s, T6050 G17S, fw 27.2) a render timed out during normal desktop use. The firmware had taken both kicks, the tiler ran, and the fragment never started. Recovery state was 0. The report could not say what the fragment was waiting for. A dependency wait, a fragment queue the firmware never selected and a stale completion seed all look the same. It happened once in about 60 boots, so the next occurrence has to carry the answer.

Change. Diagnostics only. When a render times out, the report now also prints, from host reads:

  • each kick's dependency words as the kick ring entry holds them, with the named queue's stamp;
  • the M5 completion-link words;
  • the pair's context and identity update state, and the work-state node's progress;
  • the event, control and work ring cursors, pending grow and release work, and the power state;
  • for the first two reports of a boot, a second sample 100 ms later.

The drm_sched timeout worker takes the report and its resample before anything acts on the failure, so retirement reads fresh stamps and recovery state. Timeouts the event worker applies later are reported without the resample. The publish, settle and observe paths are unchanged. tools/asahi/g17-quarantine-drain-tests.py follows the new call in timeout_render.

Tested: J616s (T6040), bridge4 kernel + this report, one-shot boot and a 36-min offscreen GPU soak, 0 errors. K114s (T6050), bridge5 kernel + this report, one-shot boot past first render and a 7.5-min lit stress, 0 errors. Both on the same asahi source as 9280c8c. Buildbox: g17 host tests 251/251; full host suite 760/764 (4 g15 timeouts under load, g15 files only); asahi_core.o builds on main 18058ea with no new warnings.
Risk: Two-way. Only the render-timeout failure path changes, and only by extra logging and one bounded 100 ms delay for the first two timeouts of a boot. Macs: every G17 board.

Background

An earlier variant kept a copy of each render's dependency words in every published group. That grew the render settle and observe stack frames by about 700 bytes, and it hard-reset the K114s at the first render, twice. This version reads the words back from the kick ring entry at timeout instead. Logs: traces/gpu/20261128-k114s-vmbind-110 on the lab store. Lane K114S-GPU.

A G17 render timeout reports the stamps, the ring cursors and the stage
timestamps of the group at the head. That shows the firmware took both
kicks and that the fragment never started (M5 Pro, 11-28), but not what
the fragment was waiting for, so a dependency wait, a fragment queue the
firmware never selected and a stale completion seed look the same.

Add to the report, from host reads only:
 - each kick's dependency words as its kick ring entry now holds them,
   with the named queue's completion stamp and its sequence;
 - the M5 completion-link words of both commands (fragment busy, linked
   fragment completion, pass bytes, completion values);
 - the pair's context and identity update state, and the ioctl's
   work-state node with the firmware's completed count;
 - both event rings, the control ring, pending growth and release work,
   the work rings of every priority and the GPU power state;
 - for the first two reports of a boot, a second sample of all of it
   100 ms later, which shows whether anything still moves.

Report the timed-out group only once it heads its pair, and only once
per failure. The drm_sched timeout worker takes the report and its
100 ms resample before anything acts on the failure, so the stamps and
the recovery state the retirement then reads are fresh. A timeout the
event worker applies later is reported without the resample. The
publish, settle and observe paths are unchanged.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
render.rs: keep main's Active/ParkedReplay render_active accounting next
to this branch's DependencyList, and main's choice of the reported group
(the first one not owed stamps, else the front) with this branch's
Option return. memory.rs: keep main's ensure_target() next to this
branch's m5_link_words() and owners().

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Main keeps a group that finished on the GPU but is still owed its stamps
at the head of the pair, and its timeout report already describes the
oldest group not owed its stamps. This branch's report path checked the
literal front (front_is(), front_ordinal(), the resample's lookup), so a
timed-out group behind an owed front was never reported. Select the
group once, in timeout_front(), and use it for all four.

Host model (g17-render-owed-stamp-tests): extract fail_render_packet_reported(),
timeout_front() and front_is(); model report_render_timeout() as one
report through the real Pair::report_timeout(), and the publication
detail as a no-op (it only prints from kick rings and command memory the
model lacks). The report-timeout-front-only mutant now targets
timeout_front(). The settle-fails-retired mutant is dropped: with the
per-call `reported` flag, dropping the retired_held() exit no longer
causes a second report, the only effect the model observed.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Updated to 1aa4169, merged with main f02bd68 (K114S-GPU has been parked since 12-01, so I picked this up).

  • Conflicts in render.rs and memory.rs: I kept main's Active/ParkedReplay render_active accounting and ensure_target() next to this branch's DependencyList, m5_link_words() and owners().
  • Fix found while merging: main leaves a group owed its stamps (finished on the GPU) at the head of the pair, and its report_timeout() already describes the oldest group not owed its stamps. This branch's front_is()/front_ordinal()/resample lookup checked the literal front, so a timed-out group behind an owed front was never reported. All four now share timeout_front().
  • Host model: g17-render-owed-stamp-tests extracts the new settle path. It models the report as one report through the real Pair::report_timeout() and the publication detail as a no-op, since it only prints. The report-timeout-front-only mutant now targets timeout_front(). I dropped settle-fails-retired: with the per-call reported flag, its only observed effect (a second report) can no longer happen. run-host-tests.py --only g17: 420/420.
    Rust build is left to CI (apple-build). Still needed: review, and a K114s row: a normal desktop boot with no new warnings. The diagnostics only print on a render timeout.

@RyanTheTide

RyanTheTide commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor Author

At 1aa4169, the hosted Host job passed 1248/1250. The failing sleep-legacy fixture still lacks gp_pcie_undescribed and the T6030 PMP mutation sees the no-storage-policy needle twice. The hosted Asahi KUnit job fails compiling the layout fixture because Validated::Render no longer has attachments or timestamps.

The failing fixtures have identical blobs on the head and its first parent. Released main 43600d8 contains 6b06f35 for both Host fixtures and 3fdf0c4 for the Asahi layout fixture. A merge-tree preview of 1aa4169 into 43600d8 merged cleanly as tree c9476fe87475. In that snapshot the legacy sleep test passed, the PMP graph passed 27 cases plus mutation checks, and the G17 render owed-stamp test passed 48/48. Five diagnostic negative controls reached the running test fixture and were rejected, including the retired/owed-head and report-front-only cases.

The preview is local and the owner still needs a forward merge and exact hosted checks. DRAFT-LINUX owns the current guarded K114S runtime row.

Host failure · Asahi KUnit failure

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware row at exact head 1aa4169b034e on the K114s: PASS (regression; no timeout occurred).

  • Boot to the GDM desktop on G17, then gpubench-vk render.light, render.heavy, render.tvb and render.deferred (3 runs each at two depths): all complete, 0 new kernel lines with timeout/fault/WARN/error, 0 GPU timeouts or faults all boot.
  • No render timed out, so the new report itself was not exercised.

How: one combined test kernel, not this PR alone. Kernel 7.3.0+ = main d0684a06 + merge commits of linux#2422 d259e636, #2423 0e679b18, #3568 1aa4169b, #4059 b94d8922, #2465 47b668b4 (all merged clean, test commit 2afc7246, fleet config, cloud build https://github.com/aurora-silicon/cloud-build/actions/runs/47498815145). #4059 is in the kernel but its row is run separately. Booted as a one-shot on the lab K114s (M5 Max, T6050, 27.2 stub) with this kernel's own t6050-k114s.dtb in a trial Stage 2 (live aura 1.0.0b19 + U-Boot, only the DTB swapped), default cmdline, silent. No sleep rows on this Mac (its RTC can't wake s2idle). Health: 0 AVC, 0 failed units, no new error-level kernel lines vs the saved kernel. Saved default restored after.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant