From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Matthew Brost <matthew.brost@intel.com>,
Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH] drm/xe: Initialize GuC ID mgr before registering guc_submit_fini
Date: Fri, 5 Apr 2024 14:27:47 -0700 [thread overview]
Message-ID: <20240405212747.226263-1-matthew.brost@intel.com> (raw)
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
next reply other threads:[~2024-04-05 21:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 21:27 Matthew Brost [this message]
2024-04-06 0:11 ` ✓ CI.Patch_applied: success for drm/xe: Initialize GuC ID mgr before registering guc_submit_fini 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240405212747.226263-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox