Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Initialize GuC ID mgr before registering guc_submit_fini
@ 2024-04-05 21:27 Matthew Brost
  2024-04-06  0:11 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Matthew Brost @ 2024-04-05 21:27 UTC (permalink / raw)
  To: intel-xe; +Cc: Matthew Brost, Michal Wajdeczko

It reasonable to assume that guc_submit_fini may rely on GuC ID mgr
being available. With that, register guc_submit_fini after initializing
the GuC ID mgr. This will ensure the GuC ID mgr is available in
guc_submit_fini due the reverse execution order of
drmm_add_action_or_reset.

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_guc_submit.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 9c30bd9ac8c0..148c5dc2c1ac 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -232,15 +232,20 @@ static struct workqueue_struct *get_submit_wq(struct xe_guc *guc)
 }
 #endif
 
-static void guc_submit_fini(struct drm_device *drm, void *arg)
+static void __guc_submit_fini(struct xe_guc *guc)
 {
-	struct xe_guc *guc = arg;
-
 	xa_destroy(&guc->submission_state.exec_queue_lookup);
 	free_submit_wq(guc);
 	mutex_destroy(&guc->submission_state.lock);
 }
 
+static void guc_submit_fini(struct drm_device *drm, void *arg)
+{
+	struct xe_guc *guc = arg;
+
+	__guc_submit_fini(guc);
+}
+
 static const struct xe_exec_queue_ops guc_exec_queue_ops;
 
 static void primelockdep(struct xe_guc *guc)
@@ -277,11 +282,13 @@ int xe_guc_submit_init(struct xe_guc *guc)
 
 	primelockdep(guc);
 
-	err = drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
-	if (err)
+	err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
+	if (err) {
+		__guc_submit_fini(guc);
 		return err;
+	}
 
-	err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
+	err = drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
 	if (err)
 		return err;
 
-- 
2.34.1


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

end of thread, other threads:[~2024-04-06 18:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 21:27 [PATCH] drm/xe: Initialize GuC ID mgr before registering guc_submit_fini Matthew Brost
2024-04-06  0:11 ` ✓ CI.Patch_applied: success for " Patchwork
2024-04-06  0:11 ` ✓ CI.checkpatch: " Patchwork
2024-04-06  0:12 ` ✓ CI.KUnit: " Patchwork
2024-04-06  0:24 ` ✓ CI.Build: " Patchwork
2024-04-06  0:29 ` ✓ CI.Hooks: " Patchwork
2024-04-06  0:30 ` ✓ CI.checksparse: " Patchwork
2024-04-06  1:02 ` ✗ CI.BAT: failure " Patchwork
2024-04-06 14:46 ` [PATCH] " Michal Wajdeczko
2024-04-06 18:27   ` Matthew Brost

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