Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v2 1/4] drm/i915/gt: Cleanup partial engine discovery failures
Date: Thu, 15 Sep 2022 16:26:51 -0700	[thread overview]
Message-ID: <20220915232654.3283095-2-matthew.d.roper@intel.com> (raw)
In-Reply-To: <20220915232654.3283095-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.

v2:
 - Drop the destroy_pinned_context() helper for now.  It's not really
   worth it with just a single callsite at the moment.  (Janusz)

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 1f7188129cd1..2ddcad497fa3 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1274,8 +1274,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)
-- 
2.37.3


  reply	other threads:[~2022-09-15 23:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 23:26 [Intel-gfx] [PATCH v2 0/4] Further multi-gt handling Matt Roper
2022-09-15 23:26 ` Matt Roper [this message]
2022-09-16  8:03   ` [Intel-gfx] [PATCH v2 1/4] drm/i915/gt: Cleanup partial engine discovery failures Janusz Krzysztofik
2022-09-15 23:26 ` [Intel-gfx] [PATCH v2 2/4] drm/i915: Make GEM resume all engines Matt Roper
2022-09-15 23:26 ` [Intel-gfx] [PATCH v2 3/4] drm/i915: Make GEM suspend all GTs Matt Roper
2022-09-15 23:26 ` [Intel-gfx] [PATCH v2 4/4] drm/i915: Handle all GTs on driver (un)load paths Matt Roper
2022-09-16  8:19   ` Andi Shyti
2022-09-15 23:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Further multi-gt handling (rev2) Patchwork
2022-09-16  0:08 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-09-16  6:38 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-09-16 15:04   ` Matt Roper

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=20220915232654.3283095-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