diff mbox series

[11/20] drm/i915: Grab a runtime pm reference before run live selftests

Message ID 20180809001606.26876-11-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [01/20] drm: Let userspace check if driver supports modeset | expand

Commit Message

Souza, Jose Aug. 9, 2018, 12:15 a.m. UTC
Now that modeset stuff is not being initialized when display is
disabled nothing is holding a power well or runtime pm reference
when running live selftests. And IGT runs live selftests with
display on and off, causing the below warning:

[  473.586533] Setting dangerous option live_selftests - tainting kernel
[  484.219068] ------------[ cut here ]------------
[  484.219070] RPM wakelock ref not held during HW access
[  484.219126] WARNING: CPU: 3 PID: 4659 at drivers/gpu/drm/i915/intel_drv.h:1986 intel_runtime_pm_get_noresume+0x6c/0x70 [i915]
[  484.219128] Modules linked in: i915(+) amdgpu chash gpu_sched ttm vgem snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic btusb btrtl btbcm x86_pkg_temp_thermal btintel coretemp snd_hda_codec asix crct10dif_pclmul bluetooth crc32_pclmul usbnet snd_hwdep mii snd_hda_core ghash_clmulni_intel e1000e snd_pcm ecdh_generic mei_me mei prime_numbers pinctrl_sunrisepoint pinctrl_intel [last unloaded: i915]
[  484.219173] CPU: 3 PID: 4659 Comm: drv_selftest Tainted: G     U            4.18.0-rc8-CI-Trybot_2696+ #1
[  484.219174] Hardware name: Intel Corporation Kabylake Client platform/Kabylake R DDR4 RVP, BIOS KBLSE2R1.R00.X078.P02.1703030515 03/03/2017
[  484.219205] RIP: 0010:intel_runtime_pm_get_noresume+0x6c/0x70 [i915]
[  484.219206] Code: 94 77 20 00 01 e8 04 bf 53 e0 0f 0b eb c5 80 3d 83 77 20 00 00 75 c6 48 c7 c7 50 b4 ca a0 c6 05 73 77 20 00 01 e8 e4 be 53 e0 <0f> 0b eb af 41 54 55 53 80 bf e4 ab 00 00 00 48 89 fb 48 8b af e0
[  484.219277] RSP: 0018:ffffc900003bfa10 EFLAGS: 00010286
[  484.219279] RAX: 0000000000000000 RBX: ffff88023c160000 RCX: 0000000000000001
[  484.219281] RDX: 0000000080000001 RSI: ffffffff820c708c RDI: 00000000ffffffff
[  484.219282] RBP: ffff8802b4ceb3f8 R08: 00000000afcc94fa R09: 0000000000000000
[  484.219284] R10: ffff8802b5820358 R11: 0000000000000000 R12: ffff88023c160068
[  484.219285] R13: ffffffffa0c80e30 R14: ffffffffa0cce2a0 R15: ffff88023c160000
[  484.219287] FS:  00007f4d95a83980(0000) GS:ffff8802becc0000(0000) knlGS:0000000000000000
[  484.219288] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  484.219290] CR2: 00007f4d953257a0 CR3: 00000001fa1d8001 CR4: 00000000003606e0
[  484.219291] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  484.219292] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  484.219294] Call Trace:
[  484.219328]  i915_gem_unpark+0xb9/0x170 [i915]
[  484.219361]  igt_mmap_offset_exhaustion+0x365/0x6e0 [i915]
[  484.219400]  ? __i915_subtests+0x39/0xf0 [i915]
[  484.219403]  ? ring_buffer_unlock_commit+0x20/0xd0
[  484.219406]  ? trace_vbprintk+0x171/0x220
[  484.219411]  ? __trace_bprintk+0x57/0x80
[  484.219450]  __i915_subtests+0x5e/0xf0 [i915]
[  484.219487]  __run_selftests+0x10b/0x190 [i915]
[  484.219522]  i915_live_selftests+0x2c/0x60 [i915]
[  484.219552]  i915_pci_probe+0x50/0xa0 [i915]
[  484.219556]  pci_device_probe+0xa1/0x130
[  484.219560]  driver_probe_device+0x2f5/0x470

So now grabbing and releasing a runtime pm reference around
i915_live_selftests() call.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index e931b48369dd..d43b950c2798 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -695,6 +695,7 @@  static void i915_pci_remove(struct pci_dev *pdev)
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+	struct drm_i915_private *dev_priv;
 	struct intel_device_info *intel_info =
 		(struct intel_device_info *) ent->driver_data;
 	int err;
@@ -730,7 +731,10 @@  static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		return -ENODEV;
 	}
 
+	dev_priv = to_i915(pci_get_drvdata(pdev));
+	intel_runtime_pm_get(dev_priv);
 	err = i915_live_selftests(pdev);
+	intel_runtime_pm_put(dev_priv);
 	if (err) {
 		i915_pci_remove(pdev);
 		return err > 0 ? -ENOTTY : err;