Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Use usleep_range for accurate long-running workload timeslicing

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>
Link: https://patch.msgid.link/20251212182847.1683222-3-matthew.brost@intel.com

+19 -1
+19 -1
drivers/gpu/drm/xe/xe_guc_submit.c
··· 990 990 return (WQ_SIZE - q->guc->wqi_tail); 991 991 } 992 992 993 + static inline void relaxed_ms_sleep(unsigned int delay_ms) 994 + { 995 + unsigned long min_us, max_us; 996 + 997 + if (!delay_ms) 998 + return; 999 + 1000 + if (delay_ms > 20) { 1001 + msleep(delay_ms); 1002 + return; 1003 + } 1004 + 1005 + min_us = mul_u32_u32(delay_ms, 1000); 1006 + max_us = min_us + 500; 1007 + 1008 + usleep_range(min_us, max_us); 1009 + } 1010 + 993 1011 static int wq_wait_for_space(struct xe_exec_queue *q, u32 wqi_size) 994 1012 { 995 1013 struct xe_guc *guc = exec_queue_to_guc(q); ··· 1921 1903 since_resume_ms; 1922 1904 1923 1905 if (wait_ms > 0 && q->guc->resume_time) 1924 - msleep(wait_ms); 1906 + relaxed_ms_sleep(wait_ms); 1925 1907 1926 1908 set_exec_queue_suspended(q); 1927 1909 disable_scheduling(q, false);