All of lore.kernel.org
 help / color / mirror / Atom feed
From: yu.dai@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v1] drm/i915/guc: Fix a memory leak where guc->execbuf_client is not freed
Date: Tue, 12 Jan 2016 15:17:32 -0800	[thread overview]
Message-ID: <1452640652-24404-1-git-send-email-yu.dai@intel.com> (raw)
In-Reply-To: <1452113637-12981-1-git-send-email-yu.dai@intel.com>

From: Alex Dai <yu.dai@intel.com>

During driver unloading, the guc_client created for command submission
needs to be released to avoid memory leak.

The struct_mutex needs to be held before tearing down GuC.

v1: Move i915_guc_submission_disable out of i915_guc_submission_fini and
    take struct_mutex lock before release GuC client. (Dave Gordon)

Signed-off-by: Alex Dai <yu.dai@intel.com>

diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c b/drivers/gpu/drm/i915/intel_guc_loader.c
index d20788f..70fa8f5 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -631,10 +631,11 @@ void intel_guc_ucode_fini(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_guc_fw *guc_fw = &dev_priv->guc.guc_fw;
 
+	mutex_lock(&dev->struct_mutex);
 	direct_interrupts_to_host(dev_priv);
+	i915_guc_submission_disable(dev);
 	i915_guc_submission_fini(dev);
 
-	mutex_lock(&dev->struct_mutex);
 	if (guc_fw->guc_fw_obj)
 		drm_gem_object_unreference(&guc_fw->guc_fw_obj->base);
 	guc_fw->guc_fw_obj = NULL;
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-01-12 23:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 20:53 [PATCH] drm/i915/guc: Fix a memory leak where guc->execbuf_client is not freed yu.dai
2016-01-07  7:49 ` ✓ success: Fi.CI.BAT Patchwork
2016-01-12 12:11 ` [PATCH] drm/i915/guc: Fix a memory leak where guc->execbuf_client is not freed Dave Gordon
2016-01-12 22:57   ` Yu Dai
2016-01-12 23:17 ` yu.dai [this message]
2016-01-13 18:15   ` [PATCH v1] " Dave Gordon
2016-01-13 18:17     ` Yu Dai
2016-01-13 18:51       ` Dave Gordon
2016-01-13  8:49 ` ✗ failure: Fi.CI.BAT Patchwork
2016-01-13 19:01 ` [PATCH v2] drm/i915/guc: Fix a memory leak where guc->execbuf_client is not freed yu.dai
2016-01-13 19:11   ` Dave Gordon
2016-01-18 10:01     ` Tvrtko Ursulin
2016-01-19  8:48       ` Daniel Vetter
2016-01-14  9:49 ` ✗ warning: Fi.CI.BAT Patchwork
2016-01-19 10:07   ` Tvrtko Ursulin

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=1452640652-24404-1-git-send-email-yu.dai@intel.com \
    --to=yu.dai@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.