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

* Re: [PATCH 1/1] drm/i915: Fix memleak in runtime wakeref tracking
  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: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
  1 sibling, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2019-06-27 14:53 UTC (permalink / raw)
  To: Mika Kuoppala, intel-gfx

Quoting Mika Kuoppala (2019-06-27 15:44:38)
> 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.

That is true.

> Fixes: dbf99c1f8c7e ("drm/i915: Force printing wakeref tacking during pm_cleanup")

However, the bug is mine
Fixes: bd780f37a361 ("drm/i915: Track all held rpm wakerefs")

> 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>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 1/1] drm/i915: Fix memleak in runtime wakeref tracking
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Mika Kuoppala @ 2019-06-27 15:00 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Chris Wilson <chris@chris-wilson.co.uk> writes:

> Quoting Mika Kuoppala (2019-06-27 15:44:38)
>> 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.
>
> That is true.
>
>> Fixes: dbf99c1f8c7e ("drm/i915: Force printing wakeref tacking during pm_cleanup")
>
> However, the bug is mine
> Fixes: bd780f37a361 ("drm/i915: Track all held rpm wakerefs")

Indeed. Apologies Imre!

I personally know the reviewer of the original patch
and will have a discussion.
-Mika

>
>> 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>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH] drm/i915: Fix memleak in runtime wakeref tracking
  2019-06-27 14:53 ` Chris Wilson
  2019-06-27 15:00   ` Mika Kuoppala
@ 2019-06-27 15:04   ` Mika Kuoppala
  1 sibling, 0 replies; 6+ messages in thread
From: Mika Kuoppala @ 2019-06-27 15:04 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: bd780f37a361 ("drm/i915: Track all held rpm wakerefs")
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>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 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

* Re: [PATCH 1/1] drm/i915: Fix memleak in runtime wakeref tracking
  2019-06-27 15:00   ` Mika Kuoppala
@ 2019-06-27 15:06     ` Imre Deak
  0 siblings, 0 replies; 6+ messages in thread
From: Imre Deak @ 2019-06-27 15:06 UTC (permalink / raw)
  To: Mika Kuoppala; +Cc: intel-gfx

On Thu, Jun 27, 2019 at 06:00:21PM +0300, Mika Kuoppala wrote:
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > Quoting Mika Kuoppala (2019-06-27 15:44:38)
> >> 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.
> >
> > That is true.
> >
> >> Fixes: dbf99c1f8c7e ("drm/i915: Force printing wakeref tacking during pm_cleanup")
> >
> > However, the bug is mine
> > Fixes: bd780f37a361 ("drm/i915: Track all held rpm wakerefs")
> 
> Indeed. Apologies Imre!
> 
> I personally know the reviewer of the original patch
> and will have a discussion.

Good catch, I've been staring at the kmemleak logs J-P provided, but
couldn't see how it can happen. 

> -Mika
> 
> >
> >> 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>
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > -Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.BAT: failure for series starting with drm/i915: Fix memleak in runtime wakeref tracking (rev2)
  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-28  7:38 ` Patchwork
  1 sibling, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-06-28  7:38 UTC (permalink / raw)
  To: Mika Kuoppala; +Cc: intel-gfx

== Series Details ==

Series: series starting with drm/i915: Fix memleak in runtime wakeref tracking (rev2)
URL   : https://patchwork.freedesktop.org/series/62871/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6375 -> Patchwork_13457
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with Patchwork_13457 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_13457, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_13457:

### IGT changes ###

#### Possible regressions ####

  * igt@i915_pm_rpm@basic-rte:
    - fi-skl-6600u:       NOTRUN -> [DMESG-WARN][1]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-skl-6600u/igt@i915_pm_rpm@basic-rte.html

  * igt@i915_pm_rpm@module-reload:
    - fi-cml-u:           [PASS][2] -> [DMESG-WARN][3]
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-cml-u/igt@i915_pm_rpm@module-reload.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-cml-u/igt@i915_pm_rpm@module-reload.html

  
Known issues
------------

  Here are the changes found in Patchwork_13457 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live_blt:
    - fi-icl-dsi:         [PASS][4] -> [INCOMPLETE][5] ([fdo#107713])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-icl-dsi/igt@i915_selftest@live_blt.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-icl-dsi/igt@i915_selftest@live_blt.html
    - fi-skl-iommu:       [PASS][6] -> [INCOMPLETE][7] ([fdo#108602])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-skl-iommu/igt@i915_selftest@live_blt.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-skl-iommu/igt@i915_selftest@live_blt.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [PASS][8] -> [FAIL][9] ([fdo#109485])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  
#### Possible fixes ####

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u2:          [FAIL][10] ([fdo#103167]) -> [PASS][11]
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html

  * igt@prime_self_import@basic-with_two_bos:
    - fi-icl-u3:          [DMESG-WARN][12] ([fdo#107724]) -> [PASS][13] +1 similar issue
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6375/fi-icl-u3/igt@prime_self_import@basic-with_two_bos.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/fi-icl-u3/igt@prime_self_import@basic-with_two_bos.html

  
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
  [fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485


Participating hosts (53 -> 45)
------------------------------

  Additional (1): fi-skl-6600u 
  Missing    (9): fi-kbl-soraka fi-kbl-7567u fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * Linux: CI_DRM_6375 -> Patchwork_13457

  CI_DRM_6375: 44b3a556c682d3ae6d1cf94f6ec7c155ebeeff50 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_5070: 250475af7bc52ba64956e6b35591fdd7176954d7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_13457: 6095e391e0434e88cc9187a20148b92e32e7cf6e @ git://anongit.freedesktop.org/gfx-ci/linux


== Kernel 32bit build ==

Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/build_32bit.log

  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  CHK     include/generated/compile.h
Kernel: arch/x86/boot/bzImage is ready  (#1)
  Building modules, stage 2.
  MODPOST 112 modules
ERROR: "__udivdi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: "__divdi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
scripts/Makefile.modpost:91: recipe for target '__modpost' failed
make[1]: *** [__modpost] Error 1
Makefile:1287: recipe for target 'modules' failed
make: *** [modules] Error 2


== Linux commits ==

6095e391e043 drm/i915: Fix memleak in runtime wakeref tracking

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13457/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[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