[Intel-xe] [PATCH] drm/xe: Fix error handling in xe_gt_record_default_lrcs

Matthew Brost matthew.brost at intel.com
Wed Apr 5 02:59:19 UTC 2023


Kill engines if an error is encountered in xe_gt_record_default_lrcs so
the driver can free these resources on driver teardown.

Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 drivers/gpu/drm/xe/xe_gt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
index bc821f431c45..3adde2205b39 100644
--- a/drivers/gpu/drm/xe/xe_gt.c
+++ b/drivers/gpu/drm/xe/xe_gt.c
@@ -301,8 +301,12 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 
 		gt->default_lrc[hwe->class] = default_lrc;
 put_nop_e:
+		if (err)
+			xe_engine_kill(nop_e);
 		xe_engine_put(nop_e);
 put_engine:
+		if (err)
+			xe_engine_kill(e);
 		xe_engine_put(e);
 put_vm:
 		xe_vm_put(vm);
@@ -310,6 +314,10 @@ int xe_gt_record_default_lrcs(struct xe_gt *gt)
 			break;
 	}
 
+	/* Wait for engine kill */
+	if (err)
+		msleep(50);
+
 	return err;
 }
 
-- 
2.34.1



More information about the Intel-xe mailing list