public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/i915: Fix memleak in runtime wakeref tracking
@ 2019-06-27 14:44 Mika Kuoppala
  2019-06-27 14:53 ` Chris Wilson
  2019-06-28  7:38 ` ✗ Fi.CI.BAT: failure for series starting with drm/i915: Fix memleak in runtime wakeref tracking (rev2) Patchwork
  0 siblings, 2 replies; 6+ messages in thread
From: Mika Kuoppala @ 2019-06-27 14:44 UTC (permalink / raw)
  To: intel-gfx

If we untrack wakerefs, the actual count may reach zero.
However the krealloced owners array is still there and
needs to be taken care of. Free the owners unconditionally
to fix the leak.

Fixes: dbf99c1f8c7e ("drm/i915: Force printing wakeref tacking during pm_cleanup")
Reported-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index 502c54428570..8d1aebc3e857 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -221,13 +221,11 @@ __untrack_all_wakerefs(struct intel_runtime_pm_debug *debug,
 static void
 dump_and_free_wakeref_tracking(struct intel_runtime_pm_debug *debug)
 {
-	struct drm_printer p;
+	if (debug->count) {
+		struct drm_printer p = drm_debug_printer("i915");
 
-	if (!debug->count)
-		return;
-
-	p = drm_debug_printer("i915");
-	__print_intel_runtime_pm_wakeref(&p, debug);
+		__print_intel_runtime_pm_wakeref(&p, debug);
+	}
 
 	kfree(debug->owners);
 }
-- 
2.17.1

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

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

end of thread, other threads:[~2019-06-28  7:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-27 14:44 [PATCH 1/1] drm/i915: Fix memleak in runtime wakeref tracking Mika Kuoppala
2019-06-27 14:53 ` Chris Wilson
2019-06-27 15:00   ` Mika Kuoppala
2019-06-27 15:06     ` Imre Deak
2019-06-27 15:04   ` [PATCH] " Mika Kuoppala
2019-06-28  7:38 ` ✗ Fi.CI.BAT: failure for series starting with drm/i915: Fix memleak in runtime wakeref tracking (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox