Intel-XE Archive on 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] drm/xe/guc: Fix race around q->guc->suspend_pending access
Date: Fri, 14 Aug 2026 01:01:08 +0000	[thread overview]
Message-ID: <20260814010109.5F1811F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813201847.201867-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 firing concurrently with a queue suspend request routes the GuC DISABLE response incorrectly, leading to an assertion failure and an unnecessary GT reset.
--

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

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

This patch wraps accesses to q->guc->suspend_pending with the msg_lock to
prevent concurrent clear and check-then-act sequences from tripping assertions.
The lock is extended across suspend and resume paths, as well as kill and ban.

> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c

[ ... ]

> @@ -3092,13 +3104,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);
> +
> +		if (!was_pending) {
>  			if (exec_queue_banned(q)) {
>  				smp_wmb();
>  				wake_up_all(&guc->ct.wq);

[Severity: High]
This is a pre-existing issue, but does routing the GuC DISABLE response based
solely on was_pending fail to account for TDR-initiated DISABLEs?

If a Timeout Detection and Recovery (TDR) event fires concurrently with a queue
suspend request, it seems the following sequence could occur:

1. TDR stops the scheduler but hasn't yet marked the queue as BANNED.
2. A suspend request sets q->guc->suspend_pending = true. The SUSPEND message
   is never processed because the scheduler is stopped.
3. TDR marks the queue as BANNED and sends a DISABLE action to GuC.
4. When GuC replies to the TDR's DISABLE, handle_sched_done() sees
   was_pending == true and calls suspend_fence_signal(q).

Will this trip the assertion in suspend_fence_signal(q) because the queue is
BANNED, not SUSPENDED, and also skip the !was_pending block, causing a missed
wakeup for TDR and an unnecessary full GT reset?

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

  parent reply	other threads:[~2026-08-14  1:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 20:18 [PATCH] drm/xe/guc: Fix race around q->guc->suspend_pending access Jagmeet Randhawa
2026-08-13 20:28 ` ✓ CI.KUnit: success for " Patchwork
2026-08-13 21:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-14  1:01 ` sashiko-bot [this message]
2026-08-14  1:22 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-14  3:51 ` [PATCH] " Niranjana Vishwanathapura

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=20260814010109.5F1811F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox