intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: add i915_address_space_fini
@ 2016-11-16 19:25 Matthew Auld
  2016-11-16 20:16 ` ✗ Fi.CI.BAT: warning for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthew Auld @ 2016-11-16 19:25 UTC (permalink / raw)
  To: intel-gfx

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@chris-wilson.co.uk>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 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);
 	}
 
 	ggtt->base.cleanup(&ggtt->base);
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✗ Fi.CI.BAT: warning for drm/i915: add i915_address_space_fini
  2016-11-16 19:25 [PATCH] drm/i915: add i915_address_space_fini Matthew Auld
@ 2016-11-16 20:16 ` Patchwork
  2016-11-16 21:02 ` [PATCH] " Chris Wilson
  2016-11-17 20:53 ` Matthew Auld
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2016-11-16 20:16 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: add i915_address_space_fini
URL   : https://patchwork.freedesktop.org/series/15437/
State : warning

== Summary ==

Series 15437v1 drm/i915: add i915_address_space_fini
https://patchwork.freedesktop.org/api/1.0/series/15437/revisions/1/mbox/

Test drv_module_reload_basic:
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-bxt-t5700)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-bdw-5557u)
                pass       -> DMESG-WARN (fi-kbl-7200u)
Test gem_busy:
        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-hsw-4770r)

fi-bdw-5557u     total:244  pass:228  dwarn:1   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:203  dwarn:1   dfail:0   fail:0   skip:40 
fi-bxt-t5700     total:244  pass:215  dwarn:1   dfail:0   fail:0   skip:28 
fi-byt-j1900     total:244  pass:215  dwarn:1   dfail:0   fail:0   skip:28 
fi-byt-n2820     total:244  pass:211  dwarn:1   dfail:0   fail:0   skip:32 
fi-hsw-4770      total:244  pass:223  dwarn:1   dfail:0   fail:0   skip:20 
fi-hsw-4770r     total:244  pass:222  dwarn:2   dfail:0   fail:0   skip:20 
fi-ilk-650       total:244  pass:190  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m     total:244  pass:221  dwarn:1   dfail:0   fail:0   skip:22 
fi-ivb-3770      total:244  pass:221  dwarn:1   dfail:0   fail:0   skip:22 
fi-kbl-7200u     total:244  pass:221  dwarn:1   dfail:0   fail:0   skip:22 
fi-skl-6260u     total:244  pass:229  dwarn:1   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6700k     total:244  pass:222  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:244  pass:229  dwarn:1   dfail:0   fail:0   skip:14 
fi-snb-2520m     total:244  pass:211  dwarn:1   dfail:0   fail:0   skip:32 
fi-snb-2600      total:244  pass:210  dwarn:1   dfail:0   fail:0   skip:33 

6294f67611ebe69006c0e85c372efadcac8e9d66 drm-intel-nightly: 2016y-11m-16d-09h-57m-25s UTC integration manifest
da8acad drm/i915: add i915_address_space_fini

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3027/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: add i915_address_space_fini
  2016-11-16 19:25 [PATCH] drm/i915: add i915_address_space_fini Matthew Auld
  2016-11-16 20:16 ` ✗ Fi.CI.BAT: warning for " Patchwork
@ 2016-11-16 21:02 ` Chris Wilson
  2016-11-17 20:53 ` Matthew Auld
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2016-11-16 21:02 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

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@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] drm/i915: add i915_address_space_fini
  2016-11-16 19:25 [PATCH] drm/i915: add i915_address_space_fini Matthew Auld
  2016-11-16 20:16 ` ✗ Fi.CI.BAT: warning for " Patchwork
  2016-11-16 21:02 ` [PATCH] " Chris Wilson
@ 2016-11-17 20:53 ` Matthew Auld
  2016-11-17 20:56   ` Chris Wilson
  2 siblings, 1 reply; 5+ messages in thread
From: Matthew Auld @ 2016-11-17 20:53 UTC (permalink / raw)
  To: intel-gfx

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.

v2: don't forget about the struct_mutex for the ggtt path.

Fixes: 80b204bce8f2 ("drm/i915: Enable multiple timelines")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 01f238adfb67..b259f3de2502 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);
@@ -2835,8 +2840,9 @@ 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);
+		mutex_lock(&dev_priv->drm.struct_mutex);
+		i915_address_space_fini(&ggtt->base);
+		mutex_unlock(&dev_priv->drm.struct_mutex);
 	}
 
 	ggtt->base.cleanup(&ggtt->base);
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: add i915_address_space_fini
  2016-11-17 20:53 ` Matthew Auld
@ 2016-11-17 20:56   ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2016-11-17 20:56 UTC (permalink / raw)
  To: Matthew Auld; +Cc: intel-gfx

On Thu, Nov 17, 2016 at 08:53:15PM +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.
> 
> v2: don't forget about the struct_mutex for the ggtt path.
> 
> Fixes: 80b204bce8f2 ("drm/i915: Enable multiple timelines")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>

> @@ -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)

Finally!
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I'm sure the rest of the patch is just as good ;)
-Chris

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-17 20:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16 19:25 [PATCH] drm/i915: add i915_address_space_fini Matthew Auld
2016-11-16 20:16 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-11-16 21:02 ` [PATCH] " Chris Wilson
2016-11-17 20:53 ` Matthew Auld
2016-11-17 20:56   ` Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).