Skip to content

drm/i915/guc: Fix requests of a banned context never completing

Javier MV intel-gfx 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesNew
  2. v32 patches 0 repliesSuperseded
  3. v22 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches1 replySuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2drm/i915/guc: Complete all requests of a non-schedulable contextdrivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+13 -10 replies
2/2drm/i915/guc: Don't unblock a non-schedulable contextdrivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing

From: Javier MV <[email protected]>

On ADL-P with GuC submission, a GuC context reset during a request watchdog cancellation can leave the context's requests incomplete forever: the client hangs on its fences and, once killed, its buffers stay pinned until reboot (7.5 GB here). Reported in
https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15301.

Sequence (llama.cpp Vulkan compute, request_timeout_ms=2000, preempt_timeout_ms=7500):
1. The watchdog blocks the context to cancel a request.
2. GuC can't preempt the compute work and resets the context. i915 bans it and unwinds its requests.
3. The late schedule disable done clears SCHED_STATE_BANNED, and unblock re-enables the banned context.
4. GuC resets it again at the first preemption. That reset is ignored, and after a full GT reset the dequeue completes only the last of its merged requests.

Patch 1 completes all of them once the context is off the HW. Patch 2 stops unblock from re-enabling a non-schedulable context.

Tested on i5-1235U (8086:46a8), GuC 70.36.0, Ubuntu 7.0.0-42 and -43 (the touched code is identical in mainline). Without the series: 5 hangs in 17 runs, one leaked. With v2: 30 runs, 4 hangs, all contained (VK_ERROR_DEVICE_LOST, nothing pinned). With v4: 30 runs, no regressions, but no hang reproduced.

I can reproduce this (a hang every 10 to 30 runs) and test other approaches. Logs and error states are in the issue.

I have an extra patch that cancels the requests when a banned context gets another reset notification. It never ran in my tests, so I left it out.

Written with Claude Code (Opus 5.5). I ran the tests and reviewed the patches.

v4: patch 1 uses the off-HW test of guc_context_revoke() and leaves the
other cases to the schedule disable done handler (Sashiko).
v3: shorter commit messages and comments (Rodrigo), rebased on v7.4-rc3.
v2: fix a use-after-free in patch 1; patch 2 also covers exiting contexts

    (Sashiko).

v3: https://lore.kernel.org/intel-gfx/[email protected]/
v2: https://lore.kernel.org/intel-gfx/[email protected]/
v1: https://lore.kernel.org/intel-gfx/[email protected]/

Patchwork CI didn't run on v1 to v3 (my address isn't on the CI allowlist). If someone can trigger it for this version, I'd appreciate it.

Javier MV (2):
drm/i915/guc: Complete all requests of a non-schedulable context drm/i915/guc: Don't unblock a non-schedulable context

 .../gpu/drm/i915/gt/uc/intel_guc_submission.c    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.51.1