Skip to content

drm/asahi: recycle settled quarantined G17 compute queues - #305

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-compute-quarantine-recycle
Oct 14, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
claude/g17-compute-quarantine-recycle

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Problem

Every failed GPU client on Neo (T8140) leaks its compute queue. A failed client's queue is quarantined, and once the owner closes and its commands are settled nothing returns the queue to service: exit_candidate() needs active commands, and reusable() refuses quarantined queues. The queue keeps its QID and its ~43 MiB USC pool backing until the processor stops.

After about 42 failed clients the T8140 dynamic lower VA window is full. From then on every new compute submission, from any app, fails with ENOSPC until reboot.

Fix

  • Queue::recycle_quarantined_idle() returns a settled, ownerless quarantined queue to service through the same path recycle_killed() already uses after an acknowledged kill. That path resets the item ring at the firmware consumer cursor and requires fresh backing, so the existing vacate path releases the pool and its VA.
  • settle_exit() re-reads kills left Unproven, meaning the kill was acknowledged before the scheduler page showed it. Such a kill now settles only once the page shows the killed state, even if its commands were retired by other means. Before this change those queues were also retained forever.

The change touches 3 files (+37/−3) and has no new options or debug flags.

Hardware validation (Neo, A18 Pro)

Failures were generated with deliberately failing compute clients.

Kernel module Failed clients ENOSPC Firmware crash
Unmodified aurora-wip 5f6c917 ~42 yes no
This commit, fresh boot 84, including a replay of 28 failed device creations no no
This commit, longer run on one boot 150+ no no

The committed files are byte-identical to the module source that was tested.

Known issues (pre-existing, not changed here)

  • Innocent render dropped by firmware. While another client's GPU work fails, firmware can retire an innocent client's render without running its fragment stage. The fragment end timestamp is never written. After the 2 s scheduler timeout, fail_after_observation() settles that frame as abandoned with EIO, and the victim's VM is marked lost. On Neo this kills Hyprland's GPU context, leaving a frozen or blank desktop. It happens with and without this commit; the render path is untouched here. A fix is in progress.
  • One firmware crash on an earlier version. On the first boot of an earlier version of this change, one GPU firmware crash happened 350 ms after a timed-out compute command. At that point no queue had been quarantined or killed yet. It did not reproduce on later boots of either version.

🤖 Generated with Claude Code

A failed client's compute queue is quarantined. Once its owner closes and
the retirement witness has settled every retained command, the queue has
no active command, so exit_candidate() never issues a kill for it, and
reusable() refuses it because it is still quarantined. It therefore keeps
its QID and its USC pool backing until the processor stops.

Each Gen1-capable compute pool takes about 43 MiB of the T8140 dynamic
lower VA window. On Neo, after roughly 42 failed clients the window is
exhausted and every new compute submission fails with ENOSPC until reboot.

Return such a queue to service the way recycle_killed() already does after
an acknowledged kill: reset the item ring at the firmware consumer cursor
and require fresh backing, so the existing vacate path publishes the
free-list release and frees the VA.

A kill acknowledged before the scheduler page showed the killed state was
left Unproven forever, retaining its queue as well. Re-read such kills on
later passes and settle them only once the page shows the killed state,
also when their commands were retired by other means.

Validation on Neo with deliberately failing compute clients: unmodified
aurora-wip reaches ENOSPC after about 42 failed clients. With this change,
a fresh boot handled 84 failed clients, including a replay of 28 failed
device creations, with no ENOSPC and no firmware crash, and the same build
passed more than 150 failed clients on one boot.

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