Bug 90874 - [SKL] scaler atomic code tries to read back CDCLK while the device is suspended
Summary: [SKL] scaler atomic code tries to read back CDCLK while the device is suspended
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: XOrg git
Hardware: Other All
: medium normal
Assignee: Intel GFX Bugs mailing list
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-05 16:47 UTC by Damien Lespiau
Modified: 2017-07-24 22:46 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
attachment-21412-0.html (1.84 KB, text/html)
2017-07-24 22:46 UTC, chandra
no flags Details

Description Damien Lespiau 2015-06-05 16:47:35 UTC
When waking up from run-time PM, I get this warning:

[ 3757.817202] WARNING: CPU: 1 PID: 23158 at drivers/gpu/drm/i915/intel_uncore.c:70 assert_device_not_suspended.isra.10+0x60/0x70 [i915]()
[ 3757.817203] Device suspended
[ 3757.817204] Modules linked in: snd_hda_codec_hdmi cfg80211 bluetooth rfkill vfat fat snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_temp_thermal coretemp snd_hda_intel kvm_intel snd_hda_codec kvm snd_hwdep snd_hda_core snd_seq crc32_pclmul crc32c_intel snd_seq_device ghash_clmulni_intel snd_pcm microcode snd_timer serio_raw snd soundcore acpi_pad pegasus mii i915 i2c_algo_bit drm_kms_helper drm sdhci_acpi i2c_core sdhci mmc_core video
[ 3757.817231] CPU: 1 PID: 23158 Comm: pm_rpm Tainted: G        W       4.1.0-rc6+ #7
[ 3757.817233] Hardware name: Intel Corporation Skylake Client platform/Skylake Y LPDDR3 RVP3, BIOS SKLSE2P1.86C.X060.R00.1411120819 11/12/2014
[ 3757.817234]  ffffffffa01c5680 ffff88009a8c3968 ffffffff8178848c 0000000000000000
[ 3757.817238]  ffff88009a8c39b8 ffff88009a8c39a8 ffffffff8109425a 0000000000000000
[ 3757.817241]  ffff880093040000 0000000000046010 ffff88003f051400 ffff880093040080
[ 3757.817244] Call Trace:
[ 3757.817249]  [<ffffffff8178848c>] dump_stack+0x45/0x57
[ 3757.817253]  [<ffffffff8109425a>] warn_slowpath_common+0x8a/0xc0
[ 3757.817255]  [<ffffffff810942d6>] warn_slowpath_fmt+0x46/0x50
[ 3757.817272]  [<ffffffffa01449e0>] assert_device_not_suspended.isra.10+0x60/0x70 [i915]
[ 3757.817289]  [<ffffffffa0147ae5>] gen9_read32+0x35/0x310 [i915]
[ 3757.817307]  [<ffffffffa0151c23>] skylake_get_display_clock_speed+0x23/0x130 [i915]
[ 3757.817326]  [<ffffffffa016d011>] skl_max_scale+0x31/0x70 [i915]
[ 3757.817346]  [<ffffffffa016d313>] intel_check_primary_plane+0x2c3/0x330 [i915]
[ 3757.817358]  [<ffffffffa006c2c9>] ? drm_crtc_get_hv_timing+0x39/0x60 [drm]
[ 3757.817377]  [<ffffffffa018054d>] intel_plane_atomic_check+0x11d/0x220 [i915]
[ 3757.817384]  [<ffffffffa00d4b1a>] drm_atomic_helper_check_planes+0xca/0x1f0 [drm_kms_helper]
[ 3757.817401]  [<ffffffffa0166484>] intel_modeset_compute_config+0x634/0x1260 [i915]
[ 3757.817414]  [<ffffffffa007fa5d>] ? drm_atomic_set_fb_for_plane+0x2d/0x90 [drm]
[ 3757.817430]  [<ffffffffa016bc98>] intel_crtc_set_config+0x358/0x5b0 [i915]
[ 3757.817441]  [<ffffffffa006e262>] drm_mode_set_config_internal+0x72/0x120 [drm]
[ 3757.817445]  [<ffffffff811d6f12>] ? might_fault+0x42/0xa0
[ 3757.817455]  [<ffffffffa007248e>] drm_mode_setcrtc+0xde/0x560 [drm]
[ 3757.817462]  [<ffffffffa0062c79>] drm_ioctl+0x359/0x690 [drm]
[ 3757.817471]  [<ffffffffa00723b0>] ? drm_mode_setplane+0x1e0/0x1e0 [drm]
[ 3757.817475]  [<ffffffff81239948>] do_vfs_ioctl+0x318/0x570
[ 3757.817478]  [<ffffffff81149e01>] ? __audit_syscall_entry+0x21/0x110
[ 3757.817481]  [<ffffffff8133786b>] ? selinux_file_ioctl+0x5b/0x110
[ 3757.817483]  [<ffffffff81239c21>] SyS_ioctl+0x81/0xa0
[ 3757.817486]  [<ffffffff8179152e>] system_call_fastpath+0x12/0x76


[ 3757.817202] WARNING: CPU: 1 PID: 23158 at drivers/gpu/drm/i915/intel_uncore.c:70 assert_device_not_suspended.isra.10+0x60/0x70 [i915]()
[ 3757.817203] Device suspended
[ 3757.817204] Modules linked in: snd_hda_codec_hdmi cfg80211 bluetooth rfkill vfat fat snd_hda_codec_realtek snd_hda_codec_generic x86_pkg_temp_thermal coretemp snd_hda_intel kvm_intel snd_hda_codec kvm snd_hwdep snd_hda_core snd_seq crc32_pclmul crc32c_intel snd_seq_device ghash_clmulni_intel snd_pcm microcode snd_timer serio_raw snd soundcore acpi_pad pegasus mii i915 i2c_algo_bit drm_kms_helper drm sdhci_acpi i2c_core sdhci mmc_core video
[ 3757.817231] CPU: 1 PID: 23158 Comm: pm_rpm Tainted: G        W       4.1.0-rc6+ #7
[ 3757.817233] Hardware name: Intel Corporation Skylake Client platform/Skylake Y LPDDR3 RVP3, BIOS SKLSE2P1.86C.X060.R00.1411120819 11/12/2014
[ 3757.817234]  ffffffffa01c5680 ffff88009a8c3968 ffffffff8178848c 0000000000000000
[ 3757.817238]  ffff88009a8c39b8 ffff88009a8c39a8 ffffffff8109425a 0000000000000000
[ 3757.817241]  ffff880093040000 0000000000046010 ffff88003f051400 ffff880093040080
[ 3757.817244] Call Trace:
[ 3757.817249]  [<ffffffff8178848c>] dump_stack+0x45/0x57
[ 3757.817253]  [<ffffffff8109425a>] warn_slowpath_common+0x8a/0xc0
[ 3757.817255]  [<ffffffff810942d6>] warn_slowpath_fmt+0x46/0x50
[ 3757.817272]  [<ffffffffa01449e0>] assert_device_not_suspended.isra.10+0x60/0x70 [i915]
[ 3757.817289]  [<ffffffffa0147ae5>] gen9_read32+0x35/0x310 [i915]
[ 3757.817307]  [<ffffffffa0151c23>] skylake_get_display_clock_speed+0x23/0x130 [i915]
[ 3757.817326]  [<ffffffffa016d011>] skl_max_scale+0x31/0x70 [i915]
[ 3757.817346]  [<ffffffffa016d313>] intel_check_primary_plane+0x2c3/0x330 [i915]
[ 3757.817358]  [<ffffffffa006c2c9>] ? drm_crtc_get_hv_timing+0x39/0x60 [drm]
[ 3757.817377]  [<ffffffffa018054d>] intel_plane_atomic_check+0x11d/0x220 [i915]
[ 3757.817384]  [<ffffffffa00d4b1a>] drm_atomic_helper_check_planes+0xca/0x1f0 [drm_kms_helper]
[ 3757.817401]  [<ffffffffa0166484>] intel_modeset_compute_config+0x634/0x1260 [i915]
[ 3757.817414]  [<ffffffffa007fa5d>] ? drm_atomic_set_fb_for_plane+0x2d/0x90 [drm]
[ 3757.817430]  [<ffffffffa016bc98>] intel_crtc_set_config+0x358/0x5b0 [i915]
[ 3757.817441]  [<ffffffffa006e262>] drm_mode_set_config_internal+0x72/0x120 [drm]
[ 3757.817445]  [<ffffffff811d6f12>] ? might_fault+0x42/0xa0
[ 3757.817455]  [<ffffffffa007248e>] drm_mode_setcrtc+0xde/0x560 [drm]
[ 3757.817462]  [<ffffffffa0062c79>] drm_ioctl+0x359/0x690 [drm]
[ 3757.817471]  [<ffffffffa00723b0>] ? drm_mode_setplane+0x1e0/0x1e0 [drm]
[ 3757.817475]  [<ffffffff81239948>] do_vfs_ioctl+0x318/0x570
[ 3757.817478]  [<ffffffff81149e01>] ? __audit_syscall_entry+0x21/0x110
[ 3757.817481]  [<ffffffff8133786b>] ? selinux_file_ioctl+0x5b/0x110
[ 3757.817483]  [<ffffffff81239c21>] SyS_ioctl+0x81/0xa0
[ 3757.817486]  [<ffffffff8179152e>] system_call_fastpath+0x12/0x76

The intel_check_primary_plane() codes tries to access the hardware, which I believe is not what we're supposed to do in those functions. We do have the cdclk frequency cached into dev_priv, but that may not be the right fix either as, at that time, the device is suspended and we haven't quite decided if the cached cdclk value when we're on the reference clock should be the previous CDCLK or the reference clock freq (most likely the latter).

To properly solve this I think we need to make CDCLK part of the atomic state and derive the target CDCLK frequency when computing the configuration.
Comment 1 Damien Lespiau 2015-06-05 16:48:19 UTC
Where's the edit button so I can remove that duplicated trace? :(
Comment 2 chandra 2015-06-09 19:22:49 UTC
Initial implementation used cached scale values which were calculated at every modeset time. But based on review feedback it was changed to use live values by calling skylake_get_display_clock_speed(). 
Right fix is to precompute required clock and maintain in crtc_state. Either this caller or any other caller can look into crtc_state to get the active clock or clock that is about to be set (incase of modeset).
Comment 3 Jani Nikula 2015-06-10 12:12:45 UTC
Should be fixed by

commit f662af8c5c1619b91e3834fff103e7423e20df81
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date:   Wed Jun 10 10:24:20 2015 +0200

    Revert "drm/i915: Read hw state into an atomic state struct, v2."

please retest current drm-intel-nightly.
Comment 4 Ander Conselvan de Oliveira 2015-06-23 12:40:48 UTC
Should be fixed in -nightly by

commit 27c329ed16ddf5540151dfa9d22c584b819e0718
Author: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date:   Mon Jun 15 12:33:56 2015 +0200

    drm/i915: Make cdclk part of the atomic state.
Comment 5 chandra 2015-06-23 12:40:56 UTC
Please expect delayed responses.
Comment 6 chandra 2017-07-24 22:46:59 UTC
Created attachment 132936 [details]
attachment-21412-0.html

Hi,
Out of office. Please expect delays.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.