Skip to contentSkip to conversation

drm/xe/vf: Skip signaled jobs during VF migration re-emission

PATCH In review Matthew Brost 1 participant 2 messages Oct 31, 2025

Subsystems (2)
lore
Share & tools
lore

Matthew Brost

author maintainer
#0 lore raw

PATCH 1/1 drm/xe/vf: Skip signaled jobs during VF migration re-emission

The LRC software ring tail is reser to the first unsignaled pending job's head. Fix the re-emission logic to skip signaled jobs, as it currently scans all pending jobs, potentially causing imbalance.

Fixes c25c1010df88 ("drm/xe/vf: Replay GuC submission state on pause / unpause")
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_guc_submit.c +9 -3
index d4ffdb71ef3d..bee76d1b0836 100644
@@ -2241,11 +2241,17 @@ static void guc_exec_queue_unpause_prepare(struct xe_guc *guc,
 					   struct xe_exec_queue *q)
 {
 	struct xe_gpu_scheduler *sched = &q->guc->sched;
-	struct drm_sched_job *s_job;
 	struct xe_sched_job *job = NULL;
 
-	list_for_each_entry(s_job, &sched->base.pending_list, list) {
-		job = to_xe_sched_job(s_job);
+	list_for_each_entry(job, &sched->base.pending_list, drm.list) {
+		struct drm_sched_fence *s_fence = job->drm.s_fence;
+		struct dma_fence *hw_fence = s_fence->parent;
+
+		/*
+		 * First pending job in guc_exec_queue_pause skips signaled jobs
+		 */
+		if (hw_fence && !dma_fence_is_signaled(hw_fence))
+			continue;
 
 		xe_gt_dbg(guc_to_gt(guc), "Replay JOB - guc_id=%d, seqno=%d",
 			  q->guc->id, xe_sched_job_seqno(job));
Signature · 1 line
2.34.1
author maintainer
#1 lore raw
Quoted 4 lines · Matthew Brost

The LRC software ring tail is reser to the first unsignaled pending job's head. Fix the re-emission logic to skip signaled jobs, as it currently scans all pending jobs, potentially causing imbalance.

Ignore this patch, I accidentally sent out the wrong code. Here is the correct version [1].

Matt

[1] https://patchwork.freedesktop.org/series/156869/

Quoted 34 lines
Fixes c25c1010df88 ("drm/xe/vf: Replay GuC submission state on pause / unpause")
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_guc_submit.c +9 -3
index d4ffdb71ef3d..bee76d1b0836 100644
@@ -2241,11 +2241,17 @@ static void guc_exec_queue_unpause_prepare(struct xe_guc *guc,
 					   struct xe_exec_queue *q)
 {
 	struct xe_gpu_scheduler *sched = &q->guc->sched;
-	struct drm_sched_job *s_job;
 	struct xe_sched_job *job = NULL;
 
-	list_for_each_entry(s_job, &sched->base.pending_list, list) {
-		job = to_xe_sched_job(s_job);
+	list_for_each_entry(job, &sched->base.pending_list, drm.list) {
+		struct drm_sched_fence *s_fence = job->drm.s_fence;
+		struct dma_fence *hw_fence = s_fence->parent;
+
+		/*
+		 * First pending job in guc_exec_queue_pause skips signaled jobs
+		 */
+		if (hw_fence && !dma_fence_is_signaled(hw_fence))
+			continue;
 
 		xe_gt_dbg(guc_to_gt(guc), "Replay JOB - guc_id=%d, seqno=%d",
 			  q->guc->id, xe_sched_job_seqno(job));
Signature · 1 line
2.34.1