intel-xe.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alan Previn" <alan.previn.teres.alexis@intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums
Date: Mon, 14 Sep 2026 22:16:42 +0000	[thread overview]
Message-ID: <20260914221643.379F81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914215746.272721-2-alan.previn.teres.alexis@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mmio: fixed 10us delay in long waits causes hrtimer/context switch storms
--

commit c92012bfe0677557677a0dcb08c9a338f44452fd
Author: Alan Previn <alan.previn.teres.alexis@intel.com>
Subject: drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums

This commit replaces the custom wait implementation in the driver with the
standard poll_timeout_us and poll_timeout_us_atomic macros. It drops the
atomic flag from xe_mmio_wait32 parameters, updating callers and adding
explicit _atomic variants where needed.

> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
[ ... ]
> @@ -1574,7 +1574,7 @@ int xe_guc_mmio_send_recv(struct xe_guc *guc, const u32 *request,
>  		BUILD_BUG_ON((GUC_HXG_TYPE_RESPONSE_SUCCESS ^ GUC_HXG_TYPE_RESPONSE_FAILURE) != 1);
>  
>  		ret = xe_mmio_wait32(mmio, reply_reg, resp_mask, resp_mask,
> -				     2000000, &header, false);
> +					     2000000, &header);

[Severity: High]
Does this change cause an excessive number of hrtimers or context switches
for long waits?

For example, in xe_guc_mmio_send_recv(), the 2,000,000us timeout here could
result in ~200,000 sleep/wake cycles if the hardware is slow or hits the
timeout. The previous custom wait implementation used an exponential backoff to
handle these long wait periods without flooding the system.

[ ... ]
> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
[ ... ]
>  int xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val, u32 timeout_us,
> -		   u32 *out_val, bool atomic)
> +		   u32 *out_val)
>  {
> -	return __xe_mmio_wait32(mmio, reg, mask, val, timeout_us, out_val, atomic, true);
> +	u32 read;
> +	int ret;
> +
> +	ret = poll_timeout_us(read = xe_mmio_read32(mmio, reg), (read & mask) == val,
> +			      10, timeout_us, false);

[Severity: High]
Will hardcoding a 10us sleep interval here cause context switch storms and
PCIe bus flooding during long operations?

Certain callers like __xe_driver_flr() wait up to 3 seconds, and
xe_gsc_wait_for_proxy_init_done() waits up to 1 second. Using a fixed 10us
interval means those paths might invoke usleep_range() tens of thousands of
times if the full timeout is reached.

Could this degrade system performance, and does it warrant re-introducing
an exponential backoff scaling for longer wait periods instead of a fixed
interval?

> +	if (out_val)
> +		*out_val = read;
> +
> +	return ret;
>  }
[ ... ]
>  int xe_mmio_wait32_not(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val, u32 timeout_us,
> -		       u32 *out_val, bool atomic)
> +		       u32 *out_val)
>  {
> -	return __xe_mmio_wait32(mmio, reg, mask, val, timeout_us, out_val, atomic, false);
> +	u32 read;
> +	int ret;
> +
> +	ret = poll_timeout_us(read = xe_mmio_read32(mmio, reg), (read & mask) != val,
> +			      10, timeout_us, false);

[Severity: High]
Similar to xe_mmio_wait32() above, does applying a fixed 10us sleep interval
in xe_mmio_wait32_not() risk hrtimer storms for callers with large timeouts?

> +	if (out_val)
> +		*out_val = read;
> +
> +	return ret;
>  }

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

  reply	other threads:[~2026-09-14 22:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 21:57 [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums Alan Previn
2026-09-14 22:16 ` sashiko-bot [this message]
2026-09-14 22:40 ` ✓ CI.KUnit: success for drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums (rev4) Patchwork
2026-09-14 23:39 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-15  4:17 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-15  7:34 ` [PATCH] drm/xe/mmio: Fix xe_mmio_wait32() to honor delay/sleep maximums 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
  -- 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-29  5:44 Alan Previn
2026-09-29  5:49 ` sashiko-bot
2026-09-29 17:51 ` Rodrigo Vivi
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=20260914221643.379F81F000FF@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;
as well as URLs for NNTP newsgroup(s).