* [PATCH v3 0/2] drm/i915/guc: Fix requests of a banned context never completing
@ 2026-11-16 11:59 Javier MV
2026-11-16 11:59 ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Javier MV @ 2026-11-16 11:59 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 (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). v3 changes only text.
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.
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).
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 or v2 (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 | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.51.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context
2026-11-16 11:59 [PATCH v3 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
@ 2026-11-16 11:59 ` Javier MV
2026-11-16 12:40 ` sashiko-bot
2026-11-16 11:59 ` [PATCH v3 2/2] drm/i915/guc: Don't unblock " Javier MV
2026-11-16 14:18 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev3) Patchwork
2 siblings, 1 reply; 5+ messages in thread
From: Javier MV @ 2026-11-16 11:59 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, as
guc_cancel_context_requests() does.
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>
---
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).
.../gpu/drm/i915/gt/uc/intel_guc_submission.c | 17 ++++++++++++++++-
1 file changed, 16 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..229fa0fd3714 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,22 @@ 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;
+
+ /*
+ * Only the last merged request is passed in. Once the context
+ * is off the HW, complete all of them (rq included).
+ */
+ spin_lock(&ce->guc_state.lock);
+ if (!context_enabled(ce) && !context_pending_enable(ce) &&
+ !context_pending_disable(ce)) {
+ list_for_each_entry(pos, &ce->guc_state.requests, sched.link)
+ i915_request_put(i915_request_mark_eio(pos));
+ } else {
+ i915_request_put(i915_request_mark_eio(rq));
+ }
+ spin_unlock(&ce->guc_state.lock);
+
intel_engine_signal_breadcrumbs(ce->engine);
return 0;
}
--
2.51.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context
2026-11-16 11:59 ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
@ 2026-11-16 12:40 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-11-16 12:40 UTC (permalink / raw)
To: Javier MV, intel-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/i915/guc: out-of-order completion and missed cancel in
__guc_add_request()
--
commit 8c211d88b3b41f45abe7f135b95dfbf93ce1feef
Author: Javier MV <javiermv@duck.com>
drm/i915/guc: Complete all requests of a non-schedulable context
This commit completes all queued requests on ce->guc_state.requests in
__guc_add_request() when a non-schedulable context is off the hardware.
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15301
> 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 788e59cdfac9b..229fa0fd3714b 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,22 @@ 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;
> +
> + /*
> + * Only the last merged request is passed in. Once the context
> + * is off the HW, complete all of them (rq included).
> + */
> + spin_lock(&ce->guc_state.lock);
> + if (!context_enabled(ce) && !context_pending_enable(ce) &&
> + !context_pending_disable(ce)) {
> + list_for_each_entry(pos, &ce->guc_state.requests, sched.link)
> + i915_request_put(i915_request_mark_eio(pos));
> + } else {
> + i915_request_put(i915_request_mark_eio(rq));
> + }
> + spin_unlock(&ce->guc_state.lock);
> +
> intel_engine_signal_breadcrumbs(ce->engine);
> return 0;
> }
[Severity: High]
Does the else branch complete rq out of order while earlier merged or
in-flight requests on the same context are still incomplete?
Both guc_dequeue_one_context() and guc_bypass_tasklet_submit() call
__i915_request_submit() -> add_to_context() on every merged request before
calling guc_add_request(), placing them in sequence order on
ce->guc_state.requests and ce->timeline->requests. When the context is
still enabled or pending disable, those earlier requests remain incomplete
until the schedule-disable G2H calls guc_cancel_context_requests().
Marking only the tail request rq complete here violates timeline ordering:
i915_request_retire_upto() hits GEM_BUG_ON(!i915_request_completed(tmp)) on
the older requests, and __i915_active_fence_set() retires vma->active and
ce->active callbacks attached to rq while earlier requests are still
running on the GPU.
Checking !context_pending_enable(ce) can also leave the earlier merged
requests uncompleted forever. If __guc_reset_context() clears
SCHED_STATE_ENABLED while SCHED_STATE_PENDING_ENABLE is still set,
guc_context_revoke() sees !context_enabled(ce) && !context_pending_disable(ce)
and does not send a schedule-disable H2G, while intel_guc_sched_done_process_msg()
only clears SCHED_STATE_PENDING_ENABLE when the pending-enable G2H arrives
without calling guc_cancel_context_requests().
Matching guc_context_revoke() by checking !context_enabled(ce) &&
!context_pending_disable(ce) and dropping the else branch would avoid both
issues, since rq is already on ce->guc_state.requests and will be completed
in order by guc_cancel_context_requests() once the schedule-disable
completes.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116115958.9499-1-javiermv@gmail.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] drm/i915/guc: Don't unblock a non-schedulable context
2026-11-16 11:59 [PATCH v3 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-16 11:59 ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
@ 2026-11-16 11:59 ` Javier MV
2026-11-16 14:18 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev3) Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Javier MV @ 2026-11-16 11:59 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>
---
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 229fa0fd3714..8a3a39da4963 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -3183,7 +3183,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] 5+ messages in thread* ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev3)
2026-11-16 11:59 [PATCH v3 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-16 11:59 ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
2026-11-16 11:59 ` [PATCH v3 2/2] drm/i915/guc: Don't unblock " Javier MV
@ 2026-11-16 14:18 ` Patchwork
2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2026-11-16 14:18 UTC (permalink / raw)
To: Javier MV; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/guc: Fix requests of a banned context never completing (rev3)
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/193335/ (on built-in)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-16 14:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 11:59 [PATCH v3 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-16 11:59 ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
2026-11-16 12:40 ` sashiko-bot
2026-11-16 11:59 ` [PATCH v3 2/2] drm/i915/guc: Don't unblock " Javier MV
2026-11-16 14:18 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev3) 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.