From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Cc: francois.dugast@intel.com, michal.mrozek@intel.com
Subject: Re: [PATCH v2 2/7] drm/xe: Use usleep_range for accurate long-running workload timeslicing
Date: Mon, 15 Dec 2025 11:10:08 +0100 [thread overview]
Message-ID: <a63d1519332fd50e50153983f5642a7a5e6f8fff.camel@linux.intel.com> (raw)
In-Reply-To: <20251212182847.1683222-3-matthew.brost@intel.com>
On Fri, 2025-12-12 at 10:28 -0800, Matthew Brost wrote:
> msleep is not very accurate in terms of how long it actually sleeps,
> whereas usleep_range is precise. Replace the timeslice sleep for
> long-running workloads with the more accurate usleep_range to avoid
> jitter if the sleep period is less than 20ms.
>
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel
> GPUs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_submit.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c
> b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 21a8bd2ec672..18cac5594d6a 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -990,6 +990,24 @@ static u32 wq_space_until_wrap(struct
> xe_exec_queue *q)
> return (WQ_SIZE - q->guc->wqi_tail);
> }
>
> +static inline void relaxed_ms_sleep(unsigned int delay_ms)
> +{
> + unsigned long min_us, max_us;
> +
> + if (!delay_ms)
> + return;
> +
> + if (delay_ms > 20) {
> + msleep(delay_ms);
> + return;
> + }
> +
> + min_us = mul_u32_u32(delay_ms, 1000);
> + max_us = min_us + 500;
> +
> + usleep_range(min_us, max_us);
> +}
> +
> static int wq_wait_for_space(struct xe_exec_queue *q, u32 wqi_size)
> {
> struct xe_guc *guc = exec_queue_to_guc(q);
> @@ -1903,7 +1921,7 @@ static void
> __guc_exec_queue_process_msg_suspend(struct xe_sched_msg *msg)
> since_resume_ms;
>
> if (wait_ms > 0 && q->guc->resume_time)
> - msleep(wait_ms);
> + relaxed_ms_sleep(wait_ms);
>
> set_exec_queue_suspended(q);
> disable_scheduling(q, false);
next prev parent reply other threads:[~2025-12-15 10:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 18:28 [PATCH v2 0/7] Fix performance when pagefaults and 3d/display share resources Matthew Brost
2025-12-12 18:28 ` [PATCH v2 1/7] drm/xe: Adjust long-running workload timeslices to reasonable values Matthew Brost
2025-12-15 10:08 ` Thomas Hellström
2025-12-15 21:48 ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 2/7] drm/xe: Use usleep_range for accurate long-running workload timeslicing Matthew Brost
2025-12-15 10:10 ` Thomas Hellström [this message]
2025-12-12 18:28 ` [PATCH v2 3/7] drm/xe: Add debugfs knobs to control long running " Matthew Brost
2025-12-15 10:11 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 4/7] drm/xe: Skip exec queue schedule toggle if queue is idle during suspend Matthew Brost
2025-12-15 12:08 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 5/7] drm/xe: Wait on in-syncs when swicthing to dma-fence mode Matthew Brost
2025-12-15 10:32 ` Thomas Hellström
2025-12-15 21:46 ` Matthew Brost
2025-12-15 21:48 ` Thomas Hellström
2025-12-16 1:12 ` Matthew Brost
2025-12-12 18:28 ` [PATCH v2 6/7] drm/xe: Add GT stats ktime helpers Matthew Brost
2025-12-15 10:17 ` Thomas Hellström
2025-12-12 18:28 ` [PATCH v2 7/7] drm/xe: Add more GT stats around pagefault mode switch flows Matthew Brost
2025-12-15 11:00 ` Thomas Hellström
2025-12-15 13:05 ` Francois Dugast
2025-12-12 22:37 ` ✗ CI.checkpatch: warning for Fix performance when pagefaults and 3d/display share resources (rev2) Patchwork
2025-12-12 22:38 ` ✓ CI.KUnit: success " Patchwork
2025-12-12 23:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-12-13 19:27 ` ✗ Xe.CI.Full: failure " 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=a63d1519332fd50e50153983f5642a7a5e6f8fff.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=michal.mrozek@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