• Lauri Hintsala's avatar
    mmc: mxs-mmc: fix deadlock caused by recursion loop · fc108d24
    Lauri Hintsala authored
    Release the lock before mmc_signal_sdio_irq is called by
    mxs_mmc_enable_sdio_irq.
    
    Backtrace:
    [   65.470000] =============================================
    [   65.470000] [ INFO: possible recursive locking detected ]
    [   65.470000] 3.5.0-rc5 #2 Not tainted
    [   65.470000] ---------------------------------------------
    [   65.470000] ksdioirqd/mmc0/73 is trying to acquire lock:
    [   65.470000]  (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]
    [   65.470000]
    [   65.470000] but task is already holding lock:
    [   65.470000]  (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]
    [   65.470000]
    [   65.470000] other info that might help us debug this:
    [   65.470000]  Possible unsafe locking scenario:
    [   65.470000]
    [   65.470000]        CPU0
    [   65.470000]        ----
    [   65.470000]   lock(&(&host->lock)->rlock#2);
    [   65.470000]   lock(&(&host->lock)->rlock#2);
    [   65.470000]
    [   65.470000]  *** DEADLOCK ***
    [   65.470000]
    [   65.470000]  May be due to missing lock nesting notation
    [   65.470000]
    [   65.470000] 1 lock held by ksdioirqd/mmc0/73:
    [   65.470000]  #0:  (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]
    [   65.470000]
    [   65.470000] stack backtrace:
    [   65.470000] [<c0014990>] (unwind_backtrace+0x0/0xf4) from [<c005ccb8>] (__lock_acquire+0x14f8/0x1b98)
    [   65.470000] [<c005ccb8>] (__lock_acquire+0x14f8/0x1b98) from [<c005d3f8>] (lock_acquire+0xa0/0x108)
    [   65.470000] [<c005d3f8>] (lock_acquire+0xa0/0x108) from [<c02f671c>] (_raw_spin_lock_irqsave+0x48/0x5c)
    [   65.470000] [<c02f671c>] (_raw_spin_lock_irqsave+0x48/0x5c) from [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc])
    [   65.470000] [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc])
    [   65.470000] [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [<c0219b38>] (sdio_irq_thread+0x1bc/0x274)
    [   65.470000] [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) from [<c003c324>] (kthread+0x8c/0x98)
    [   65.470000] [<c003c324>] (kthread+0x8c/0x98) from [<c00101ac>] (kernel_thread_exit+0x0/0x8)
    [   65.470000] BUG: spinlock lockup suspected on CPU#0, ksdioirqd/mmc0/73
    [   65.470000]  lock: 0xc3358724, .magic: dead4ead, .owner: ksdioirqd/mmc0/73, .owner_cpu: 0
    [   65.470000] [<c0014990>] (unwind_backtrace+0x0/0xf4) from [<c01b46b0>] (do_raw_spin_lock+0x100/0x144)
    [   65.470000] [<c01b46b0>] (do_raw_spin_lock+0x100/0x144) from [<c02f6724>] (_raw_spin_lock_irqsave+0x50/0x5c)
    [   65.470000] [<c02f6724>] (_raw_spin_lock_irqsave+0x50/0x5c) from [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc])
    [   65.470000] [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc])
    [   65.470000] [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [<c0219b38>] (sdio_irq_thread+0x1bc/0x274)
    [   65.470000] [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) from [<c003c324>] (kthread+0x8c/0x98)
    [   65.470000] [<c003c324>] (kthread+0x8c/0x98) from [<c00101ac>] (kernel_thread_exit+0x0/0x8)
    Reported-by: default avatarAttila Kinali <attila@kinali.ch>
    Signed-off-by: default avatarLauri Hintsala <lauri.hintsala@bluegiga.com>
    Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarChris Ball <cjb@laptop.org>
    fc108d24
mxs-mmc.c 24.2 KB