Skip to contentSkip to conversation

drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

PATCH In review Tvrtko Ursulin 3 participants 4 messages Jan 17, 2019 – Jan 18, 2019

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

PATCH 1/1 drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

From: Tvrtko Ursulin <[email protected]>

To avoid a false positive of a leaked wakeref, we can store the cookie in file->private_data and use it in intel_runtime_pm_put.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -2
index 64d805d9ae59..487b6eeba031 100644
@@ -4408,7 +4408,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
 	if (INTEL_GEN(i915) < 6)
 		return 0;
 
-	intel_runtime_pm_get(i915);
+	file->private_data = (void *)(uintptr_t)intel_runtime_pm_get(i915);
 	intel_uncore_forcewake_user_get(i915);
 
 	return 0;
@@ -4422,7 +4422,8 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
 		return 0;
 
 	intel_uncore_forcewake_user_put(i915);
-	intel_runtime_pm_put_unchecked(i915);
+	intel_runtime_pm_put(i915,
+			     (intel_wakeref_t)(uintptr_t)file->private_data);
 
 	return 0;
 }
Signature · 6 lines
2.19.1

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

Quoting Tvrtko Ursulin (2019-01-17 14:48:31)

Quoted 25 lines

From: Tvrtko Ursulin <[email protected]>

To avoid a false positive of a leaked wakeref, we can store the cookie in file->private_data and use it in intel_runtime_pm_put.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 64d805d9ae59..487b6eeba031 100644
@@ -4408,7 +4408,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
        if (INTEL_GEN(i915) < 6)
                return 0;
 
-       intel_runtime_pm_get(i915);
+       file->private_data = (void *)(uintptr_t)intel_runtime_pm_get(i915);
        intel_uncore_forcewake_user_get(i915);
 
        return 0;

drivers/gpu/drm/i915/i915_debugfs.c static int i915_forcewake_release(struct inode *inode, struct file *file) · line 4426

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -4422,7 +4422,8 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
                return 0;
 
        intel_uncore_forcewake_user_put(i915);
-       intel_runtime_pm_put_unchecked(i915);
+       intel_runtime_pm_put(i915,
+                            (intel_wakeref_t)(uintptr_t)file->private_data);

We definitely don't need to cast between integer types after uintptr, but I can see the desire for symmetry.

-Chris

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

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user
URL : https://patchwork.freedesktop.org/series/55366/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5440 -> Patchwork_11971
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/55366/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s4-devices:
- fi-blb-e6850: PASS -> INCOMPLETE [fdo#107718]

* igt@i915_module_load@reload-with-fault-injection:
- fi-kbl-7567u: NOTRUN -> DMESG-WARN [fdo#105602] / [fdo#108529] +1

* igt@i915_selftest@live_hangcheck:
- fi-bwr-2160: PASS -> DMESG-FAIL [fdo#108735]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-7567u: NOTRUN -> DMESG-FAIL [fdo#105079]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- fi-byt-clapper: NOTRUN -> FAIL [fdo#103191] / [fdo#107362]

* igt@pm_rpm@module-reload:
- fi-kbl-7567u: NOTRUN -> DMESG-WARN [fdo#108529]

#### Possible fixes ####

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: FAIL [fdo#103167] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#108529]: https://bugs.freedesktop.org/show_bug.cgi?id=108529
[fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278

Participating hosts (45 -> 43)
------------------------------

Additional (3): fi-kbl-7567u fi-glk-j4005 fi-byt-clapper
Missing (5): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-pnv-d510

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

* Linux: CI_DRM_5440 -> Patchwork_11971

CI_DRM_5440: b36a89b5ab74fd49a4369e6df0d2c02bc464a474 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4777: 8614d5eb114a660c3bd7ff77eab8bed53424cd30 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11971: c42d476cf09ca69bc81c10839b86460cda833b4f @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

c42d476cf09c drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

== Logs ==

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

#3 lore raw

✗ Fi.CI.IGT: failure for drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Fix wakeref cookie handling in debugfs/i915_forcewake_user
URL : https://patchwork.freedesktop.org/series/55366/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_5440_full -> Patchwork_11971_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_11971_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_11971_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

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

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

### IGT changes ###

#### Possible regressions ####

* igt@kms_rotation_crc@multiplane-rotation:
- shard-kbl: PASS -> DMESG-FAIL

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_schedule@pi-ringfull-vebox:
- shard-skl: NOTRUN -> FAIL [fdo#103158]

* igt@i915_suspend@shrink:
- shard-iclb: NOTRUN -> DMESG-WARN [fdo#107886] / [fdo#109244]

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
- shard-iclb: NOTRUN -> DMESG-WARN [fdo#107956]

* igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-b:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#107956] +1

* igt@kms_ccs@pipe-a-crc-primary-basic:
- shard-iclb: NOTRUN -> FAIL [fdo#107725]

* igt@kms_color@pipe-c-ctm-max:
- shard-apl: PASS -> FAIL [fdo#108147]

* igt@kms_cursor_crc@cursor-128x42-offscreen:
- shard-iclb: PASS -> DMESG-WARN [fdo#107724] / [fdo#108336]

* igt@kms_cursor_crc@cursor-128x42-sliding:
- shard-apl: PASS -> FAIL [fdo#103232] +6

* igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions:
- shard-iclb: PASS -> FAIL [fdo#103355]

* igt@kms_draw_crc@draw-method-rgb565-mmap-cpu-untiled:
- shard-iclb: PASS -> WARN [fdo#108336] +2

* igt@kms_draw_crc@draw-method-rgb565-pwrite-untiled:
- shard-skl: PASS -> FAIL [fdo#103184] +1

* igt@kms_draw_crc@draw-method-xrgb8888-blt-untiled:
- shard-skl: PASS -> FAIL [fdo#103232] / [fdo#108472]

* igt@kms_draw_crc@draw-method-xrgb8888-pwrite-ytiled:
- shard-skl: PASS -> FAIL [fdo#108222]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: PASS -> FAIL [fdo#105363]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-glk: PASS -> FAIL [fdo#103167] +1

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
- shard-apl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-mmap-wc:
- shard-skl: NOTRUN -> FAIL [fdo#103167] +2

* igt@kms_frontbuffer_tracking@fbc-stridechange:
- shard-iclb: PASS -> FAIL [fdo#105683] / [fdo#108040]
- shard-skl: NOTRUN -> FAIL [fdo#105683]

* igt@kms_frontbuffer_tracking@fbc-tilingchange:
- shard-skl: PASS -> FAIL [fdo#105682]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-mmap-wc:
- shard-skl: NOTRUN -> FAIL [fdo#105682] +2

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-iclb: PASS -> FAIL [fdo#103167] +1

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
- shard-skl: NOTRUN -> FAIL [fdo#103191] / [fdo#107362]

* igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#106885]

* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-skl: NOTRUN -> FAIL [fdo#108145] +2

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: PASS -> FAIL [fdo#107815] / [fdo#108145]

* igt@kms_plane_multiple@atomic-pipe-a-tiling-y:
- shard-iclb: PASS -> FAIL [fdo#103166]

* igt@kms_rmfb@close-fd:
- shard-iclb: PASS -> DMESG-WARN [fdo#107724]

* igt@kms_rotation_crc@multiplane-rotation-cropping-top:
- shard-apl: PASS -> DMESG-FAIL [fdo#108950]

* igt@kms_setmode@basic:
- shard-apl: PASS -> FAIL [fdo#99912]

* igt@kms_sysfs_edid_timing:
- shard-iclb: PASS -> FAIL [fdo#100047]

* igt@pm_rpm@universal-planes:
- shard-iclb: PASS -> INCOMPLETE [fdo#108840]

#### Possible fixes ####

* igt@debugfs_test@read_all_entries_display_off:
- shard-skl: INCOMPLETE [fdo#104108] -> PASS

* igt@kms_atomic_transition@plane-all-modeset-transition-internal-panels:
- shard-iclb: DMESG-WARN [fdo#107724] -> PASS +1

* igt@kms_color@pipe-a-legacy-gamma:
- shard-apl: FAIL [fdo#104782] / [fdo#108145] -> PASS

* igt@kms_cursor_crc@cursor-128x128-onscreen:
- shard-glk: FAIL [fdo#103232] -> PASS +1

* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-apl: FAIL [fdo#103191] / [fdo#103232] -> PASS

* igt@kms_cursor_crc@cursor-64x21-random:
- shard-apl: FAIL [fdo#103232] -> PASS +3

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: FAIL [fdo#105767] -> PASS

* igt@kms_flip_event_leak:
- shard-kbl: DMESG-WARN [fdo#103558] / [fdo#105602] -> PASS +4

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-apl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-iclb: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
- shard-glk: FAIL [fdo#103167] -> PASS

* igt@kms_plane@plane-panning-bottom-right-pipe-a-planes:
- shard-iclb: DMESG-WARN [fdo#107724] / [fdo#108336] -> PASS +2

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: FAIL [fdo#103166] -> PASS +4

* igt@pm_rc6_residency@rc6-accuracy:
- shard-kbl: {SKIP} [fdo#109271] -> PASS

* igt@pm_rpm@gem-execbuf-stress:
- shard-skl: INCOMPLETE [fdo#107803] / [fdo#107807] -> PASS

#### Warnings ####

* igt@kms_cursor_crc@cursor-128x128-suspend:
- shard-iclb: FAIL [fdo#103232] -> INCOMPLETE [fdo#107713]

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- shard-snb: DMESG-WARN [fdo#107469] -> INCOMPLETE [fdo#105411] / [fdo#107469]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
[fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#105683]: https://bugs.freedesktop.org/show_bug.cgi?id=105683
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107469]: https://bugs.freedesktop.org/show_bug.cgi?id=107469
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107725]: https://bugs.freedesktop.org/show_bug.cgi?id=107725
[fdo#107803]: https://bugs.freedesktop.org/show_bug.cgi?id=107803
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107886]: https://bugs.freedesktop.org/show_bug.cgi?id=107886
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108040]: https://bugs.freedesktop.org/show_bug.cgi?id=108040
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
[fdo#108222]: https://bugs.freedesktop.org/show_bug.cgi?id=108222
[fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
[fdo#108472]: https://bugs.freedesktop.org/show_bug.cgi?id=108472
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[fdo#109244]: https://bugs.freedesktop.org/show_bug.cgi?id=109244
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109275]: https://bugs.freedesktop.org/show_bug.cgi?id=109275
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109281]: https://bugs.freedesktop.org/show_bug.cgi?id=109281
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109286]: https://bugs.freedesktop.org/show_bug.cgi?id=109286
[fdo#109287]: https://bugs.freedesktop.org/show_bug.cgi?id=109287
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109290]: https://bugs.freedesktop.org/show_bug.cgi?id=109290
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

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

* Linux: CI_DRM_5440 -> Patchwork_11971

CI_DRM_5440: b36a89b5ab74fd49a4369e6df0d2c02bc464a474 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4777: 8614d5eb114a660c3bd7ff77eab8bed53424cd30 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11971: c42d476cf09ca69bc81c10839b86460cda833b4f @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

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