Skip to contentSkip to conversation

drm/i915: don't leak global_timeline

PATCH In review Matthew Auld 4 participants 11 messages Nov 16, 2016 – Nov 18, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: don't leak global_timeline

We need to clean up the global_timeline in i915_gem_load_cleanup.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +2 -0
index 3fb5e66..c440e72 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: warning for drm/i915: don't leak global_timeline

== Series Details ==

== Series Details ==

Series: drm/i915: don't leak global_timeline
URL : https://patchwork.freedesktop.org/series/15439/
State : warning

== Summary ==

Series 15439v1 drm/i915: don't leak global_timeline
https://patchwork.freedesktop.org/api/1.0/series/15439/revisions/1/mbox/

Test drv_module_reload_basic:

                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-bdw-5557u)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-byt-n2820)
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-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:223  dwarn:1   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 97179ba drm/i915: don't leak global_timeline

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3028/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Matthew Auld
Quoted 13 lines · Matthew Auld

We need to clean up the global_timeline in i915_gem_load_cleanup.

---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3fb5e66..c440e72 100644

drivers/gpu/drm/i915/i915_gem.c void i915_gem_load_cleanup(struct drm_device *dev) · line 4560

Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -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

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Matthew Auld
Quoted 4 lines · Matthew Auld

We need to clean up the global_timeline in i915_gem_load_cleanup.

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

Quoted 24 lines
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +2 -0
index 3fb5e66..c440e72 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 8 lines · Daniel Vetter
Quoted 4 lines · Matthew Auld

We need to clean up the global_timeline in i915_gem_load_cleanup.

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

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 1/1 drm/i915: don't leak global_timeline

In reply to Matthew Auld

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 <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +5 -0
index 3fb5e66e4d65..f507e14d6231 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 17 lines · Matthew Auld

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 <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3fb5e66e4d65..f507e14d6231 100644

drivers/gpu/drm/i915/i915_gem.c void i915_gem_load_cleanup(struct drm_device *dev) · line 4563

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +5 -0
@@ -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

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 1/1 drm/i915: don't leak global_timeline

In reply to Matthew Auld

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.

v3: it might be a good idea to first remove the global_timeline...duh!

Fixes 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +6 -0
index 3fb5e66e4d65..b7a8c8349ccb 100644
@@ -4557,6 +4557,12 @@ void i915_gem_load_cleanup(struct drm_device *dev)
 
 	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
 
+	mutex_lock(&dev_priv->drm.struct_mutex);
+	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
+	mutex_unlock(&dev_priv->drm.struct_mutex);
+
+	WARN_ON(!list_empty(&dev_priv->gt.timelines));
+
 	kmem_cache_destroy(dev_priv->dependencies);
 	kmem_cache_destroy(dev_priv->requests);
 	kmem_cache_destroy(dev_priv->vmas);
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#8 lore raw
Quoted 19 lines · Matthew Auld

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.

v3: it might be a good idea to first remove the global_timeline...duh!

Fixes 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct")
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +0 -0
index 3fb5e66e4d65..b7a8c8349ccb 100644

drivers/gpu/drm/i915/i915_gem.c void i915_gem_load_cleanup(struct drm_device *dev) · line 4564

Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +5 -0
@@ -4557,6 +4557,12 @@ void i915_gem_load_cleanup(struct drm_device *dev)
 
 	WARN_ON(!llist_empty(&dev_priv->mm.free_list));
 
+	mutex_lock(&dev_priv->drm.struct_mutex);
+	i915_gem_timeline_fini(&dev_priv->gt.global_timeline);
+	mutex_unlock(&dev_priv->drm.struct_mutex);
+
+	WARN_ON(!list_empty(&dev_priv->gt.timelines));

I would have plonked this under the mutex, then it mirrors the

mutex_lock()
INIT_LIST_HEAD() i915_gem_timeline_init(&dev_priv->gt.global_timeline); mutex_unlock()

we do at the start.

I'll surreptiously do that, and send this pair to CI together since the order is important to avoid adding this WARN before the fix. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

✗ Fi.CI.BAT: warning for drm/i915: don't leak global_timeline (rev2)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915: don't leak global_timeline (rev2)
URL : https://patchwork.freedesktop.org/series/15439/
State : warning

== Summary ==

Series 15439v2 drm/i915: don't leak global_timeline
https://patchwork.freedesktop.org/api/1.0/series/15439/revisions/2/mbox/

Test drv_module_reload_basic:

                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-bdw-5557u)
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:223  dwarn:1   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 

4f5493e90cc50f1c6391c4f389f7a79c8fe52355 drm-intel-nightly: 2016y-11m-17d-15h-37m-59s UTC integration manifest d113c2a drm/i915: don't leak global_timeline

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3043/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

✗ Fi.CI.BAT: warning for drm/i915: don't leak global_timeline (rev3)

In reply to Matthew Auld
== Series Details ==

== Series Details ==

Series: drm/i915: don't leak global_timeline (rev3)
URL : https://patchwork.freedesktop.org/series/15439/
State : warning

== Summary ==

Series 15439v3 drm/i915: don't leak global_timeline
https://patchwork.freedesktop.org/api/1.0/series/15439/revisions/3/mbox/

Test drv_module_reload_basic:

                pass       -> DMESG-WARN (fi-ivb-3520m)
                pass       -> DMESG-WARN (fi-ivb-3770)
                pass       -> DMESG-WARN (fi-snb-2600)
                pass       -> DMESG-WARN (fi-byt-n2820)
                pass       -> DMESG-WARN (fi-bdw-5557u)
                pass       -> DMESG-WARN (fi-bsw-n3050)
                pass       -> DMESG-WARN (fi-byt-j1900)
                pass       -> DMESG-WARN (fi-snb-2520m)
                pass       -> DMESG-WARN (fi-hsw-4770r)
                pass       -> DMESG-WARN (fi-skl-6260u)
                pass       -> DMESG-WARN (fi-ilk-650)
                pass       -> DMESG-WARN (fi-skl-6700hq)
                pass       -> DMESG-WARN (fi-hsw-4770)
                pass       -> DMESG-WARN (fi-skl-6770hq)
                pass       -> DMESG-WARN (fi-kbl-7200u)
                pass       -> DMESG-WARN (fi-bxt-t5700)
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-skl-6770hq)
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:223  dwarn:1   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:228  dwarn:2   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 

7fc9e0c9ebb67261bc86264eb7592a9e8d12e7fe drm-intel-nightly: 2016y-11m-17d-20h-31m-28s UTC integration manifest db22805 drm/i915: don't leak global_timeline

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3044/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx