dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alan Previn" <alan.previn.teres.alexis@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums
Date: Tue, 29 Sep 2026 05:49:59 +0000	[thread overview]
Message-ID: <20260929054959.B803C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260929054444.1933871-2-alan.previn.teres.alexis@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/xe: udelay capped at 5us due to MAX_UDELAY_MS unit mismatch
- [Medium] drm/xe: commit message claims DIV_ROUND_UP helper but code is missing
--

commit cceb24ccd008b44c48532606a8d174234bb68933
Author: Alan Previn <alan.previn.teres.alexis@intel.com>

drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums

This commit modifies __xe_mmio_wait32() to cap delay values to avoid
intolerably large waits. It picks the appropriate sleep or delay helpers
based on atomic context and wait duration.

>     Check for overflow in udelay/usleep_range use in __xe_mmio_wait32
>     and pick the correct helper according to the wait time and atomic.
>     Implement a similar helper to replace DIV_ROUND_UP for 32-bit CPUs.

[Severity: Medium]
The commit message explicitly states "Implement a similar helper to replace
DIV_ROUND_UP for 32-bit CPUs", but the patch does not contain any such
implementation in __xe_mmio_wait32() or elsewhere.

Was this code intended to be included, or is the commit message outdated from
previous iterations of this patch?

> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> index 7fa18dfcb5a28..c7c37e59dab05 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
> @@ -350,10 +350,11 @@ static int __xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u
>  			wait = ktime_us_delta(end, cur);
>  
>  		if (atomic)
> -			udelay(wait);
> +			udelay(min_t(s64, wait, MAX_UDELAY_MS));

[Severity: Medium]
Is there a unit mismatch here in __xe_mmio_wait32() between wait and
MAX_UDELAY_MS?

The wait variable is calculated in microseconds, but MAX_UDELAY_MS is a
constant representing milliseconds. By using min_t() with MAX_UDELAY_MS
directly, the udelay() argument appears to be incorrectly capped at a few
microseconds instead of the intended millisecond equivalent (e.g.,
MAX_UDELAY_MS * 1000).

If the wait grows beyond a few microseconds, could this unit mismatch
completely defeat the exponential backoff for atomic MMIO waits, causing the
CPU to poll the MMIO bus indefinitely at small intervals instead of backing
off?

>  		else
>  			usleep_range(wait, wait << 1);
> -		wait <<= 1;
> +#define __XE_MMIO_WAIT_MAX_BACKOFF_100MS (100 * USEC_PER_MSEC)
> +		wait = min_t(s64, wait << 1, __XE_MMIO_WAIT_MAX_BACKOFF_100MS);
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929054444.1933871-2-alan.previn.teres.alexis@intel.com?part=1

  reply	other threads:[~2026-09-29  5:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  5:44 [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums Alan Previn
2026-09-29  5:49 ` sashiko-bot [this message]
2026-09-29 17:51 ` Rodrigo Vivi
  -- strict thread matches above, loose matches on Subject: below --
2026-09-29 19:20 Alan Previn
2026-09-30  3:51 ` Rodrigo Vivi
2026-09-29 15:25 Alan Previn
2026-09-29 16:18 ` sashiko-bot
2026-09-29 19:07   ` Teres Alexis, Alan Previn
2026-09-14 21:57 Alan Previn
2026-09-14 22:16 ` sashiko-bot
2026-09-15  7:34 ` Jani Nikula
2026-09-15 16:00   ` Teres Alexis, Alan Previn
2026-09-15 16:43     ` Jani Nikula
2026-09-15 22:51     ` Rodrigo Vivi
2026-09-16 19:10       ` Teres Alexis, Alan Previn
2026-09-17  0:54         ` Rodrigo Vivi
2026-09-17  2:07           ` Teres Alexis, Alan Previn
2026-09-17 18:49             ` Teres Alexis, Alan Previn
2026-09-08 20:33 Alan Previn
2026-09-08 18:56 Alan Previn
2026-09-08 19:03 ` sashiko-bot
2026-09-09  8:00 ` Jani Nikula
2026-09-11  0:05   ` Teres Alexis, Alan Previn
2026-09-07 23:55 Alan Previn
2026-09-08  0:02 ` sashiko-bot

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=20260929054959.B803C1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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