All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Javier MV" <javiermv@gmail.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm/i915/guc: Complete all requests of a non-schedulable context
Date: Wed, 11 Nov 2026 14:40:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-209177@kernel.org> (raw)
In-Reply-To: <20261111135753.11071-2-javiermv@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/i915/guc: out-of-order request completion in
  __guc_add_request()
--

commit ab2fec244e71c5f1800fda0182eb817d04ef826f
Author: Javier MV <javiermv@duck.com>

drm/i915/guc: Complete all requests of a non-schedulable context

When submitting a request for a non-schedulable context, this commit marks
all requests on ce->guc_state.requests complete with -EIO once the 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..b2ffc6b4614e4 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,25 @@ 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;
> +
> +		/*
> +		 * The dequeue only passes the last of the merged requests, and
> +		 * the context won't run again to write the others' breadcrumbs:
> +		 * complete them all (rq is on the list too), once the context
> +		 * is off the HW. Don't touch rq after the unlock: once complete
> +		 * it can be retired and freed.
> +		 */
> +		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));
> +		}

[Severity: High]
Does the else branch complete rq out of order ahead of earlier requests on
the same timeline?

Before calling __guc_add_request(), guc_dequeue_one_context() and
guc_bypass_tasklet_submit() move every submitted request onto
ce->guc_state.requests via __i915_request_submit() and pass only the final
request as rq.  When the context is still on the hardware or has an enable
or disable in flight, marking only rq complete leaves earlier merged or
in-flight requests on ce->guc_state.requests and tl->requests incomplete.

Because __i915_active_fence_set() moves active tracking callbacks to the
newest request on the timeline, completing rq early retires vma->active and
ce->active while the GPU is still executing earlier requests on the context,
and trips the check in i915_request_retire_upto():

drivers/gpu/drm/i915/i915_request.c:i915_request_retire_upto() {
	do {
		tmp = list_first_entry(&tl->requests, typeof(*tmp), link);
		GEM_BUG_ON(!i915_request_completed(tmp));
	} while (i915_request_retire(tmp) && tmp != rq);
}

Also, if context_pending_enable(ce) is set while !context_enabled(ce) &&
!context_pending_disable(ce) (for example after __guc_reset_context() clears
SCHED_STATE_ENABLED while an enable G2H is still in flight),
intel_guc_sched_done_process_msg() only clears SCHED_STATE_PENDING_ENABLE
without calling guc_cancel_context_requests(), so the earlier merged
requests are never completed.

Since rq is already on ce->guc_state.requests, should the else branch leave
rq incomplete so guc_cancel_context_requests() completes the whole list in
order once the context is off the hardware?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111135753.11071-1-javiermv@gmail.com?part=1

  reply	other threads:[~2026-11-11 14:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 13:57 [PATCH v2 0/2] drm/i915/guc: Fix requests of a banned context never completing Javier MV
2026-11-11 13:57 ` [PATCH v2 1/2] drm/i915/guc: Complete all requests of a non-schedulable context Javier MV
2026-11-11 14:40   ` sashiko-bot [this message]
2026-11-11 15:33     ` Javier MV
2026-11-11 15:29   ` Vivi, Rodrigo
2026-11-11 13:57 ` [PATCH v2 2/2] drm/i915/guc: Don't unblock " Javier MV
2026-11-11 15:01 ` ✗ LGCI.VerificationFailed: failure for drm/i915/guc: Fix requests of a banned context never completing (rev2) 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=sashiko-outbox-209177@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=javiermv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 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.