dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Arvind Yadav <arvind.yadav@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <rodrigo.vivi@intel.com>,
	<himal.prasad.ghimiray@intel.com>,
	<thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH 2/5] drm/xe/guc: Wake disable waiters after clearing pending state
Date: Fri, 18 Sep 2026 15:36:21 -0700	[thread overview]
Message-ID: <aq285SiT1wirY125@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260916095337.3104891-3-arvind.yadav@intel.com>

On Wed, Sep 16, 2026 at 03:23:34PM +0530, Arvind Yadav wrote:
> disable_scheduling_deregister() waits for any pending scheduling
> operation to complete before destroying an exec queue.
> 
> For a disable completion, handle_sched_done() can wake the waiter before
> clearing pending_disable, or not wake it at all. The waiter can then miss
> a completed operation and expire after five seconds. This causes a
> spurious GT reset and immediate TDR.
> 
> Clear pending_disable before waking the waitqueue on every completion
> path. Sample the destroyed state before clearing the pending state, as
> required by the existing destroy protocol.
> 
> Also wake CT waiters after a suspend completion.
> The queue remains alive until deregistration completes, so waking
> waiters before sending the deregister request does not release it.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

I feel like this is an independent fix (like patch 1) that can be sent
on its own with a Fixes tag and CC'd to stable. This also looks very
similar to [1].

Can you coordinate with the author of [1]? Alternatively, if that patch
looks good to you, could you give it an RB?

Matt

[1] https://patchwork.freedesktop.org/patch/753791/?series=174199&rev=1

> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c | 42 +++++++++++++++++-------------
>  1 file changed, 24 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index f3ba8abfc228..ca24a77dfb26 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -3265,26 +3265,32 @@ static void handle_sched_done(struct xe_guc *guc, struct xe_exec_queue *q,
>  		if (q->guc->suspend_pending) {
>  			clear_exec_queue_pending_disable(q);
>  			suspend_fence_signal(q);
> +
> +			/*
> +			 * Publish the cleared state before waking waiters.
> +			 */
> +			smp_wmb();
> +			wake_up_all(&guc->ct.wq);
>  		} else {
> -			if (exec_queue_banned(q)) {
> -				smp_wmb();
> -				wake_up_all(&guc->ct.wq);
> -			}
> -			if (exec_queue_destroyed(q)) {
> -				/*
> -				 * Make sure to clear the pending_disable only
> -				 * after sampling the destroyed state. We want
> -				 * to ensure we don't trigger the unregister too
> -				 * early with something intending to only
> -				 * disable scheduling. The caller doing the
> -				 * destroy must wait for an ongoing
> -				 * pending_disable before marking as destroyed.
> -				 */
> -				clear_exec_queue_pending_disable(q);
> +			bool destroyed = exec_queue_destroyed(q);
> +
> +			/*
> +			 * Make sure to clear pending_disable only after sampling
> +			 * the destroyed state. The caller doing the destroy must
> +			 * wait for an ongoing disable before marking the queue
> +			 * destroyed.
> +			 */
> +			clear_exec_queue_pending_disable(q);
> +
> +			/*
> +			 * Publish the cleared state before waking waiters.
> +			 */
> +			smp_wmb();
> +			wake_up_all(&guc->ct.wq);
> +
> +			/* The queue remains alive until DEREGISTER_DONE. */
> +			if (destroyed)
>  				deregister_exec_queue(guc, q);
> -			} else {
> -				clear_exec_queue_pending_disable(q);
> -			}
>  		}
>  	}
>  }
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-09-18 22:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  9:53 [PATCH 0/5] drm/xe: Fix VM teardown and migration queue recovery Arvind Yadav
2026-09-16  9:53 ` [PATCH 1/5] drm/xe: Hold a device reference across deferred VM destruction Arvind Yadav
2026-09-18  3:22   ` Matthew Brost
2026-09-18  7:22     ` Thomas Hellström
2026-09-18 22:41       ` Matthew Brost
2026-09-21  7:06         ` Thomas Hellström
2026-09-16  9:53 ` [PATCH 2/5] drm/xe/guc: Wake disable waiters after clearing pending state Arvind Yadav
2026-09-18 22:36   ` Matthew Brost [this message]
2026-09-21  6:46     ` Yadav, Arvind
2026-09-16  9:53 ` [PATCH 3/5] drm/xe: Mark VMs as closing before queue cleanup Arvind Yadav
2026-09-16  9:53 ` [PATCH 4/5] drm/xe: Defer VM teardown until exec queue cleanup completes Arvind Yadav
2026-09-16  9:53 ` [PATCH 5/5] drm/xe/guc: Reset LRC ring pointers before replay Arvind Yadav
2026-09-18 22:31 ` [PATCH 0/5] drm/xe: Fix VM teardown and migration queue recovery Matthew Brost
2026-09-24 10:06   ` Yadav, Arvind

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=aq285SiT1wirY125@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.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