From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@intel.com>,
dri-devel@lists.freedesktop.org,
Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH 1/4] drm/i915/gt: Cleanup partial engine discovery failures
Date: Wed, 14 Sep 2022 15:04:24 -0700 [thread overview]
Message-ID: <20220914220427.3091448-2-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20220914220427.3091448-1-matthew.d.roper@intel.com>
From: Chris Wilson <chris.p.wilson@intel.com>
If we abort driver initialisation in the middle of gt/engine discovery,
some engines will be fully setup and some not. Those incompletely setup
engines only have 'engine->release == NULL' and so will leak any of the
common objects allocated.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/gt/intel_engine_cs.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 1f7188129cd1..bff12b4ec314 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1196,6 +1196,12 @@ void intel_engine_destroy_pinned_context(struct intel_context *ce)
intel_context_put(ce);
}
+static void destroy_pinned_context(struct intel_context *ce)
+{
+ if (ce)
+ intel_engine_destroy_pinned_context(ce);
+}
+
static struct intel_context *
create_kernel_context(struct intel_engine_cs *engine)
{
@@ -1274,8 +1280,13 @@ int intel_engines_init(struct intel_gt *gt)
return err;
err = setup(engine);
- if (err)
+ if (err) {
+ intel_engine_cleanup_common(engine);
return err;
+ }
+
+ /* The backend should now be responsible for cleanup */
+ GEM_BUG_ON(engine->release == NULL);
err = engine_init_common(engine);
if (err)
@@ -1307,8 +1318,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)
if (engine->default_state)
fput(engine->default_state);
- if (engine->kernel_context)
- intel_engine_destroy_pinned_context(engine->kernel_context);
+ destroy_pinned_context(engine->kernel_context);
GEM_BUG_ON(!llist_empty(&engine->barrier_tasks));
cleanup_status_page(engine);
--
2.37.3
next prev parent reply other threads:[~2022-09-14 22:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 22:04 [Intel-gfx] [PATCH 0/4] Further multi-gt handling Matt Roper
2022-09-14 22:04 ` Matt Roper [this message]
2022-09-15 10:40 ` [Intel-gfx] [PATCH 1/4] drm/i915/gt: Cleanup partial engine discovery failures Janusz Krzysztofik
2022-09-14 22:04 ` [Intel-gfx] [PATCH 2/4] drm/i915: Make GEM resume all engines Matt Roper
2022-09-15 21:34 ` Andi Shyti
2022-09-14 22:04 ` [Intel-gfx] [PATCH 3/4] drm/i915: Make GEM suspend all GTs Matt Roper
2022-09-15 21:36 ` Andi Shyti
2022-09-14 22:04 ` [Intel-gfx] [PATCH 4/4] drm/i915: Handle all GTs on driver (un)load paths Matt Roper
2022-09-15 1:01 ` Ceraolo Spurio, Daniele
2022-09-15 2:18 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Further multi-gt handling Patchwork
2022-09-15 2:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-09-15 12:25 ` [Intel-gfx] [PATCH 0/4] " Jani Nikula
2022-09-15 21:41 ` Andi Shyti
2022-09-15 23:29 ` Matt Roper
2022-09-15 19:15 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork
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=20220914220427.3091448-2-matthew.d.roper@intel.com \
--to=matthew.d.roper@intel.com \
--cc=chris.p.wilson@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@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