Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Javier MV <javiermv@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Javier MV <javiermv@duck.com>,
	jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com, tursulin@ursulin.net,
	matthew.brost@intel.com, daniele.ceraolospurio@intel.com,
	umesh.nerlige.ramappa@intel.com
Subject: [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context
Date: Mon, 16 Nov 2026 11:59:47 +0000	[thread overview]
Message-ID: <20261116115958.9499-2-javiermv@gmail.com> (raw)
In-Reply-To: <20261116115958.9499-1-javiermv@gmail.com>

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


  reply	other threads:[~2026-11-16 12:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-16 12:40   ` [PATCH v3 1/2] drm/i915/guc: Complete all requests of a non-schedulable context 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116115958.9499-2-javiermv@gmail.com \
    --to=javiermv@gmail.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=javiermv@duck.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tursulin@ursulin.net \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox