All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Himal Prasad Ghimiray" <himal.prasad.ghimiray@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/guc: Restore TDR timeout when resubmitting jobs after GT reset
Date: Tue, 01 Dec 2026 18:31:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-243971@kernel.org> (raw)
In-Reply-To: <20261201180419.3211018-2-himal.prasad.ghimiray@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/guc: race in guc_exec_queue_start() overwrites kill
  TDR timeout
--

commit 2ed1517ec035f7e7c46006fffdc88ad66148b770
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

drm/xe/guc: Restore TDR timeout when resubmitting jobs after GT reset

This commit calls xe_sched_reinit() in guc_exec_queue_start() to restore
the scheduler timeout before resubmitting jobs after a GT reset.

> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index fce39dd4e1177..3015d55e86df2 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -3141,6 +3141,8 @@ static void guc_exec_queue_start(struct xe_exec_queue *q)
>  						     xe_lrc_ring_head(q->lrc[i]));
>  			}
>  		}
> +		/* Undo a prior xe_sched_tdr_queue_imm() zeroing the timeout */
> +		xe_sched_reinit(sched);
>  		xe_sched_resubmit_jobs(sched);
>  	}

[Severity: Medium]
Can a concurrent guc_exec_queue_kill() have its zeroed TDR timeout
overwritten by xe_sched_reinit() here, leaving pending jobs unsubmitted
and never cleaned up?

guc_exec_queue_kill() does not take guc->submission_state.lock.  If
userspace destroys a queue or closes the file descriptor during a GT
reset after guc_exec_queue_start() checks
exec_queue_killed_or_banned_or_wedged(q):

CPU0                                  CPU1
guc_exec_queue_start(q)
  !exec_queue_killed_or_banned...
                                      guc_exec_queue_kill(q)
                                        set_exec_queue_killed(q)
                                        xe_guc_exec_queue_trigger_cleanup(q)
                                          xe_sched_tdr_queue_imm(sched)
                                            sched->base.timeout = 0
                                            mod_delayed_work(..., 0)
  xe_sched_reinit(sched)
    sched->base.timeout = sched->timeout
  xe_sched_resubmit_jobs(sched)
    guc_exec_queue_run_job()
      /* sees KILLED, skips GuC submit */
  ...
  xe_sched_submission_resume_tdr(sched)
    mod_delayed_work(..., sched->timeout)  <-- replaces 0-delay TDR

Because guc_exec_queue_run_job() re-checks
exec_queue_killed_or_banned_or_wedged(q), it skips submitting the
pending jobs to GuC and relies on TDR to signal and free them.  On
long-running queues where sched->timeout is MAX_SCHEDULE_TIMEOUT,
work_tdr never fires, leaking the pending jobs, the xe_exec_queue
reference, the GuC ID, and the runtime PM reference; on normal queues,
cleanup stalls for the full job_timeout_ms.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201180419.3211018-2-himal.prasad.ghimiray@intel.com?part=1

  parent reply	other threads:[~2026-12-01 18:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 18:04 [PATCH] drm/xe/guc: Restore TDR timeout when resubmitting jobs after GT reset Himal Prasad Ghimiray
2026-12-01 18:09 ` ✓ CI.KUnit: success for " Patchwork
2026-12-01 18:16 ` [PATCH] " Matthew Brost
2026-12-01 18:24 ` Raag Jadav
2026-12-01 18:31 ` sashiko-bot [this message]
2026-12-01 18:42 ` ✓ Xe.CI.BAT: success for " 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-243971@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --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.