From: Matthew Brost <matthew.brost@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 3/6] drm/xe/guc: Limit sleep while waiting for H2G credits
Date: Tue, 27 Jan 2026 11:51:45 -0800 [thread overview]
Message-ID: <aXkXUbcvIEcl8mO+@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260127193727.601-4-michal.wajdeczko@intel.com>
On Tue, Jan 27, 2026 at 08:37:23PM +0100, Michal Wajdeczko wrote:
> Instead of endlessly increasing the sleep timeout while waiting
> for the H2G credits, use exponential increase only up to the given
> limit, like it was initially done in the GuC submission code.
>
> While here, fix the actual timeout to the 1s as it was documented.
Yes, the existing wait is 2s which seems to be overkill.
>
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ct.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index dfbf76037b04..d4111124cd5f 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -32,6 +32,7 @@
> #include "xe_guc_tlb_inval.h"
> #include "xe_map.h"
> #include "xe_pm.h"
> +#include "xe_sleep.h"
> #include "xe_sriov_vf.h"
> #include "xe_trace_guc.h"
>
> @@ -1101,7 +1102,8 @@ static int dequeue_one_g2h(struct xe_guc_ct *ct);
> */
> static bool guc_ct_send_wait_for_retry(struct xe_guc_ct *ct, u32 len,
> u32 g2h_len, struct g2h_fence *g2h_fence,
> - unsigned int *sleep_period_ms)
> + unsigned int *sleep_period_ms,
> + unsigned int *sleep_total_ms)
> {
> struct xe_device *xe = ct_to_xe(ct);
>
> @@ -1115,15 +1117,14 @@ static bool guc_ct_send_wait_for_retry(struct xe_guc_ct *ct, u32 len,
> if (!h2g_has_room(ct, len + GUC_CTB_HDR_LEN)) {
> struct guc_ctb *h2g = &ct->ctbs.h2g;
>
> - if (*sleep_period_ms == 1024)
> + if (*sleep_total_ms > 1000)
> return false;
>
> trace_xe_guc_ct_h2g_flow_control(xe, h2g->info.head, h2g->info.tail,
> h2g->info.size,
> h2g->info.space,
> len + GUC_CTB_HDR_LEN);
> - msleep(*sleep_period_ms);
> - *sleep_period_ms <<= 1;
> + xe_sleep_exponential_ms(sleep_period_ms, 64);
> } else {
> struct xe_device *xe = ct_to_xe(ct);
> struct guc_ctb *g2h = &ct->ctbs.g2h;
> @@ -1161,6 +1162,7 @@ static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
> {
> struct xe_gt *gt = ct_to_gt(ct);
> unsigned int sleep_period_ms = 1;
> + unsigned int sleep_total_ms = 0;
> int ret;
>
> xe_gt_assert(gt, !g2h_len || !g2h_fence);
> @@ -1173,7 +1175,7 @@ static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
>
> if (unlikely(ret == -EBUSY)) {
> if (!guc_ct_send_wait_for_retry(ct, len, g2h_len, g2h_fence,
> - &sleep_period_ms))
> + &sleep_period_ms, &sleep_total_ms))
> goto broken;
> goto try_again;
> }
> --
> 2.47.1
>
next prev parent reply other threads:[~2026-01-27 19:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 19:37 [PATCH v2 0/6] drm/xe/guc: Make MMIO communication more robust Michal Wajdeczko
2026-01-27 19:37 ` [PATCH v2 1/6] drm/xe: Promote relaxed_ms_sleep Michal Wajdeczko
2026-01-27 19:46 ` Matthew Brost
2026-01-27 19:37 ` [PATCH v2 2/6] drm/xe: Move exponential sleep logic to helper Michal Wajdeczko
2026-01-27 19:49 ` Matthew Brost
2026-01-27 19:37 ` [PATCH v2 3/6] drm/xe/guc: Limit sleep while waiting for H2G credits Michal Wajdeczko
2026-01-27 19:51 ` Matthew Brost [this message]
2026-01-27 19:37 ` [PATCH v2 4/6] drm/xe/guc: Drop redundant register read Michal Wajdeczko
2026-01-27 19:37 ` [PATCH v2 5/6] drm/xe/guc: Wait before retrying sending H2G Michal Wajdeczko
2026-01-27 19:56 ` Matthew Brost
2026-01-27 19:37 ` [PATCH v2 6/6] drm/xe/guc: Allow second H2G retry on FLR Michal Wajdeczko
2026-01-27 19:57 ` Matthew Brost
2026-01-27 19:47 ` ✗ CI.checkpatch: warning for drm/xe/guc: Make MMIO communication more robust (rev2) Patchwork
2026-01-27 19:48 ` ✓ CI.KUnit: success " Patchwork
2026-01-27 20:21 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-28 2:54 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-29 18:57 ` Michal Wajdeczko
2026-02-02 21:34 ` Michal Wajdeczko
2026-01-29 20:23 ` ✗ CI.checkpatch: warning for drm/xe/guc: Make MMIO communication more robust (rev3) Patchwork
2026-01-29 20:25 ` ✓ CI.KUnit: success " Patchwork
2026-01-29 21:01 ` ✓ Xe.CI.BAT: " 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=aXkXUbcvIEcl8mO+@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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