From ea49c9acf2db7082f0406bb3a570cc6bad37082b Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Tue, 16 Feb 2016 15:27:42 +0100 Subject: [PATCH] drm/i915: Lock mode_config.mutex in intel_display_resume. Unfortunately i915 is still not fully atomic, and expects mode_config.mutex to be held during modeset until we finally fix it. This fixes the following WARN when resuming: [ 425.208983] ------------[ cut here ]------------ [ 425.208990] WARNING: CPU: 0 PID: 6828 at drivers/gpu/drm/drm_edid.c:3555 drm_select_eld+0xa5/0xd0() [ 425.209015] Modules linked in: pl2303 usbserial snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic intel_powerclamp coretemp i915 crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel snd_hda_codec snd_hwdep lpc_ich snd_hda_core snd_pcm i2c_hid i2c_designware_platform i2c_designware_core r8169 mii sdhci_acpi sdhci mmc_core [ 425.209018] CPU: 0 PID: 6828 Comm: kworker/u4:5 Tainted: G U W 4.5.0-rc4-gfxbench+ #1 [ 425.209020] Hardware name: \xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff \xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff\xffffffff/DN2820FYK, BIOS FYBYT10H.86A.0038.2014.0717.1455 07/17/2014 [ 425.209027] Workqueue: events_unbound async_run_entry_fn [ 425.209032] 0000000000000000 ffff880072433958 ffffffff813f6b05 0000000000000000 [ 425.209036] ffffffff81aaef2d ffff880072433990 ffffffff81078291 ffff880036b933d8 [ 425.209039] ffff88006d528000 ffff88006d52b3d8 ffff88006d52b3d8 ffff88007315b6f8 [ 425.209040] Call Trace: [ 425.209045] [] dump_stack+0x67/0x92 [ 425.209049] [] warn_slowpath_common+0x81/0xc0 [ 425.209052] [] warn_slowpath_null+0x15/0x20 [ 425.209054] [] drm_select_eld+0xa5/0xd0 [ 425.209101] [] intel_audio_codec_enable+0x44/0x160 [i915] [ 425.209135] [] intel_enable_hdmi_audio+0x87/0x90 [i915] [ 425.209169] [] g4x_enable_hdmi+0x8a/0xa0 [i915] [ 425.209202] [] vlv_hdmi_pre_enable+0x1cb/0x240 [i915] [ 425.209236] [] valleyview_crtc_enable+0x10f/0x290 [i915] [ 425.209270] [] intel_atomic_commit+0x769/0x17a0 [i915] [ 425.209274] [] ? drm_atomic_check_only+0x145/0x660 [ 425.209276] [] drm_atomic_commit+0x32/0x50 [ 425.209310] [] intel_display_resume+0xa0/0x130 [i915] [ 425.209338] [] i915_drm_resume+0xcb/0x160 [i915] [ 425.209366] [] i915_pm_resume+0x22/0x30 [i915] [ 425.209370] [] pci_pm_resume+0x6e/0xe0 [ 425.209373] [] ? pci_pm_resume_noirq+0xa0/0xa0 [ 425.209375] [] dpm_run_callback+0x6e/0x280 [ 425.209378] [] device_resume+0x92/0x250 [ 425.209380] [] async_resume+0x18/0x40 [ 425.209382] [] async_run_entry_fn+0x45/0x140 [ 425.209386] [] process_one_work+0x1e3/0x620 [ 425.209388] [] ? process_one_work+0x147/0x620 [ 425.209391] [] worker_thread+0x49/0x490 [ 425.209393] [] ? process_one_work+0x620/0x620 [ 425.209396] [] kthread+0xea/0x100 [ 425.209400] [] ? kthread_create_on_node+0x1f0/0x1f0 [ 425.209404] [] ret_from_fork+0x3f/0x70 [ 425.209407] [] ? kthread_create_on_node+0x1f0/0x1f0 [ 425.209409] ---[ end trace d1b247107f34a8b2 ]--- Fixes: e2c8b8701e2d ("drm/i915: Use atomic helpers for suspend, v2.") Signed-off-by: Maarten Lankhorst Link: http://patchwork.freedesktop.org/patch/msgid/1455632862-18557-1-git-send-email-maarten.lankhorst@linux.intel.com Reviewed-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 568eefc7cc62..aedddaabc06b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -15883,6 +15883,13 @@ void intel_display_resume(struct drm_device *dev) dev_priv->modeset_restore_state = NULL; + /* + * This is a cludge because with real atomic modeset mode_config.mutex + * won't be taken. Unfortunately some probed state like + * audio_codec_enable is still protected by mode_config.mutex, so lock + * it here for now. + */ + mutex_lock(&dev->mode_config.mutex); drm_modeset_acquire_init(&ctx, 0); retry: @@ -15921,6 +15928,7 @@ retry: drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); + mutex_unlock(&dev->mode_config.mutex); if (ret) { DRM_ERROR("Restoring old state failed with %i\n", ret); -- 2.20.1