All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jagmeet Randhawa" <jagmeet.randhawa@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/xe/guc: Fix race around q->guc->suspend_pending access
Date: Tue, 18 Aug 2026 18:51:42 +0000	[thread overview]
Message-ID: <20260818185142.BEFE31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818183838.273486-2-jagmeet.randhawa@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] TDR (Timeout Delay Recovery) races with asynchronous queue suspend, leading to misattributed SCHED_DONE messages, an assertion failure, and a TDR hang.
--

--- Patch [1]: [PATCH v2] drm/xe/guc: Fix race around q->guc->suspend_pending access ---
commit 256a06cec5d42e79b9711d9f1861b3717e23b08f
Author: Jagmeet Randhawa <jagmeet.randhawa@intel.com>

drm/xe/guc: Fix race around q->guc->suspend_pending access

This commit wraps accesses to q->guc->suspend_pending with xe_sched_msg_lock
in the suspend, resume, kill, and ban paths. This ensures that checking the
flag and calling suspend_fence_signal() is atomic with respect to the
asynchronous clears in the kill and ban paths.

> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 9036f89dff7d9..c565c1d32d3a4 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
[ ... ]
> @@ -3222,13 +3234,20 @@ static void handle_sched_done(struct xe_guc *guc, struct xe_exec_queue *q,
>  		smp_wmb();
>  		wake_up_all(&guc->ct.wq);
>  	} else {
> +		bool was_pending;
> +
>  		xe_gt_assert(guc_to_gt(guc), runnable_state == 0);
>  		xe_gt_assert(guc_to_gt(guc), exec_queue_pending_disable(q));
>  
> -		if (q->guc->suspend_pending) {
> +		xe_sched_msg_lock(&q->guc->sched);
> +		was_pending = q->guc->suspend_pending;
> +		if (was_pending) {
>  			clear_exec_queue_pending_disable(q);
>  			suspend_fence_signal(q);
> -		} else {
> +		}
> +		xe_sched_msg_unlock(&q->guc->sched);

[Severity: High]
This is a pre-existing issue, but does this logic misattribute a SCHED_DONE
message if TDR races with an asynchronous queue suspend?

If a queue is being suspended (setting q->guc->suspend_pending = true) and
concurrently a job times out, the TDR handler stops the DRM scheduler,
trapping the SUSPEND message before it can execute. TDR then calls
disable_scheduling(), which directly sends a DISABLE command to the GuC.

When the GuC responds to the DISABLE command with a SCHED_DONE message,
won't handle_sched_done() incorrectly attribute it to the trapped SUSPEND
message because was_pending is still true?

It looks like this would call suspend_fence_signal(q) and trigger an
assertion failure, because the queue was never actually suspended (the
message was trapped) or killed (TDR only bans it). Additionally, skipping
the wake_up_all() call in the other branch might cause the TDR thread to
wait and hang for 5 seconds until it times out.

> +
> +		if (!was_pending) {
>  			if (exec_queue_banned(q)) {
>  				smp_wmb();
>  				wake_up_all(&guc->ct.wq);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818183838.273486-2-jagmeet.randhawa@intel.com?part=1

  parent reply	other threads:[~2026-08-18 18:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 18:38 [PATCH v2] drm/xe/guc: Fix race around q->guc->suspend_pending access Jagmeet Randhawa
2026-08-18 18:45 ` ✓ CI.KUnit: success for drm/xe/guc: Fix race around q->guc->suspend_pending access (rev2) Patchwork
2026-08-18 18:51 ` sashiko-bot [this message]
2026-08-18 20:54   ` [PATCH v2] drm/xe/guc: Fix race around q->guc->suspend_pending access Niranjana Vishwanathapura
2026-08-18 19:32 ` ✓ Xe.CI.BAT: success for drm/xe/guc: Fix race around q->guc->suspend_pending access (rev2) Patchwork
2026-08-18 20:53 ` [PATCH v2] drm/xe/guc: Fix race around q->guc->suspend_pending access Niranjana Vishwanathapura
2026-08-18 21:06   ` Matthew Brost
2026-08-18 21:05 ` Matthew Brost
2026-08-18 23:27   ` Niranjana Vishwanathapura
2026-08-19  1:01     ` Matthew Brost
2026-08-19  3:51       ` Niranjana Vishwanathapura
2026-08-18 22:08 ` ✓ Xe.CI.FULL: success for drm/xe/guc: Fix race around q->guc->suspend_pending access (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=20260818185142.BEFE31F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jagmeet.randhawa@intel.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.