linux_dsm_epyc7002/drivers/gpu/drm/i915
Bjørn Mork 9f54d4bd58 drm/i915: fix deadlock on lid open
commit e2c8b8701e moved modeset locking inside resume/suspend
functions, but missed a code path only executed on lid close/open
on older hardware. The result was a deadlock when closing and
opening the lid without suspending on such hardware:

 =============================================
 [ INFO: possible recursive locking detected ]
 4.6.0-rc1 #385 Not tainted
 ---------------------------------------------
 kworker/0:3/88 is trying to acquire lock:
  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffffa063e6a4>] intel_display_resume+0x4a/0x12f [i915]

 but task is already holding lock:
  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffffa02d0d4f>] drm_modeset_lock_all+0x3e/0xa6 [drm]

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&dev->mode_config.mutex);
   lock(&dev->mode_config.mutex);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 7 locks held by kworker/0:3/88:
  #0:  ("kacpi_notify"){++++.+}, at: [<ffffffff81068dfc>] process_one_work+0x14a/0x50b
  #1:  ((&dpc->work)#2){+.+.+.}, at: [<ffffffff81068dfc>] process_one_work+0x14a/0x50b
  #2:  ((acpi_lid_notifier).rwsem){++++.+}, at: [<ffffffff8106f874>] __blocking_notifier_call_chain+0x34/0x65
  #3:  (&dev_priv->modeset_restore_lock){+.+.+.}, at: [<ffffffffa0664cf6>] intel_lid_notify+0x3c/0xd9 [i915]
  #4:  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffffa02d0d4f>] drm_modeset_lock_all+0x3e/0xa6 [drm]
  #5:  (crtc_ww_class_acquire){+.+.+.}, at: [<ffffffffa02d0d59>] drm_modeset_lock_all+0x48/0xa6 [drm]
  #6:  (crtc_ww_class_mutex){+.+.+.}, at: [<ffffffffa02d0b2a>] modeset_lock+0x13c/0x1cd [drm]

 stack backtrace:
 CPU: 0 PID: 88 Comm: kworker/0:3 Not tainted 4.6.0-rc1 #385
 Hardware name: LENOVO 2776LEG/2776LEG, BIOS 6EET55WW (3.15 ) 12/19/2011
 Workqueue: kacpi_notify acpi_os_execute_deferred
  0000000000000000 ffff88022fd5f990 ffffffff8124af06 ffffffff825b39c0
  ffffffff825b39c0 ffff88022fd5fa60 ffffffff8108f547 ffff88022fd5fa70
  000000008108e817 ffff880230236cc0 0000000000000000 ffffffff825b39c0
 Call Trace:
  [<ffffffff8124af06>] dump_stack+0x67/0x90
  [<ffffffff8108f547>] __lock_acquire+0xdb5/0xf71
  [<ffffffff8108bd2c>] ? look_up_lock_class+0xbe/0x10a
  [<ffffffff8108fae2>] lock_acquire+0x137/0x1cb
  [<ffffffff8108fae2>] ? lock_acquire+0x137/0x1cb
  [<ffffffffa063e6a4>] ? intel_display_resume+0x4a/0x12f [i915]
  [<ffffffff8148202f>] mutex_lock_nested+0x7e/0x3a4
  [<ffffffffa063e6a4>] ? intel_display_resume+0x4a/0x12f [i915]
  [<ffffffffa063e6a4>] ? intel_display_resume+0x4a/0x12f [i915]
  [<ffffffffa02d0b2a>] ? modeset_lock+0x13c/0x1cd [drm]
  [<ffffffffa063e6a4>] intel_display_resume+0x4a/0x12f [i915]
  [<ffffffffa063e6a4>] ? intel_display_resume+0x4a/0x12f [i915]
  [<ffffffffa02d0b2a>] ? modeset_lock+0x13c/0x1cd [drm]
  [<ffffffffa02d0b2a>] ? modeset_lock+0x13c/0x1cd [drm]
  [<ffffffffa02d0bf7>] ? drm_modeset_lock+0x17/0x24 [drm]
  [<ffffffffa02d0c8b>] ? drm_modeset_lock_all_ctx+0x87/0xa1 [drm]
  [<ffffffffa0664d6a>] intel_lid_notify+0xb0/0xd9 [i915]
  [<ffffffff8106f4c6>] notifier_call_chain+0x4a/0x6c
  [<ffffffff8106f88d>] __blocking_notifier_call_chain+0x4d/0x65
  [<ffffffff8106f8b9>] blocking_notifier_call_chain+0x14/0x16
  [<ffffffffa0011215>] acpi_lid_send_state+0x83/0xad [button]
  [<ffffffffa00112a6>] acpi_button_notify+0x41/0x132 [button]
  [<ffffffff812b07df>] acpi_device_notify+0x19/0x1b
  [<ffffffff812c8570>] acpi_ev_notify_dispatch+0x49/0x64
  [<ffffffff812ab9fb>] acpi_os_execute_deferred+0x14/0x20
  [<ffffffff81068f17>] process_one_work+0x265/0x50b
  [<ffffffff810696f5>] worker_thread+0x1fc/0x2dd
  [<ffffffff810694f9>] ? rescuer_thread+0x309/0x309
  [<ffffffff810694f9>] ? rescuer_thread+0x309/0x309
  [<ffffffff8106e2d6>] kthread+0xe0/0xe8
  [<ffffffff8107bc47>] ? local_clock+0x19/0x22
  [<ffffffff81484f42>] ret_from_fork+0x22/0x40
  [<ffffffff8106e1f6>] ? kthread_create_on_node+0x1b5/0x1b5

Fixes: e2c8b8701e ("drm/i915: Use atomic helpers for suspend, v2.")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1459328913-13719-1-git-send-email-bjorn@mork.no
2016-03-30 12:17:13 +02:00
..
dvo_ch7xxx.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo_ch7017.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo_ivch.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo_ns2501.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo_sil164.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo_tfp410.c drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
dvo.h drm/i915: constify intel_dvo_dev_ops structures 2015-12-09 08:21:10 +01:00
i915_cmd_parser.c drm/i915: Bump command parser version for new whitelisted registers 2016-03-21 10:03:26 +01:00
i915_debugfs.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_dma.c drm/i915: Fix races on fbdev 2016-03-30 08:23:41 +02:00
i915_drv.c drm/i915: Call intel_dp_mst_resume() before resuming displays 2016-03-30 08:23:41 +02:00
i915_drv.h drm/i915: Update DRIVER_DATE to 20160330 2016-03-30 09:33:11 +02:00
i915_gem_batch_pool.c
i915_gem_batch_pool.h
i915_gem_context.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_gem_debug.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_gem_dmabuf.c drm/i915: Use CPU mapping for userspace dma-buf mmap() 2016-02-09 11:21:03 +01:00
i915_gem_evict.c drm/i915: Rename vma->*_list to *_link for consistency 2016-02-26 13:15:39 +00:00
i915_gem_execbuffer.c drm/i915: Rename dev_priv->gtt to dev_priv->ggtt 2016-03-18 15:18:15 +02:00
i915_gem_fence.c Linux 4.4-rc4 2015-12-08 11:04:26 +10:00
i915_gem_gtt.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_gem_gtt.h drm/i915/gtt: Clean up GGTT probing code 2016-03-18 15:18:15 +02:00
i915_gem_render_state.c drm/i915: Rename intel_engine_cs struct members 2016-03-16 15:33:17 +00:00
i915_gem_render_state.h drm/i915: Rename intel_engine_cs function parameters 2016-03-16 15:33:10 +00:00
i915_gem_shrinker.c drm/i915: Rename vma->*_list to *_link for consistency 2016-02-26 13:15:39 +00:00
i915_gem_stolen.c drm/i915: Rename dev_priv->gtt to dev_priv->ggtt 2016-03-18 15:18:15 +02:00
i915_gem_tiling.c drm/i915: get runtime PM reference around GEM set_tiling IOCTL 2015-11-17 18:43:30 +02:00
i915_gem_userptr.c drm/i915: Avoid snooping with userptr where not supported 2016-03-02 13:46:21 +00:00
i915_gem.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_gpu_error.c drm/i915: introduce for_each_engine_id() 2016-03-24 14:34:06 +00:00
i915_guc_reg.h drm/i915/guc: Add GuC ADS (Addition Data Structure) - allocation 2016-01-05 11:33:34 +01:00
i915_guc_submission.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_ioc32.c
i915_irq.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
i915_params.c drm/i915: Add fault injection support 2016-03-17 15:22:09 +02:00
i915_params.h drm/i915: Add fault injection support 2016-03-17 15:22:09 +02:00
i915_reg.h drm/i915/bxt: Fix DSI HW state readout 2016-03-24 14:48:21 +02:00
i915_suspend.c drm/i915/bxt: Don't save/restore eDP panel power during suspend (v3) 2016-02-08 11:32:32 +02:00
i915_sysfs.c drm/i915: Hold RPM reference while setting freq limits through sysfs 2016-03-02 18:50:47 +02:00
i915_trace_points.c
i915_trace.h drm/i915: More intel_engine_cs renaming 2016-03-16 15:33:24 +00:00
i915_vgpu.c drm/i915: Rename dev_priv->gtt to dev_priv->ggtt 2016-03-18 15:18:15 +02:00
i915_vgpu.h drm/i915: Type safe register read/write 2015-11-18 15:39:11 +02:00
intel_acpi.c
intel_atomic_plane.c drm/i915: Pass the correct crtc state to .update_plane() 2016-03-10 13:49:31 +02:00
intel_atomic.c drm/i915: Remove some post-commit members from intel_crtc->atomic, v3. 2016-03-16 14:50:25 +01:00
intel_audio.c drm/i915: Move load time init of display/audio hooks earlier 2016-03-17 15:22:04 +02:00
intel_bios.c drm/i915: remove unused dev_priv->render_reclock_avail 2016-03-29 15:12:40 +03:00
intel_bios.h drm/i915: hide away VBT private data in a separate header 2016-03-17 11:58:57 +02:00
intel_color.c drm/i915: Implement color management on chv 2016-03-21 11:41:28 -07:00
intel_crt.c drm/i915: Move HSW/BDW pll selection logic to intel_dpll_mgr.c 2016-03-09 11:55:31 +02:00
intel_csr.c drm/i915/csr: Allow matching unknown HW steppings with generic firmware 2016-03-16 17:53:00 +02:00
intel_ddi.c drm/i915: move edp low vswing config to vbt data 2016-03-29 15:12:20 +03:00
intel_display.c drm/i915/bxt: Fix DSI HW state readout 2016-03-24 14:48:21 +02:00
intel_dp_link_training.c drm/i915/dp: reduce missing TPS3 support errors to debug logging 2016-02-08 11:37:17 +02:00
intel_dp_mst.c drm/i915: Fix race condition in intel_dp_destroy_mst_connector() 2016-03-17 09:12:28 +01:00
intel_dp.c drm/i915: move edp low vswing config to vbt data 2016-03-29 15:12:20 +03:00
intel_dpll_mgr.c drm/i915: fix sparse warning for using false as NULL 2016-03-17 11:12:07 +02:00
intel_dpll_mgr.h drm/i915: Use a crtc mask instead of a refcount for dpll functions, v2. 2016-03-17 09:27:28 +01:00
intel_drv.h drm/i915: Implement color management on bdw/skl/bxt/kbl 2016-03-21 11:40:31 -07:00
intel_dsi_panel_vbt.c drm/i915/dsi: start using enum mipi_dsi_pixel_format 2016-03-16 17:55:52 +02:00
intel_dsi_pll.c drm/i915/bxt: Fix DSI HW state readout 2016-03-24 14:48:21 +02:00
intel_dsi.c drm/i915/bxt: Fix DSI HW state readout 2016-03-24 14:48:21 +02:00
intel_dsi.h drm/i915/bxt: Fix DSI HW state readout 2016-03-24 14:48:21 +02:00
intel_dvo.c drm: Pass 'name' to drm_encoder_init() 2015-12-11 09:13:20 +01:00
intel_fbc.c drm/i915: Rename dev_priv->gtt to dev_priv->ggtt 2016-03-18 15:18:15 +02:00
intel_fbdev.c drm/i915: Fix races on fbdev 2016-03-30 08:23:41 +02:00
intel_fifo_underrun.c drm/i915: make transcoder_name return a string 2016-03-16 18:09:53 +02:00
intel_frontbuffer.c
intel_guc_fwif.h drm/i915/guc: Decouple GuC engine id from ring id 2016-01-25 10:56:30 +00:00
intel_guc_loader.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
intel_guc.h drm/i915/guc: Decouple GuC engine id from ring id 2016-01-25 10:56:30 +00:00
intel_hdmi.c Merge drm-fixes into drm-next. 2016-03-14 09:46:02 +10:00
intel_hotplug.c drm/i915: intel_hpd_init(): Fix suspend/resume reprobing 2016-01-13 10:49:42 +02:00
intel_i2c.c drm/i915: Actually retry with bit-banging after GMBUS timeout 2016-03-11 10:23:28 +02:00
intel_lrc.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
intel_lrc.h drm/i915: Rename intel_engine_cs function parameters 2016-03-16 15:33:10 +00:00
intel_lvds.c drm/i915: fix deadlock on lid open 2016-03-30 12:17:13 +02:00
intel_mocs.c drm/i915: introduce for_each_engine_id() 2016-03-24 14:34:06 +00:00
intel_mocs.h
intel_modes.c
intel_opregion.c drm/i915/opregion: handle VBT sizes bigger than 6 KB 2015-12-17 11:40:57 +02:00
intel_overlay.c drm/i915: Rename dev_priv->gtt to dev_priv->ggtt 2016-03-18 15:18:15 +02:00
intel_panel.c drm/i915/panel: setup pwm backlight based on connector type 2016-03-16 18:28:50 +02:00
intel_pm.c drm/i915: replace for_each_engine() 2016-03-24 14:34:11 +00:00
intel_psr.c Revert "drm/i915: Enable PSR by default on Valleyview and Cherryview." 2016-03-10 13:49:22 +02:00
intel_renderstate_gen6.c
intel_renderstate_gen7.c
intel_renderstate_gen8.c
intel_renderstate_gen9.c
intel_renderstate.h
intel_ringbuffer.c drm/i915: introduce for_each_engine_id() 2016-03-24 14:34:06 +00:00
intel_ringbuffer.h drm/i915: Use an array of register tables in command parser 2016-03-21 10:02:01 +01:00
intel_runtime_pm.c drm/i915/bxt: add dsi transcoders 2016-03-21 12:58:58 +02:00
intel_sdvo_regs.h drm/i915/sdvo: revert bogus kernel-doc comments to normal comments 2016-01-20 10:21:34 +02:00
intel_sdvo.c drm/i915: move sdvo mappings to vbt data 2016-03-29 15:12:30 +03:00
intel_sideband.c drm/i915: Extend gpio read/write to other cores 2016-02-04 19:11:17 +02:00
intel_sprite.c drm/i915: Pass drm_frambuffer to intel_compute_page_offset() 2016-03-01 12:48:09 +02:00
intel_tv.c drm/i915: move VBT based TV presence check to intel_bios.c 2016-03-16 18:28:07 +02:00
intel_uncore.c drm/i915: Modify reset func to handle per engine resets 2016-03-17 15:01:15 +02:00
intel_vbt_defs.h drm/i915: hide away VBT private data in a separate header 2016-03-17 11:58:57 +02:00
Kconfig drm/i915: Kconfig for extra driver debugging 2016-03-03 17:26:57 +00:00
Kconfig.debug drm/i915: Kconfig for extra driver debugging 2016-03-03 17:26:57 +00:00
Makefile drm/i915: Extract out gamma table and CSC to their own file 2016-03-21 11:39:08 -07:00