From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Initialize GuC ID mgr before registering guc_submit_fini
Date: Sat, 6 Apr 2024 16:46:51 +0200 [thread overview]
Message-ID: <d9b2af11-26a4-404c-9696-aa75e3a1d7ee@intel.com> (raw)
In-Reply-To: <20240405212747.226263-1-matthew.brost@intel.com>
On 05.04.2024 23:27, Matthew Brost wrote:
> 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.
that wont fly right now as GuC ID manager expects submission_state.lock
mutex being still available during it's cleanup, but now it will be
destroyed in __guc_submit_fini() called prior to __fini_idm()
please take a look at [1] which should solve all the problems
[1] https://patchwork.freedesktop.org/series/132118/
>
> 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;
>
next prev parent reply other threads:[~2024-04-06 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Michal Wajdeczko [this message]
2024-04-06 18:27 ` [PATCH] " 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=d9b2af11-26a4-404c-9696-aa75e3a1d7ee@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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