From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [Intel-xe] [PATCH] drm/xe: Call __guc_engine_fini_async direct for KERNEL engines
Date: Thu, 27 Jul 2023 10:41:07 -0700 [thread overview]
Message-ID: <20230727174107.532275-1-matthew.brost@intel.com> (raw)
Usually we call __guc_engine_fini_async via a worker as the engine fini
can be done from within the GPU scheduler which creates a circular
dependency without a worker. Kernel engines are fini'd at driver unload
(not from within the GPU scheduler) so it is safe to directly call
__guc_engine_fini_async.
Reported-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
drivers/gpu/drm/xe/xe_guc_submit.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index 911d4965c27c..6cb64a097297 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -943,27 +943,19 @@ static void __guc_engine_fini_async(struct work_struct *w)
drm_sched_entity_fini(&ge->entity);
drm_sched_fini(&ge->sched);
- if (!(e->flags & ENGINE_FLAG_KERNEL)) {
- kfree(ge);
- xe_engine_fini(e);
- }
+ kfree(ge);
+ xe_engine_fini(e);
}
static void guc_engine_fini_async(struct xe_engine *e)
{
- bool kernel = e->flags & ENGINE_FLAG_KERNEL;
-
INIT_WORK(&e->guc->fini_async, __guc_engine_fini_async);
- queue_work(system_wq, &e->guc->fini_async);
/* We must block on kernel engines so slabs are empty on driver unload */
- if (kernel) {
- struct xe_guc_engine *ge = e->guc;
-
- flush_work(&ge->fini_async);
- kfree(ge);
- xe_engine_fini(e);
- }
+ if (e->flags & ENGINE_FLAG_KERNEL)
+ __guc_engine_fini_async(&e->guc->fini_async);
+ else
+ queue_work(system_wq, &e->guc->fini_async);
}
static void __guc_engine_fini(struct xe_guc *guc, struct xe_engine *e)
--
2.34.1
next reply other threads:[~2023-07-27 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 17:41 Matthew Brost [this message]
2023-07-27 18:50 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Call __guc_engine_fini_async direct for KERNEL engines Patchwork
2023-07-27 18:51 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-27 18:52 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-27 18:56 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-27 18:56 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-27 18:57 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-08-04 20:51 ` [Intel-xe] [PATCH] " Rodrigo Vivi
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=20230727174107.532275-1-matthew.brost@intel.com \
--to=matthew.brost@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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