Skip to contentSkip to conversation

drm/i915: fixup overlay stolen memory leak

PATCH In review Daniel Vetter 3 participants 3 messages Dec 18, 2012

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

PATCH 1/1 drm/i915: fixup overlay stolen memory leak

We need to clean up the overlay first, before taking down the stolen memory allocator.

This regression has been introducec in

commit 8040513870399f1cb032cb8bc805df5042fedcdf

Author: Chris Wilson <[email protected]>
Date:   Thu Nov 15 11:32:29 2012 +0000

drm/i915: Allocate overlay registers from stolen memory

Note: This is just a quick hack to shut up a warning in the module unload code, so that I can check again whether we don't leak any framebuffers.

v2: Rework the patch a bit as suggested by Chris Wilson:
- move the overlay teardown up, into the modeset cleanup
- move the stolen mm takedown into i915_gem_cleanup_stolen

---
 drivers/gpu/drm/i915/i915_dma.c        |    3 ---
 drivers/gpu/drm/i915/i915_gem_stolen.c |    3 +++
 drivers/gpu/drm/i915/intel_display.c   |    2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +0 -3
index 14a39e2..27d6af7 100644
@@ -1737,9 +1737,6 @@ int i915_driver_unload(struct drm_device *dev)
 		mutex_unlock(&dev->struct_mutex);
 		i915_gem_cleanup_aliasing_ppgtt(dev);
 		i915_gem_cleanup_stolen(dev);
-		drm_mm_takedown(&dev_priv->mm.stolen);
-
-		intel_cleanup_overlay(dev);
 
 		if (!I915_NEED_GFX_HWS(dev))
 			i915_free_hws(dev);
drivers/gpu/drm/i915/i915_gem_stolen.c +3 -0
index f817b0c..f21ae17 100644
@@ -173,7 +173,10 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
 
 void i915_gem_cleanup_stolen(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
 	i915_gem_stolen_cleanup_compression(dev);
+	drm_mm_takedown(&dev_priv->mm.stolen);
 }
 
 int i915_gem_init_stolen(struct drm_device *dev)
drivers/gpu/drm/i915/intel_display.c +2 -0
index f49fd2a..91c57fb 100644
@@ -9020,6 +9020,8 @@ void intel_modeset_cleanup(struct drm_device *dev)
 	flush_scheduled_work();
 
 	drm_mode_config_cleanup(dev);
+
+	intel_cleanup_overlay(dev);
 }
 
 /*
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Daniel Vetter

We need to clean up the overlay first, before taking down the stolen memory allocator.

This regression has been introducec in

commit 8040513870399f1cb032cb8bc805df5042fedcdf

Author: Chris Wilson <[email protected]>
Date:   Thu Nov 15 11:32:29 2012 +0000

drm/i915: Allocate overlay registers from stolen memory

Note: This is just a quick hack to shut up a warning in the module unload code, so that I can check again whether we don't leak any framebuffers.

Quoted 6 lines

v2: Rework the patch a bit as suggested by Chris Wilson:
- move the overlay teardown up, into the modeset cleanup
- move the stolen mm takedown into i915_gem_cleanup_stolen

That organisation indeed makes more sense.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 10 lines · Chris Wilson
Quoted 9 lines · Daniel Vetter

We need to clean up the overlay first, before taking down the stolen memory allocator.

This regression has been introducec in

commit 8040513870399f1cb032cb8bc805df5042fedcdf

Author: Chris Wilson <[email protected]>
Date:   Thu Nov 15 11:32:29 2012 +0000
Quoted 5 lines
Quoted 5 lines

drm/i915: Allocate overlay registers from stolen memory

Note: This is just a quick hack to shut up a warning in the module unload code, so that I can check again whether we don't leak any framebuffers.

Dropped this note, since it's no longer a hack ...

Quoted 10 lines
Quoted 6 lines

v2: Rework the patch a bit as suggested by Chris Wilson:
- move the overlay teardown up, into the modeset cleanup
- move the stolen mm takedown into i915_gem_cleanup_stolen

That organisation indeed makes more sense.

... and merged it. Thanks for the review.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch