All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/xe/guc: Scale suspend wait timeout with preempt timeout
@ 2026-11-20 16:08 Himal Prasad Ghimiray
  2026-11-20 16:15 ` sashiko-bot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Himal Prasad Ghimiray @ 2026-11-20 16:08 UTC (permalink / raw)
  To: intel-xe
  Cc: Thomas Hellström, Rodrigo Vivi, Matthew Auld, Matthew Brost,
	Himal Prasad Ghimiray

The suspend wait uses a fixed 5s timeout, but preempt_timeout_us can be
set up to 10s via sysfs, causing queues to be banned while GuC is still
legitimately preempting. Extend the timeout by preempt_timeout_us and
min_run_period_ms.

Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 9e7c2778029c..0898ee29f460 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -2532,8 +2532,20 @@ static int guc_exec_queue_wait_suspend_done(struct xe_exec_queue *q, bool blocki
 {
 	struct xe_guc *guc = exec_queue_to_guc(q);
 	struct xe_device *xe = guc_to_xe(guc);
+	long timeout;
 	int ret;
 
+	/*
+	 * The SUSPEND worker may sleep up to min_run_period_ms before disabling,
+	 * and GuC may then take up to preempt_timeout_us (sysfs tunable up to
+	 * XE_HW_ENGINE_PREEMPT_TIMEOUT_MAX) to preempt the context. Keep the
+	 * historical 5s as slack on top of both.
+	 */
+	timeout = HZ * 5 +
+		usecs_to_jiffies(READ_ONCE(q->sched_props.preempt_timeout_us));
+	if (q->vm)
+		timeout += msecs_to_jiffies(q->vm->preempt.min_run_period_ms);
+
 	/*
 	 * A kill does not clear suspend_pending, the queue may still be running
 	 * on the hardware, so exec_queue_killed() is what ends the wait in that
@@ -2546,16 +2558,16 @@ static int guc_exec_queue_wait_suspend_done(struct xe_exec_queue *q, bool blocki
 retry:
 	if (blocking) {
 		if (IS_SRIOV_VF(xe))
-			ret = wait_event_timeout(guc->ct.wq, WAIT_COND, HZ * 5);
+			ret = wait_event_timeout(guc->ct.wq, WAIT_COND, timeout);
 		else
 			ret = wait_event_timeout(q->guc->suspend_wait, WAIT_COND,
-						 HZ * 5);
+						 timeout);
 	} else if (IS_SRIOV_VF(xe)) {
 		ret = wait_event_interruptible_timeout(guc->ct.wq, WAIT_COND ||
-						       vf_recovery(guc), HZ * 5);
+						       vf_recovery(guc), timeout);
 	} else {
 		ret = wait_event_interruptible_timeout(q->guc->suspend_wait,
-						       WAIT_COND, HZ * 5);
+						       WAIT_COND, timeout);
 	}
 
 	if (!blocking && vf_recovery(guc) && !xe_wedged(xe))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-20 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 16:08 [PATCH 1/1] drm/xe/guc: Scale suspend wait timeout with preempt timeout Himal Prasad Ghimiray
2026-11-20 16:15 ` sashiko-bot
2026-11-20 16:16 ` ✓ CI.KUnit: success for series starting with [1/1] " Patchwork
2026-11-20 17:06 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-20 17:20 ` [PATCH 1/1] " Matthew Auld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.