Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v2 2/6] drm/xe: Move exponential sleep logic to helper
Date: Tue, 27 Jan 2026 11:49:59 -0800	[thread overview]
Message-ID: <aXkW5wI85nBZnMFV@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260127193727.601-3-michal.wajdeczko@intel.com>

On Tue, Jan 27, 2026 at 08:37:22PM +0100, Michal Wajdeczko wrote:
> We want to reuse the same increased sleep logic in other places.
> To avoid code duplication, move it to the helper.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c |  5 +----
>  drivers/gpu/drm/xe/xe_sleep.h      | 21 +++++++++++++++++++++
>  2 files changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 4ea14f2794f4..66dffa13553e 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -1045,10 +1045,7 @@ static int wq_wait_for_space(struct xe_exec_queue *q, u32 wqi_size)
>  				return -ENODEV;
>  			}
>  
> -			msleep(sleep_period_ms);
> -			sleep_total_ms += sleep_period_ms;
> -			if (sleep_period_ms < 64)
> -				sleep_period_ms <<= 1;
> +			sleep_total_ms += xe_sleep_exponential_ms(&sleep_period_ms, 64);
>  			goto try_again;
>  		}
>  	}
> diff --git a/drivers/gpu/drm/xe/xe_sleep.h b/drivers/gpu/drm/xe/xe_sleep.h
> index a772f1a37395..2bc3f4c0ee0b 100644
> --- a/drivers/gpu/drm/xe/xe_sleep.h
> +++ b/drivers/gpu/drm/xe/xe_sleep.h
> @@ -33,4 +33,25 @@ static inline void xe_sleep_relaxed_ms(unsigned int delay_ms)
>  	usleep_range(min_us, max_us);
>  }
>  
> +/**
> + * xe_sleep_exponential_ms() - Sleep for a exponentially increased time.
> + * @sleep_period_ms: current time in msec to sleep
> + * @max_sleep_ms: maximum time in msec to sleep
> + *
> + * Sleep for the @sleep_period_ms and exponentially increase this time for the
> + * next loop, unless reaching the @max_sleep_ms limit.
> + *
> + * Return: approximate time in msec the task was delayed.
> + */
> +static inline unsigned int xe_sleep_exponential_ms(unsigned int *sleep_period_ms,
> +						   unsigned int max_sleep_ms)
> +{
> +	unsigned int delay_ms = *sleep_period_ms;
> +	unsigned int next_delay_ms = 2 * delay_ms;
> +
> +	xe_sleep_relaxed_ms(delay_ms);
> +	*sleep_period_ms = min(next_delay_ms, max_sleep_ms);
> +	return delay_ms;
> +}
> +
>  #endif
> -- 
> 2.47.1
> 

  reply	other threads:[~2026-01-27 19:50 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 [this message]
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
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=aXkW5wI85nBZnMFV@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