Intel-XE Archive on 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 1/1] drm/xe/guc: Scale suspend wait timeout with preempt timeout
Date: Fri, 20 Nov 2026 16:15:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-225549@kernel.org> (raw)
In-Reply-To: <20261120160826.2045426-2-himal.prasad.ghimiray@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/xe: int ret truncates long timeout in
  guc_exec_queue_wait_suspend_done()
--

commit 96d69e02f036b099a5f29052501393a26a706962
Author: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

drm/xe/guc: Scale suspend wait timeout with preempt timeout

This commit extends the queue suspend wait timeout in
guc_exec_queue_wait_suspend_done() by adding preempt_timeout_us and
min_run_period_ms to the base 5s timeout.

> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index b14b37b767f5e..66b72a2dacf21 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -2532,8 +2532,20 @@ static int guc_exec_queue_wait_suspend_done(struct xe_exec_queue *q, bool blocki
>  {
>  	struct xe_guc *guc = exec_queue_to_guc(q);
>  	struct xe_device *xe = guc_to_xe(guc);
> +	long timeout;
>  	int ret;
>  
> +	/*
> +	 * The SUSPEND worker may sleep up to min_run_period_ms before disabling,
> +	 * and GuC may then take up to preempt_timeout_us (sysfs tunable up to
> +	 * XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX) to preempt the context. Keep the
> +	 * historical 5s as slack on top of both.
> +	 */
> +	timeout = HZ * 5 +
> +		usecs_to_jiffies(READ_ONCE(q->sched_props.preempt_timeout_us));
> +	if (q->vm)
> +		timeout += msecs_to_jiffies(q->vm->preempt.min_run_period_ms);
> +
>  	/*
>  	 * A kill does not clear suspend_pending, the queue may still be running
>  	 * on the hardware, so exec_queue_killed() is what ends the wait in that
> @@ -2546,16 +2558,16 @@ static int guc_exec_queue_wait_suspend_done(struct xe_exec_queue *q, bool blocki
>  retry:
>  	if (blocking) {
>  		if (IS_SRIOV_VF(xe))
> -			ret = wait_event_timeout(guc->ct.wq, WAIT_COND, HZ * 5);
> +			ret = wait_event_timeout(guc->ct.wq, WAIT_COND, timeout);
>  		else
>  			ret = wait_event_timeout(q->guc->suspend_wait, WAIT_COND,
> -						 HZ * 5);
> +						 timeout);
>  	} else if (IS_SRIOV_VF(xe)) {
>  		ret = wait_event_interruptible_timeout(guc->ct.wq, WAIT_COND ||
> -						       vf_recovery(guc), HZ * 5);
> +						       vf_recovery(guc), timeout);
>  	} else {
>  		ret = wait_event_interruptible_timeout(q->guc->suspend_wait,
> -						       WAIT_COND, HZ * 5);
> +						       WAIT_COND, timeout);
>  	}

[Severity: Low]
Should ret be a long to match timeout and the return type of
wait_event_timeout() / wait_event_interruptible_timeout()?

min_run_period_lr_ms_set() in drivers/gpu/drm/xe/xe_debugfs.c accepts any
u32 value without an upper bound.  If timeout exceeds INT_MAX jiffies on a
64-bit system, storing the remaining jiffies into int ret truncates the
result, which can make !ret or ret < 0 evaluate true and falsely return
-ETIME (banning a healthy queue) or a bogus negative error code.

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

  reply	other threads:[~2026-11-20 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 16:08 [PATCH 1/1] drm/xe/guc: Scale suspend wait timeout with preempt timeout Himal Prasad Ghimiray
2026-11-20 16:15 ` sashiko-bot [this message]
2026-11-20 16:16 ` ✓ CI.KUnit: success for series starting with [1/1] " 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-225549@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox