Skip to content

drm/asahi: finish an exiting client's work before its mappings go - #1360

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
gpu/legacy-exit-drain
Nov 9, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
gpu/legacy-exit-drain

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Killing a Vulkan client with rendering in flight on T8112 (and once seen on T6000) gives a firmware timeout with a read fault on an unmapped address of the client's VM (UL1C or dVDM_CSD, reason: Unmapped), then GPU recovery. SIGTERM of gpubench-vk --test render.heavy --param kind=fill --param res=1080p --depths 4 about 0.5 s into the run reproduces it on the first kill.

The legacy (G13/G14) VMs carry no job lifetime. When the client's DRM file goes away, drm_file_free() closes its GEM handles first, and AsahiObject::close() unmaps each object from the client's VMs at once; File then drops the VMs, which unmaps the rest of the user range, before its queues. All of this happens while the client's jobs still run in the firmware.

  • The queue trait gets a drain() hook. The legacy queue waits there, for at most 5 s, on the finished fence of its last submitted job (the jobs of one queue complete in order).
  • The first GEM handle close of an exiting task (PF_EXITING, which covers exit, SIGTERM and SIGKILL) drains every queue of the file once.
  • File drops its queues before its VMs, and a legacy queue waits the same way when it is dropped, also when it is destroyed by ioctl.
  • G15 and later VMs keep user mappings until their jobs release them; their queues keep the no-op drain().

Results (M2, T8112)

kernel kills with work in flight GPU timeouts / faults
fleet44 base 1 SIGTERM, 2 runs 2 / 2 (each run on the first kill)
this change 50 SIGTERM + 10 SIGKILL 0 / 0
  • The client exits 22-28 ms after the signal (the in-flight frames), and the 5 s bound was never reached.
  • Fleet quick suite on a one-shot boot (fleet44 + this change): no regressions, 0 AVC, 0 failed units, 0 kernel errors.
  • Host tests 199/199.

🤖 Generated with Claude Code

Killing a Vulkan client with rendering in flight on T8112 (and once on
T6000) gave a firmware timeout with a read fault on an unmapped address
of the client's VM (UL1C or dVDM_CSD), then recovery. SIGTERM of
gpubench-vk render.heavy fill 1080p at depth 4 reproduces it on the
first try.

The legacy (G13/G14) VMs carry no job lifetime. When the client's DRM
file goes away, DRM first closes its GEM handles, and closing a handle
unmaps the object from the client's VMs at once; File then drops the
VMs, which unmaps the rest of the user range, before its queues. All of
it happens while the client's jobs still run in the firmware.

Give the queue trait a drain() hook. The legacy queue waits there, for
at most 5 s, on the finished fence of its last submitted job; the jobs
of one queue complete in order, so that fence covers all of them. The
first GEM handle close of an exiting task drains every queue of the
file once, and the queues now drop before the VMs and wait the same way
(also when destroyed by ioctl). G15 and later VMs keep user mappings
until their jobs release them, so their queues keep the no-op drain.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
@RyanTheTide
RyanTheTide merged commit 5135a14 into integration/aurora Nov 9, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the gpu/legacy-exit-drain branch November 9, 2026 16:53
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