Bug 87099

Summary: [HSW MST] Warning...drm_dp_mst_get_validated_mstb_ref_locked, possible circular locking dependency detected
Product: DRI Reporter: Daniel Martin <consume.noise>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium CC: intel-gfx-bugs
Version: DRI git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg drm-intel-nightly 3.18.0-00343-gfc7bddc
none
dmesg drm-intel-nightly 3.18.0-00343-gfc7bddc + drm/dp-mst: Remove branches before dropping the reference none

Description Daniel Martin 2014-12-08 14:05:23 UTC
Created attachment 110564 [details]
dmesg drm-intel-nightly 3.18.0-00343-gfc7bddc

Hardware:
- Lenovo ThinkPad T440s + ThinkPad Pro Dock 40A1
- 1. monitor (Dell U2410 1920x1200) at DP of docking station
- 2. monitor (Dell U2413 1920x1200) at VGA of docking station

If I boot this setup with both monitor attached to the console and remove the monitor (unplug the connector) at the DP, then I can reproduce the attached backtrace (not?) always.

This happens with v3.17.6, v3.18 and current drm-intel-nightly (fc7bddc drm-intel-nightly: 2014y-12m-08d-12h-45m-52s UTC integration manifest). The dmesg log has been captured with drm-intel-nightly.

[   18.947852] WARNING: CPU: 1 PID: 128 at include/linux/kref.h:47 drm_dp_mst_get_validated_mstb_ref_locked+0x92/0xa0 [drm_kms_helper]()                          
...
[   22.999859] [drm:drm_dp_mst_wait_tx_reply] timedout msg send ffff88030cd51800 2 1
[   23.002183] ======================================================
[   23.003160] [ INFO: possible circular locking dependency detected ]
[   23.004108] 3.18.0-00343-gfc7bddc #11 Tainted: G        W     
[   23.005041] -------------------------------------------------------
[   23.005941] kworker/u16:2/128 is trying to acquire lock:
[   23.006826]  ((&mgr->work)){+.+.+.}, at: [<ffffffff81065585>] flush_work+0x5/0x260
[   23.007667] 
but task is already holding lock:
[   23.009294]  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffffa03db365>] drm_fb_helper_hotplug_event+0x25/0xe0 [drm_kms_helper]
[   23.010166] 
which lock already depends on the new lock.

[   23.012646] 
the existing dependency chain (in reverse order) is:
[   23.014307] 
-> #1 (&dev->mode_config.mutex){+.+.+.}:
[   23.015951]        [<ffffffff8109b58c>] lock_acquire+0xac/0x140
...
other info that might help us debug this:

[   23.060273]  Possible unsafe locking scenario:

[   23.061790]        CPU0                    CPU1
[   23.062536]        ----                    ----
[   23.063323]   lock(&dev->mode_config.mutex);
[   23.064096]                                lock((&mgr->work));
[   23.064814]                                lock(&dev->mode_config.mutex);
[   23.065531]   lock((&mgr->work));
[   23.066242] 
 *** DEADLOCK ***

[   23.068373] 3 locks held by kworker/u16:2/128:
[   23.069075]  #0:  ("i915-dp"){.+.+.+}, at: [<ffffffff81065f51>] process_one_work+0x141/0x490
[   23.069823]  #1:  ((&dev_priv->dig_port_work)){+.+.+.}, at: [<ffffffff81065f51>] process_one_work+0x141/0x490
[   23.070561]  #2:  (&dev->mode_config.mutex){+.+.+.}, at: [<ffffffffa03db365>] drm_fb_helper_hotplug_event+0x25/0xe0 [drm_kms_helper]
Comment 1 Daniel Vetter 2014-12-08 22:17:53 UTC
Not at perfect match but worth a shot: Can you please test this patch?

http://patchwork.freedesktop.org/patch/38434/
Comment 2 Daniel Martin 2014-12-09 08:25:29 UTC
Created attachment 110607 [details]
dmesg drm-intel-nightly 3.18.0-00343-gfc7bddc + drm/dp-mst: Remove branches before dropping the reference

With the patch from http://patchwork.freedesktop.org/patch/38434/ I can't see the "INFO: possible circular locking dependency detected" anymore.
Though, backtraces as in bug #87100 show up multiple times and it kills the VGA output too.
Comment 3 Daniel Vetter 2014-12-09 09:28:01 UTC
Ok, sounds like that patch indeed addresses the lock inversion. And for the remaining things we have reports already, so closing this one. Thanks for the report.

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.