* [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing
@ 2026-11-19 14:56 Javier MV
2026-11-19 14:56 ` [PATCH v4 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Javier MV @ 2026-11-19 14:56 UTC (permalink / raw)
To: intel-gfx
Cc: Javier MV, jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin,
matthew.brost, daniele.ceraolospurio, umesh.nerlige.ramappa
From: Javier MV <javiermv@duck.com>
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/20261116115958.9499-1-javiermv@gmail.com/
v2: https://lore.kernel.org/intel-gfx/20261111135753.11071-1-javiermv@gmail.com/
v1: https://lore.kernel.org/intel-gfx/20261110122534.12989-1-javiermv@gmail.com/
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
--
2.51.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v4 1/2] drm/i915/guc: Complete all requests of a non-schedulable context
2026-11-19 14:56 [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
@ 2026-11-19 14:56 ` Javier MV
2026-11-19 14:56 ` [PATCH v4 2/2] drm/i915/guc: Don't unblock " Javier MV
2026-11-19 15:32 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev4) Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Javier MV @ 2026-11-19 14:56 UTC (permalink / raw)
To: intel-gfx
Cc: Javier MV, jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin,
matthew.brost, daniele.ceraolospurio, umesh.nerlige.ramappa
From: Javier MV <javiermv@duck.com>
guc_dequeue_one_context() merges the queued requests of a context and
passes only the last one to __guc_add_request(), which marks only that
one complete when the context is banned or exiting. The earlier ones
are on ce->guc_state.requests and need the context to run to signal
their breadcrumbs. After a full GT reset the context is unregistered and
never runs again, so they never complete and their objects stay pinned.
Seen on ADL-P after a GuC context reset of a Vulkan compute job: the
client waited on its fences forever, and 7.5 GB stayed pinned after it
was killed.
Complete every request on the list once the context is off the HW, with
the same test as guc_context_revoke(). Otherwise leave them to the
schedule disable done handler, which cancels the whole list in order.
Found with the help of Claude Code.
Fixes: ae8ac10dfd2a ("drm/i915/guc: Implement banned contexts for GuC submission")
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15301
Signed-off-by: Javier MV <javiermv@duck.com>
---
v4:
- Same off-HW test as guc_context_revoke(), and no else branch:
completing rq alone was out of order, and a pending enable left by a
reset kept the earlier requests from completing (Sashiko).
v3:
- Shorter commit message and comment (Rodrigo).
v2:
- Complete rq on its own only when the loop doesn't run, under the
lock. v1 completed it again after the unlock, when the loop had
already completed it and it could have been retired and freed
(Sashiko).
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 788e59cdfac9..111cd4c89ad3 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -709,7 +709,19 @@ static int __guc_add_request(struct intel_guc *guc, struct i915_request *rq)
* request resubmitted after the context was banned.
*/
if (unlikely(!intel_context_is_schedulable(ce))) {
- i915_request_put(i915_request_mark_eio(rq));
+ struct i915_request *pos;
+
+ /*
+ * rq and the requests merged before it are on
+ * ce->guc_state.requests. If the context is off the HW, complete
+ * them all here; otherwise the schedule disable done handler will.
+ */
+ spin_lock(&ce->guc_state.lock);
+ if (!context_enabled(ce) && !context_pending_disable(ce))
+ list_for_each_entry(pos, &ce->guc_state.requests, sched.link)
+ i915_request_put(i915_request_mark_eio(pos));
+ spin_unlock(&ce->guc_state.lock);
+
intel_engine_signal_breadcrumbs(ce->engine);
return 0;
}
--
2.51.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v4 2/2] drm/i915/guc: Don't unblock a non-schedulable context
2026-11-19 14:56 [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-19 14:56 ` [PATCH v4 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
@ 2026-11-19 14:56 ` Javier MV
2026-11-19 15:32 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev4) Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Javier MV @ 2026-11-19 14:56 UTC (permalink / raw)
To: intel-gfx
Cc: Javier MV, jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin,
matthew.brost, daniele.ceraolospurio, umesh.nerlige.ramappa
From: Javier MV <javiermv@duck.com>
If a context is banned or revoked while guc_context_cancel_request() has
it blocked, guc_context_revoke() finds the block's schedule disable
pending and leaves the cancellation to its done handler, which clears
SCHED_STATE_BANNED. guc_context_unblock() then enables scheduling again.
GuC resets the context at the first preemption (1 ms timeout), the
second reset is ignored, and on ADL-P this ended in a full GT reset.
Also check intel_context_is_schedulable(), which stays false.
Found with the help of Claude Code.
Fixes: 9888beaaf118 ("drm/i915/guc: Don't enable scheduling on a banned context, guc_id invalid, not registered")
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15301
Signed-off-by: Javier MV <javiermv@duck.com>
---
v4:
- No changes.
v3:
- Shorter commit message and comment (Rodrigo).
v2:
- Check !intel_context_is_schedulable() instead of
intel_context_is_banned(): revoke takes the same path for exiting
contexts (Sashiko).
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 111cd4c89ad3..046a2f47db0c 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -3180,7 +3180,9 @@ static bool context_cant_unblock(struct intel_context *ce)
{
lockdep_assert_held(&ce->guc_state.lock);
+ /* The sched disable done handler clears SCHED_STATE_BANNED */
return (ce->guc_state.sched_state & SCHED_STATE_NO_UNBLOCK) ||
+ !intel_context_is_schedulable(ce) ||
context_guc_id_invalid(ce) ||
!ctx_id_mapped(ce_to_guc(ce), ce->guc_id.id) ||
!intel_context_is_pinned(ce);
--
2.51.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev4)
2026-11-19 14:56 [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-19 14:56 ` [PATCH v4 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
2026-11-19 14:56 ` [PATCH v4 2/2] drm/i915/guc: Don't unblock " Javier MV
@ 2026-11-19 15:32 ` Patchwork
2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2026-11-19 15:32 UTC (permalink / raw)
To: Javier MV; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/guc: Fix requests of a banned context never completing (rev4)
URL : https://patchwork.freedesktop.org/series/178201/
State : failure
== Summary ==
Series author address 'javiermv@gmail.com' is not on the allowlist, which prevents CI from being automatically triggered.
If you want CI to run for this series, ask Patchwork project owners to click 'retest' on the series in Patchwork.
Exception occurred during validation, bailing out!
Build URL: http://gfx-ci.igk.intel.com:8080/job/CI_PW_kernel/193495/ (on built-in)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-19 15:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 14:56 [PATCH v4 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-19 14:56 ` [PATCH v4 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
2026-11-19 14:56 ` [PATCH v4 2/2] drm/i915/guc: Don't unblock " Javier MV
2026-11-19 15:32 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev4) Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.