Skip to content

drm/asahi: g17: release pairs, queues and contexts held by stamps that never arrive - #1823

Merged
RyanTheTide merged 6 commits into
integration/aurorafrom
g17/drained-pair-settle
Nov 13, 2026
Merged

RyanTheTide merged 6 commits into
integration/aurorafrom
g17/drained-pair-settle

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

G17: release render pairs and compute queues that hold a group whose completion stamps never arrive.

Render. A group that retires on its pass record without completion stamps keeps its descriptor slot until stamps cover it (stamps_owed). Its client already has its result, so the group has no drained result. When a pair is quarantined with such a group still at its front, release_witnessed() fails with EIO on every event-worker pass once the firmware has drained the pair. The pair never leaves quarantine and keeps its memory and identities, and the log fills with Could not settle drained render pair N: EIO. On a J616s, Vulkan CTS (timeline_semaphore one_to_n plus op.multi_queue, 4 processes) logged it 61,445 times in about two minutes in 1 of 4 runs. Every client started after that lost its device with EBUSY until reboot.

  • Release a stamps_owed group along with the rest of the pair once the pair-wide proof holds. The proof is either stamps covering the pair's last publication (which covers that group too) or the firmware's acknowledged kill of its context. Descriptors are still never reused before then.
  • quarantine() skips groups that were already reported, so they are not failed a second time.
  • A closed owner's pair that holds only stamps_owed groups is drained the same way. It also qualifies for the existing context kill of executed, unstamped work, because no later group can bring the stamps.
  • A settlement that still fails is retried with a doubling backoff from 1 ms to 1 s. After 16 failures (about 6 s) the pair stays out of service and is re-checked every 10 s. Each episode logs twice: once at its first failure, with the failing step and the pair's state, and once when the pair is left out of service. debugfs aurora-g17/capacity reports drained_render_pairs unsettled= failures= recovered= out_of_service=.

Compute. A command that retires on its completion record without a stamp keeps its descriptor until the stamp covers it. Once the owner closes, nothing can bring that stamp, and the queue matched neither the exit nor the recycle conditions, so its QID and pool backing stayed held. It is now an exit candidate. The finished command does not count as a running traversal, and settling the acknowledged kill releases it without reporting it a second time.

Kills of closed contexts. A closed context whose render pool leases were all released took the compute-exit branch of the kill selection even when none of its compute queues would exit, so a quarantined pair whose last group ran unstamped was never killed. It now falls back to the render-only kill, which keeps its own conditions. A kill that waits because other contexts' work is running is now re-checked every 100 ms while the context still waits. Before this, once the short window after close ended, no event pass looked at the context again, and its kill was never published. debugfs capacity lists each render pair that is quarantined or still holds work, along with what is keeping it.

KUnit: asahi_g17_render_drain_retry covers the backoff. The host-test fixture for the compute exit carries the new field.

Test results

J616s (T6040), one-shot kernels on fleet71 (572eb88) config. Vulkan CTS 1.4.7.0, synchronization timeline_semaphore one_to_n + op.multi_queue slice (11,939 cases), 4 processes, 6 runs per kernel. Every kernel below hit the trigger: render timeouts where the fragment stamp of the last group never arrives.

kernel settle log lines lost devices per run render pairs held after the runs GPU firmware crash AVC
fleet71 61,445 (Could not settle drained render pair 18: EIO) 0, 9, 14, 14 1 (never released) 0 0
+ settle fix only 0 2, 2, 2, 4, 2, 6 closed contexts in teardown, no kill published 0 0
+ kill fallback 0 2, 5, 8, 11, 15, 17 3 (kill deferred, never retried) 0 0
this PR 0 0, 0, 0, 7, 0, 0 0 (teardown empty) 0 0

With this PR, held pairs are killed and released between runs (render_kills published=1 acknowledged=1, no render_pair lines, scheduler_teardown pending=0). The 7 EBUSY losses in one run came from kernel lower-VA placement refusals while the runs were busy, which were already present on fleet71 without the trigger. They did not carry over into later runs.

🤖 Generated with Claude Code

A render group that retires on its pass record without completion
stamps keeps its descriptor slot until stamps cover it (stamps_owed).
Its client already has its result, so the group has no drained result.
When such a group is still at the front of a pair that gets
quarantined, release_witnessed() found no drained result for it and
failed with EIO on every event-worker pass once the firmware had
drained the pair. The pair never left quarantine, its memory and
identities stayed held until the processors stopped, and every pass
logged "Could not settle drained render pair N: EIO" (61,445 lines in
about two minutes on a J616s under Vulkan CTS).

Release a group whose stamps are owed together with the rest of the
pair once the pair-wide proof holds: the stamps cover the pair's last
publication (and so this group), or the firmware acknowledged the kill
of its context. Its descriptor is still never reused before then.
quarantine() no longer fails such a group a second time.

A closed owner's pair that holds only groups whose stamps are owed is
drained the same way: nothing else would ever bring their stamps, and
it qualifies for the context kill like other executed, unstamped work.

A settlement that still fails is retried with a doubling backoff from
1 ms to 1 s, and after 16 failures the pair stays out of service and is
re-checked every 10 s. Each episode logs its first failure with the
failing step and the pair's state, and once more when the pair is left
out of service. debugfs capacity reports the counts, and KUnit covers
the backoff.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A compute command that retires on its completion record without a
completion stamp keeps its descriptor, and its place at the queue
front, until the stamp covers it. Once the owner closed, no later
command can bring that stamp, and the queue matched neither the exit
nor the recycle conditions: its QID and pool backing stayed held until
the processors stopped.

Make such a queue an exit candidate. The command already finished, so
it does not count as a running traversal, and settling the acknowledged
kill releases it without reporting it a second time.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
settle_exit() now reads Active::stamps_owed. Add the field to the
host-test fixture of the compute queue Active.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
…o compute queue exits

A closed context whose render pool leases were all released took the
compute-exit branch of the kill selection even when none of its compute
queues was an exit candidate, so nothing was killed. A quarantined pair
of that context whose last group ran but was never stamped (its pool
lease released, waiting for the kill) then kept the context, its
scheduler teardown and the pair until the processors stopped. On a
J616s under Vulkan CTS this left the closed context in teardown with
its render pair quarantined and no render kill published.

Take the compute-exit branch only when a compute queue of the context
will exit; otherwise consider the render-only kill, which keeps its own
conditions (no compute queue still runs the context, never killed
twice).

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
List each render pair that is quarantined or still holds work, with
what keeps it: owner, groups whose stamps are owed, free-list counters,
whether its work ran unstamped, the kill state of its context and the
failed settlement count.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
A closed context's kill is not published while other contexts' work
runs (kill_unsafe, foreign_compute_running), and the event worker polls
closed contexts only for a short window after they close. When the GPU
then went idle, no pass looked at the context again, so its kill was
never published: its quarantined compute queue and render pair (work
that ran but was never stamped) kept their identities and memory, and
the next clients ran out of room. On a J616s under Vulkan CTS each such
context cost later clients their devices (EBUSY) until reboot.

While a closed, unkilled context still has a compute queue to exit or
render pairs waiting for a kill, schedule an event pass every 100 ms,
so the kill is published as soon as it is safe.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide RyanTheTide changed the title drm/asahi: g17: release pairs and queues holding owed completion stamps drm/asahi: g17: release pairs, queues and contexts held by stamps that never arrive Nov 13, 2026
@RyanTheTide
RyanTheTide marked this pull request as ready for review November 13, 2026 23:12
@RyanTheTide
RyanTheTide merged commit 5314798 into integration/aurora Nov 13, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the g17/drained-pair-settle branch November 13, 2026 23:13
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