Re: [PATCH] drm/i915: add i915_address_space_fini

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 16, 2016 at 07:25:17PM +0000, Matthew Auld wrote:
> We already have an i915_address_space_init, so for symmetry we should
> also have a _fini, plus we already open code it twice. This then also
> fixes a bug where we leak the timeline for the ggtt vm.
> 
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 01f238a..c229a0a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2193,6 +2193,13 @@ static void i915_address_space_init(struct i915_address_space *vm,
>  	list_add_tail(&vm->global_link, &dev_priv->vm_list);
>  }
>  
> +static void i915_address_space_fini(struct i915_address_space *vm)
> +{
> +	i915_gem_timeline_fini(&vm->timeline);
> +	drm_mm_takedown(&vm->mm);
> +	list_del(&vm->global_link);
> +}
> +
>  static void gtt_write_workarounds(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -2279,7 +2286,7 @@ i915_ppgtt_create(struct drm_i915_private *dev_priv,
>  	return ppgtt;
>  }
>  
> -void  i915_ppgtt_release(struct kref *kref)
> +void i915_ppgtt_release(struct kref *kref)
>  {
>  	struct i915_hw_ppgtt *ppgtt =
>  		container_of(kref, struct i915_hw_ppgtt, ref);
> @@ -2291,9 +2298,7 @@ void  i915_ppgtt_release(struct kref *kref)
>  	WARN_ON(!list_empty(&ppgtt->base.inactive_list));
>  	WARN_ON(!list_empty(&ppgtt->base.unbound_list));
>  
> -	i915_gem_timeline_fini(&ppgtt->base.timeline);
> -	list_del(&ppgtt->base.global_link);
> -	drm_mm_takedown(&ppgtt->base.mm);
> +	i915_address_space_fini(&ppgtt->base);
>  
>  	ppgtt->base.cleanup(&ppgtt->base);
>  	kfree(ppgtt);
> @@ -2834,9 +2839,7 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv)
>  
>  	if (drm_mm_initialized(&ggtt->base.mm)) {
>  		intel_vgt_deballoon(dev_priv);
> -
> -		drm_mm_takedown(&ggtt->base.mm);
> -		list_del(&ggtt->base.global_link);
> +		i915_address_space_fini(&ggtt->base);

As you've probably realised, I asserted that the timeline was removed
under the struct mutex.
-Chris
 

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux