diff mbox

drm/i915: don't leak global_timeline

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

Commit Message

Matthew Auld Nov. 17, 2016, 8:20 p.m. UTC
We need to clean up the global_timeline in i915_gem_load_cleanup.

v2: don't forget about the struct_mutex, and also WARN_ON if we have any
remaining timelines before purging the global_timeline.

Fixes: 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Chris Wilson Nov. 17, 2016, 8:24 p.m. UTC | #1
On Thu, Nov 17, 2016 at 08:20:05PM +0000, Matthew Auld wrote:
> We need to clean up the global_timeline in i915_gem_load_cleanup.
> 
> v2: don't forget about the struct_mutex, and also WARN_ON if we have any
> remaining timelines before purging the global_timeline.
> 
> Fixes: 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 3fb5e66e4d65..f507e14d6231 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4556,6 +4556,11 @@ void i915_gem_load_cleanup(struct drm_device *dev)
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  
>  	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
> +	WARN_ON(!list_empty(&dev_priv->gt.timelines));
> +
> +	mutex_lock(&dev_priv->drm.struct_mutex);
> +	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
> +	mutex_unlock(&dev_priv->drm.struct_mutex);

Remove the global timeline from the list then warn... :)
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3fb5e66e4d65..f507e14d6231 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4556,6 +4556,11 @@  void i915_gem_load_cleanup(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 
 	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
+	WARN_ON(!list_empty(&dev_priv->gt.timelines));
+
+	mutex_lock(&dev_priv->drm.struct_mutex);
+	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
+	mutex_unlock(&dev_priv->drm.struct_mutex);
 
 	kmem_cache_destroy(dev_priv->dependencies);
 	kmem_cache_destroy(dev_priv->requests);