From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>,
"Matt Roper" <matthew.d.roper@intel.com>,
Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums
Date: Tue, 29 Sep 2026 23:51:22 -0400 [thread overview]
Message-ID: <aryHOoaUA-GrZA9Q@intel.com> (raw)
In-Reply-To: <20260929192037.2233429-2-alan.previn.teres.alexis@intel.com>
On Tue, Sep 29, 2026 at 12:20:37PM -0700, Alan Previn wrote:
> Check for overflow in udelay use in __xe_mmio_wait32 and
> avoid growing delays becoming intollerably large by capping the
> in-loop wait time.
>
> v7: - Change assisted-by to "LLM" (Rodrigo).
> - Move the max-wait macro to outside the function (Rodrigo).
> v6: - Fix commit message to remove items dropped in v5. Fix the
> use of MAX_UDELAY_MS for microsecond unit. (Shasiko review).
> v5: - Simplify: don't introduce additional redesign and
> use min_t with a backoff to cap wait. (Rodrigo).
> v4: - Simplify using poll_timeout_us and poll_timeout_us_atomic and
> update all callers to never use a param for atomic (Jani)
> v3: - Use div64_s64 kernel API for 32-bit vs 64-bit division.
> v2: - Fixed checkpatch failure.
> - Added helper for 64-bit DIV_ROUND_UP on 32-bit CPU (Shasiko
> review). Fixed bug max range in usleep_range(Shasiko review)
>
> Fixes: 5c09bd6ccd41 ("drm/xe/mmio: Move xe_mmio_wait32() to xe_mmio.c")
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Assisted-by: LLM
> ---
pushed to drm-xe-next.
Thanks a lot for the fix and the patience ;)
> drivers/gpu/drm/xe/xe_mmio.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> index 7fa18dfcb5a2..455a07d79cd9 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
> @@ -320,6 +320,7 @@ u64 xe_mmio_read64_2x32(struct xe_mmio *mmio, struct xe_reg reg)
> return (u64)udw << 32 | ldw;
> }
>
> +#define __XE_MMIO_WAIT_MAX_BACKOFF_100MS (100 * USEC_PER_MSEC)
> static int __xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val,
> u32 timeout_us, u32 *out_val, bool atomic, bool expect_match)
> {
> @@ -350,10 +351,10 @@ 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 * 1000)));
> else
> usleep_range(wait, wait << 1);
> - wait <<= 1;
> + wait = min_t(s64, wait << 1, __XE_MMIO_WAIT_MAX_BACKOFF_100MS);
> }
>
> if (ret != 0) {
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-09-30 3:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 19:20 [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums Alan Previn
2026-09-30 3:51 ` Rodrigo Vivi [this message]
-- strict thread matches above, loose matches on Subject: below --
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-29 5:44 Alan Previn
2026-09-29 5:49 ` sashiko-bot
2026-09-29 17:51 ` Rodrigo Vivi
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=aryHOoaUA-GrZA9Q@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=alan.previn.teres.alexis@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=matthew.d.roper@intel.com \
/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