diff mbox

drm/i915: don't leak global_timeline

Message ID 1479324769-1532-1-git-send-email-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matthew Auld Nov. 16, 2016, 7:32 p.m. UTC
We need to clean up the global_timeline in i915_gem_load_cleanup.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chris Wilson Nov. 16, 2016, 8:57 p.m. UTC | #1
On Wed, Nov 16, 2016 at 07:32:49PM +0000, Matthew Auld wrote:
> We need to clean up the global_timeline in i915_gem_load_cleanup.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3fb5e66..c440e72 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4557,6 +4557,8 @@ void i915_gem_load_cleanup(struct drm_device *dev)
>  
>  	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
>  
> +	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);

Once upon a time the global timeline didn't allocate.

However, to free the timeline I assert we hold the struct_mutex for
manipulatingn the timelines list (that's important for the client
timelines) and we don't hold the struct_mutex here.

Give it a mutex_lock() and a WARN_ON(!list_empty(&dev_priv->gt.timelines));
-Chris
Daniel Vetter Nov. 17, 2016, 8:48 a.m. UTC | #2
On Wed, Nov 16, 2016 at 07:32:49PM +0000, Matthew Auld wrote:
> We need to clean up the global_timeline in i915_gem_load_cleanup.
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

Fixes: line probably missing? And why was that not caught when the
original patch landed?
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3fb5e66..c440e72 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4557,6 +4557,8 @@ void i915_gem_load_cleanup(struct drm_device *dev)
>  
>  	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
>  
> +	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
> +
>  	kmem_cache_destroy(dev_priv->dependencies);
>  	kmem_cache_destroy(dev_priv->requests);
>  	kmem_cache_destroy(dev_priv->vmas);
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Nov. 17, 2016, 8:54 a.m. UTC | #3
On Thu, Nov 17, 2016 at 09:48:18AM +0100, Daniel Vetter wrote:
> On Wed, Nov 16, 2016 at 07:32:49PM +0000, Matthew Auld wrote:
> > We need to clean up the global_timeline in i915_gem_load_cleanup.
> > 
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> 
> Fixes: line probably missing? And why was that not caught when the
> original patch landed?

It's a just a missing free of a few bytes. This would require kmemleak.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3fb5e66..c440e72 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4557,6 +4557,8 @@  void i915_gem_load_cleanup(struct drm_device *dev)
 
 	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
 
+	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
+
 	kmem_cache_destroy(dev_priv->dependencies);
 	kmem_cache_destroy(dev_priv->requests);
 	kmem_cache_destroy(dev_priv->vmas);