Skip to contentSkip to conversation

Fix error path of xe_exec_queue_create_ioctl()

PATCH Superseded Shuicheng Lin 1 participant 3 messages Mar 6

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix error path of xe_exec_queue_create_ioctl()

Split to 2 patches due to different Fixes tag.

Shuicheng Lin (2):
drm/xe: Fix missing xe_hw_engine_group_del_exec_queue() in error path drm/xe: Fix exec queue unwind on hw engine group add failure

 drivers/gpu/drm/xe/xe_exec_queue.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 drm/xe: Fix missing xe_hw_engine_group_del_exec_queue() in error path

When xa_alloc() fails after xe_hw_engine_group_add_exec_queue() has already succeeded, xe_hw_engine_group_del_exec_queue() is missed to undo the add.

Add xe_hw_engine_group_del_exec_queue() at the kill_exec_queue label to fix it.

Fixes 7970cb36966c ("drm/xe/hw_engine_group: Register hw engine group's exec queues")
Cc Matthew Brost <[email protected]>
---
 drivers/gpu/drm/xe/xe_exec_queue.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/xe/xe_exec_queue.c +2 -0
index 5c67185d5357..af915ccb4925 100644
@@ -1408,6 +1408,8 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,
 	return 0;
 
 kill_exec_queue:
+	if (q->vm && q->hwe->hw_engine_group)
+		xe_hw_engine_group_del_exec_queue(q->hwe->hw_engine_group, q);
 	xe_exec_queue_kill(q);
 delete_queue_group:
 	if (xe_exec_queue_is_multi_queue_secondary(q))
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 drm/xe: Fix exec queue unwind on hw engine group add failure

In reply to Shuicheng Lin

When xe_hw_engine_group_add_exec_queue() fails in xe_exec_queue_create_ioctl(), to undo xe_exec_queue_group_add() and xe_vm_add_compute_exec_queue(), the code should unwind through kill_exec_queue rather than directly dropping the queue reference.

v2: correct the jump label. (Matt)

Fixes d9ec63474648 ("drm/xe/multi_queue: Add user interface for multi queue support")
Cc Niranjana Vishwanathapura <[email protected]>
---
 drivers/gpu/drm/xe/xe_exec_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_exec_queue.c +1 -1
index af915ccb4925..372fc17a2f46 100644
@@ -1390,7 +1390,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,
 		if (q->vm && q->hwe->hw_engine_group) {
 			err = xe_hw_engine_group_add_exec_queue(q->hwe->hw_engine_group, q);
 			if (err)
-				goto put_exec_queue;
+				goto kill_exec_queue;
 		}
 	}
 
Signature · 1 line
2.34.1