Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe/guc: Scale suspend wait timeout with preempt timeout
@ 2026-11-23 12:34 Himal Prasad Ghimiray
  2026-11-23 12:34 ` [PATCH 2/2] drm/xe/cri: Increase default CCS preempt timeout to 7.5s Himal Prasad Ghimiray
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Himal Prasad Ghimiray @ 2026-11-23 12:34 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.

v2:
- Use long for ret to match wait_event_*_timeout() return type (Sashiko)
- Skip preempt_timeout_us for multi-queue secondaries (Matt Auld)

Fixes: 627c961d672d ("drm/xe: Add timeout to preempt fences")
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 38069be11aa5..0e64b581f51a 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -2569,7 +2569,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);
-	int ret;
+	long timeout;
+	long 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;
+	if (!xe_exec_queue_is_multi_queue_secondary(q))
+		timeout += 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
@@ -2583,16 +2596,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] 6+ messages in thread

end of thread, other threads:[~2026-11-24 11:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 12:34 [PATCH 1/2] drm/xe/guc: Scale suspend wait timeout with preempt timeout Himal Prasad Ghimiray
2026-11-23 12:34 ` [PATCH 2/2] drm/xe/cri: Increase default CCS preempt timeout to 7.5s Himal Prasad Ghimiray
2026-11-24 11:38   ` Matthew Auld
2026-11-23 12:38 ` [PATCH 1/2] drm/xe/guc: Scale suspend wait timeout with preempt timeout sashiko-bot
2026-11-23 13:11 ` Matthew Auld
2026-11-23 14:46 ` ✗ CI.KUnit: failure for series starting with [1/2] " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox