Skip to content

drm/asahi: g17: replay render groups firmware retired without executing - #307

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-render-innocent-replay
Oct 15, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-render-innocent-replay

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Problem

On Neo (T8140), when one client's GPU work fails, the firmware can retire another client's render without running its fragment pass. In our testing the innocent client was the compositor. The tiler start record is written, the fragment end record never is, the stamps cover the group, and no recovery is reported.

The kernel then waits out the 2 s scheduler timeout. fail_after_observation() settles the group as abandoned with EIO and marks the innocent owner's VM as lost. Hyprland keeps running but outputs empty frames: the desktop freezes or goes blank until the session restarts.

A diagnostic build caught this three times. Each time Hyprland's render (slot 4, qids [8, 9]) was submitted at the same instant another client's compute failed.

Fix

  • Recognize the abandoned group as soon as it retires, using the same strict witness the timeout path already uses. The witness must hold on two observations at least 2 ms apart, and only a lone, published, unfailed group on an unquarantined pair qualifies.
  • Republish the same command instead of failing it. The owner's VM stays healthy and the fence completes normally. Retries are capped at three, after which the old EIO path applies.
  • A closed owner, a cancelled packet or a stale context settles the parked replay with ECANCELED, which does not poison the VM.
  • With the VerboseFaults debug flag, each replay is logged.

Safety: only the fragment stage writes attachments, and its end record was never written, so the replay is the first execution as far as render targets are concerned. Tiler-side pipeline statistics may count twice.

Hardware validation (Neo, A18 Pro)

Reproduction: deliberately failing compute clients while the compositor animates the screensaver.

Kernel Result
Before (aurora-wip, with and without PR #305) Desktop lost in 3 of 3 runs
This change 7 replayed groups across 3 boots, each 9–13 ms after the failing client; 0 EIO, 0 firmware crashes; compositor kept rendering
False-positive control (earlier builds with the same replay logic) About 1,500 ray-query, RT-pipeline and mesh CTS cases, no failing clients, no replays

The committed files are byte-identical to the module tested on the final boot, which logged 3 replays over 24 failing clients.

🤖 Generated with Claude Code

A render group can be retired by firmware without its fragment pass ever
running: the tiler start record is written, the fragment end record is
not, both completion stamps already cover the group, its job list is
empty and no recovery is reported. On Neo this happens to an innocent
owner (the compositor) at the instant another client's compute command
fails with a zero-duration completion record. The front group then polls
Pending forever, the 2 s scheduler timeout fires, fail_after_observation
takes the strict abandonment witness and fails the owner's VM with EIO.
The compositor's device is lost and the desktop freezes.

Use the same witness to recognise the abandoned group as soon as it
retires, and publish the same command again instead of failing it. In
Pair::retire_front a lone, outer-published front group that polls
Pending is checked with retirement::abandoned (executed groups are never
accepted); the proof has to hold on two observations at least 2 ms apart
so a single sample straddling a firmware update cannot trigger it. The
dead generation's free-list and QoS accounting is completed exactly as
the timeout path does, the record is retired and the packet is parked on
the pair with its publication state reset; its completion stays
unsignalled and no VM status is recorded. Firmware::replay_render, run by
the event worker next to the compute replay and never during recovery,
prepares and publishes the parked packet again through the ordinary
path (fresh ordinal, descriptors, scene and timestamp record). A closed
owner, a cancelled packet or a stale context settle the replay with
ECANCELED, which does not poison the VM; other publication failures
settle it with their error as before. Completion::begin_replay bounds the
attempts to three, after which the previous EIO settlement applies. The
original submission's scheduler timeout is ignored while its packet is
parked, and a processor stop drains a parked replay like active groups.

Nothing of an abandoned group reached its attachments, which only the
fragment stage writes, so re-running the tiler and fragment passes from
the same command is the first execution as far as render targets are
concerned. Tiler-side pipeline statistics may count twice; vertex-stage
side effects exist only behind an opt-in diagnostic.

Tested on Neo (A18 Pro, G17P) with failing ray-query clients next to an
animating compositor: the first incident at 81.455 s was replayed at
81.468 s (slot 4, qids [8, 9], pass [tiler start, 0], stamps covering
the group) and the compositor kept rendering with no device loss, where
the previous kernels lost the desktop in three out of three runs.
With this change and VerboseFaults set, two further boots logged 2 and 3
replayed groups over 13 and 24 failing clients (the first boot differed
only in the log string), with no device loss and the compositor still
rendering. Boots of earlier builds with the same replay logic ran about
1,500 ray-query, ray-tracing pipeline and mesh conformance cases without
failing clients and logged no replay.

With the VerboseFaults debug flag, each replay is logged with its slot
and the pass record that proved the group was not executed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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