msm_fb: HDMI: Fix lockdep warning
Locks must always be taken in the same order to prevent AB-BA scenarios from occuring: ====================================================== [ INFO: possible circular locking dependency detected ] 3.4.0-g55e6e49-00052-g71783d6-dirty #3258 Tainted: G W ------------------------------------------------------- kworker/0:1/15 is trying to acquire lock: (hdmi_msm_state_mutex){+.+...}, at: [<c0340e98>] hdmi_msm_hpd_state_work+0x78/0x2d8 but task is already holding lock: (external_common_state_hpd_mutex){+.+...}, at: [<c0340e8c>] hdmi_msm_hpd_state_work+0x6c/0x2d8 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (external_common_state_hpd_mutex){+.+...}: [<c00cd744>] __lock_acquire+0x950/0xa10 [<c00cd990>] lock_acquire+0x18c/0x1e8 [<c080c248>] mutex_lock_nested+0x68/0x3c4 [<c0341510>] hdmi_msm_hpd_on.clone.0+0x230/0x2c4 [<c07e5dfc>] hdmi_msm_probe+0x378/0x588 [<c03dcc00>] platform_drv_probe+0x18/0x1c [<c03db920>] driver_probe_device+0x148/0x334 [<c03d9f5c>] bus_for_each_drv+0x48/0x84 [<c03db7ac>] device_attach+0x78/0xa4 [<c03daa4c>] bus_probe_device+0x28/0x9c [<c03d97e4>] device_add+0x438/0x5e0 [<c03dd13c>] platform_device_add+0x13c/0x1a0 [<c0d255d8>] hdmi_msm_init+0x218/0x2d0 [<c0008708>] do_one_initcall+0x94/0x168 [<c0d002fc>] kernel_init+0xe4/0x1b8 [<c000f4f8>] kernel_thread_exit+0x0/0x8 -> #0 (hdmi_msm_state_mutex){+.+...}: [<c00cc6b8>] validate_chain+0x944/0x1080 [<c00cd744>] __lock_acquire+0x950/0xa10 [<c00cd990>] lock_acquire+0x18c/0x1e8 [<c080c248>] mutex_lock_nested+0x68/0x3c4 [<c0340e98>] hdmi_msm_hpd_state_work+0x78/0x2d8 [<c0097420>] process_one_work+0x37c/0x694 [<c0099978>] worker_thread+0x22c/0x3bc [<c009ecdc>] kthread+0x8c/0x9c [<c000f4f8>] kernel_thread_exit+0x0/0x8 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(external_common_state_hpd_mutex); lock(hdmi_msm_state_mutex); lock(external_common_state_hpd_mutex); lock(hdmi_msm_state_mutex); *** DEADLOCK *** 3 locks held by kworker/0:1/15: #0: (hdmi_hdcp){.+.+..}, at: [<c00972b8>] process_one_work+0x214/0x694 #1: ((&hdmi_msm_state->hpd_state_work)){+.+...}, at: [<c00972b8>] process_one_work+0x214/0x694 #2: (external_common_state_hpd_mutex){+.+...}, at: [<c0340e8c>] hdmi_msm_hpd_state_work+0x6c/0x2d8 stack backtrace: [<c001521c>] (unwind_backtrace+0x0/0x12c) from [<c00cbb14>] (print_circular_bug+0x288/0x2d4) [<c00cbb14>] (print_circular_bug+0x288/0x2d4) from [<c00cc6b8>] (validate_chain+0x944/0x1080) [<c00cc6b8>] (validate_chain+0x944/0x1080) from [<c00cd744>] (__lock_acquire+0x950/0xa10) [<c00cd744>] (__lock_acquire+0x950/0xa10) from [<c00cd990>] (lock_acquire+0x18c/0x1e8) [<c00cd990>] (lock_acquire+0x18c/0x1e8) from [<c080c248>] (mutex_lock_nested+0x68/0x3c4) [<c080c248>] (mutex_lock_nested+0x68/0x3c4) from [<c0340e98>] (hdmi_msm_hpd_state_work+0x78/0x2d8) [<c0340e98>] (hdmi_msm_hpd_state_work+0x78/0x2d8) from [<c0097420>] (process_one_work+0x37c/0x694) [<c0097420>] (process_one_work+0x37c/0x694) from [<c0099978>] (worker_thread+0x22c/0x3bc) [<c0099978>] (worker_thread+0x22c/0x3bc) from [<c009ecdc>] (kthread+0x8c/0x9c) [<c009ecdc>] (kthread+0x8c/0x9c) from [<c000f4f8>] (kernel_thread_exit+0x0/0x8) Change-Id: I251049edbc97a5fe0e6c67801cf472fdc48722a7 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
@@ -4274,14 +4274,14 @@ static int hdmi_msm_hpd_on(bool trigger_handler)
|
||||
|
||||
if (trigger_handler) {
|
||||
/* Set HPD state machine: ensure at least 2 readouts */
|
||||
mutex_lock(&external_common_state_hpd_mutex);
|
||||
mutex_lock(&hdmi_msm_state_mutex);
|
||||
hdmi_msm_state->hpd_stable = 0;
|
||||
hdmi_msm_state->hpd_prev_state = TRUE;
|
||||
mutex_lock(&external_common_state_hpd_mutex);
|
||||
external_common_state->hpd_state = FALSE;
|
||||
mutex_unlock(&external_common_state_hpd_mutex);
|
||||
hdmi_msm_state->hpd_cable_chg_detected = TRUE;
|
||||
mutex_unlock(&hdmi_msm_state_mutex);
|
||||
mutex_unlock(&external_common_state_hpd_mutex);
|
||||
mod_timer(&hdmi_msm_state->hpd_state_timer,
|
||||
jiffies + HZ/2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user