diff mbox

drm/i915: Warn there are any unfreed contexts when we shutdown

Message ID 1461330182-17205-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson April 22, 2016, 1:03 p.m. UTC
When tearing down the device, emit a warning if there are any contexts
remaining, as they all should be freed by this point.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Vetter April 22, 2016, 1:04 p.m. UTC | #1
On Fri, Apr 22, 2016 at 02:03:02PM +0100, Chris Wilson wrote:
> When tearing down the device, emit a warning if there are any contexts
> remaining, as they all should be freed by this point.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

I guess it fires already, or not? Either way, this /should/ hold true.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index e5acc3916f75..82339b45cc9b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -437,6 +437,8 @@ void i915_gem_context_fini(struct drm_device *dev)
>  
>  	i915_gem_context_unreference(dctx);
>  	dev_priv->kernel_context = NULL;
> +
> +	WARN_ON(!list_empty(&dev_priv->context_list));
>  }
>  
>  int i915_gem_context_enable(struct drm_i915_gem_request *req)
> -- 
> 2.8.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen April 22, 2016, 1:25 p.m. UTC | #2
On pe, 2016-04-22 at 14:03 +0100, Chris Wilson wrote:
> When tearing down the device, emit a warning if there are any contexts
> remaining, as they all should be freed by this point.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index e5acc3916f75..82339b45cc9b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -437,6 +437,8 @@ void i915_gem_context_fini(struct drm_device *dev)
>  
>  	i915_gem_context_unreference(dctx);
>  	dev_priv->kernel_context = NULL;
> +
> +	WARN_ON(!list_empty(&dev_priv->context_list));
>  }
>  
>  int i915_gem_context_enable(struct drm_i915_gem_request *req)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index e5acc3916f75..82339b45cc9b 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -437,6 +437,8 @@  void i915_gem_context_fini(struct drm_device *dev)
 
 	i915_gem_context_unreference(dctx);
 	dev_priv->kernel_context = NULL;
+
+	WARN_ON(!list_empty(&dev_priv->context_list));
 }
 
 int i915_gem_context_enable(struct drm_i915_gem_request *req)