* [PATCH 0/2] mmc: mxs-mmc: fix deadlocks @ 2012-07-17 14:16 Lauri Hintsala 2012-07-17 14:16 ` [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Lauri Hintsala ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Lauri Hintsala @ 2012-07-17 14:16 UTC (permalink / raw) To: linux-arm-kernel Two different deadlock fixes in cases with SDIO IRQs generated by SDIO device. Lauri Hintsala (2): mmc: mxs-mmc: fix deadlock in SDIO IRQ case mmc: mxs-mmc: fix deadlock caused by recursion loop drivers/mmc/host/mxs-mmc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case 2012-07-17 14:16 [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala @ 2012-07-17 14:16 ` Lauri Hintsala 2012-08-31 10:11 ` Chris Ball 2012-07-17 14:16 ` [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop Lauri Hintsala 2012-08-28 8:08 ` [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2 siblings, 1 reply; 7+ messages in thread From: Lauri Hintsala @ 2012-07-17 14:16 UTC (permalink / raw) To: linux-arm-kernel Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler. Backtrace: [ 79.660000] ============================================= [ 79.660000] [ INFO: possible recursive locking detected ] [ 79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted [ 79.660000] --------------------------------------------- [ 79.660000] swapper/0 is trying to acquire lock: [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4 [ 79.660000] [ 79.660000] but task is already holding lock: [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 [ 79.660000] [ 79.660000] other info that might help us debug this: [ 79.660000] Possible unsafe locking scenario: [ 79.660000] [ 79.660000] CPU0 [ 79.660000] ---- [ 79.660000] lock(&(&host->lock)->rlock#2); [ 79.660000] lock(&(&host->lock)->rlock#2); [ 79.660000] [ 79.660000] *** DEADLOCK *** [ 79.660000] [ 79.660000] May be due to missing lock nesting notation [ 79.660000] [ 79.660000] 1 lock held by swapper/0: [ 79.660000] #0: (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 [ 79.660000] [ 79.660000] stack backtrace: [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) [ 79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8) [ 79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) [ 79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) [ 79.660000] BUG: spinlock lockup on CPU#0, swapper/0 [ 79.660000] lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) [ 79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) [ 79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> --- drivers/mmc/host/mxs-mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 277161d..20a0550 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -278,11 +278,11 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void *dev_id) writel(stat & MXS_MMC_IRQ_BITS, host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR); + spin_unlock(&host->lock); + if ((stat & BM_SSP_CTRL1_SDIO_IRQ) && (stat & BM_SSP_CTRL1_SDIO_IRQ_EN)) mmc_signal_sdio_irq(host->mmc); - spin_unlock(&host->lock); - if (stat & BM_SSP_CTRL1_RESP_TIMEOUT_IRQ) cmd->error = -ETIMEDOUT; else if (stat & BM_SSP_CTRL1_RESP_ERR_IRQ) -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case 2012-07-17 14:16 ` [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Lauri Hintsala @ 2012-08-31 10:11 ` Chris Ball 0 siblings, 0 replies; 7+ messages in thread From: Chris Ball @ 2012-08-31 10:11 UTC (permalink / raw) To: linux-arm-kernel Hi, On Tue, Jul 17 2012, Lauri Hintsala wrote: > Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler. > > Backtrace: > [ 79.660000] ============================================= > [ 79.660000] [ INFO: possible recursive locking detected ] > [ 79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted > [ 79.660000] --------------------------------------------- > [ 79.660000] swapper/0 is trying to acquire lock: > [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4 > [ 79.660000] > [ 79.660000] but task is already holding lock: > [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 > [ 79.660000] > [ 79.660000] other info that might help us debug this: > [ 79.660000] Possible unsafe locking scenario: > [ 79.660000] > [ 79.660000] CPU0 > [ 79.660000] ---- > [ 79.660000] lock(&(&host->lock)->rlock#2); > [ 79.660000] lock(&(&host->lock)->rlock#2); > [ 79.660000] > [ 79.660000] *** DEADLOCK *** > [ 79.660000] > [ 79.660000] May be due to missing lock nesting notation > [ 79.660000] > [ 79.660000] 1 lock held by swapper/0: > [ 79.660000] #0: (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 > [ 79.660000] > [ 79.660000] stack backtrace: > [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) > [ 79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8) > [ 79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) > [ 79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) > [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) > [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) > [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) > [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) > [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) > [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) > [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) > [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) > [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) > [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) > [ 79.660000] BUG: spinlock lockup on CPU#0, swapper/0 > [ 79.660000] lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 > [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) > [ 79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) > [ 79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) > [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) > [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) > [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) > [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) > [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) > [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) > [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) > [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) > [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) > [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) > > Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> > Acked-by: Shawn Guo <shawn.guo@linaro.org> > --- > drivers/mmc/host/mxs-mmc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c > index 277161d..20a0550 100644 > --- a/drivers/mmc/host/mxs-mmc.c > +++ b/drivers/mmc/host/mxs-mmc.c > @@ -278,11 +278,11 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void *dev_id) > writel(stat & MXS_MMC_IRQ_BITS, > host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_CLR); > > + spin_unlock(&host->lock); > + > if ((stat & BM_SSP_CTRL1_SDIO_IRQ) && (stat & BM_SSP_CTRL1_SDIO_IRQ_EN)) > mmc_signal_sdio_irq(host->mmc); > > - spin_unlock(&host->lock); > - > if (stat & BM_SSP_CTRL1_RESP_TIMEOUT_IRQ) > cmd->error = -ETIMEDOUT; > else if (stat & BM_SSP_CTRL1_RESP_ERR_IRQ) Thanks, pushed to mmc-next for 3.6 with a stable@ tag. - Chris. -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop 2012-07-17 14:16 [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2012-07-17 14:16 ` [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Lauri Hintsala @ 2012-07-17 14:16 ` Lauri Hintsala 2012-08-31 10:12 ` Chris Ball 2012-08-28 8:08 ` [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2 siblings, 1 reply; 7+ messages in thread From: Lauri Hintsala @ 2012-07-17 14:16 UTC (permalink / raw) To: linux-arm-kernel 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: Attila Kinali <attila@kinali.ch> Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> --- drivers/mmc/host/mxs-mmc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 20a0550..e1fd2c8 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -637,11 +637,6 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); writel(BM_SSP_CTRL1_SDIO_IRQ_EN, host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET); - - if (readl(host->base + HW_SSP_STATUS(host)) & - BM_SSP_STATUS_SDIO_IRQ) - mmc_signal_sdio_irq(host->mmc); - } else { writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); @@ -650,6 +645,11 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) } spin_unlock_irqrestore(&host->lock, flags); + + if (enable && readl(host->base + HW_SSP_STATUS(host)) & + BM_SSP_STATUS_SDIO_IRQ) + mmc_signal_sdio_irq(host->mmc); + } static const struct mmc_host_ops mxs_mmc_ops = { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop 2012-07-17 14:16 ` [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop Lauri Hintsala @ 2012-08-31 10:12 ` Chris Ball 0 siblings, 0 replies; 7+ messages in thread From: Chris Ball @ 2012-08-31 10:12 UTC (permalink / raw) To: linux-arm-kernel Hi, On Tue, Jul 17 2012, Lauri Hintsala wrote: > 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: Attila Kinali <attila@kinali.ch> > Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> > Acked-by: Shawn Guo <shawn.guo@linaro.org> > --- > drivers/mmc/host/mxs-mmc.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c > index 20a0550..e1fd2c8 100644 > --- a/drivers/mmc/host/mxs-mmc.c > +++ b/drivers/mmc/host/mxs-mmc.c > @@ -637,11 +637,6 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) > host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_SET); > writel(BM_SSP_CTRL1_SDIO_IRQ_EN, > host->base + HW_SSP_CTRL1(host) + STMP_OFFSET_REG_SET); > - > - if (readl(host->base + HW_SSP_STATUS(host)) & > - BM_SSP_STATUS_SDIO_IRQ) > - mmc_signal_sdio_irq(host->mmc); > - > } else { > writel(BM_SSP_CTRL0_SDIO_IRQ_CHECK, > host->base + HW_SSP_CTRL0 + STMP_OFFSET_REG_CLR); > @@ -650,6 +645,11 @@ static void mxs_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) > } > > spin_unlock_irqrestore(&host->lock, flags); > + > + if (enable && readl(host->base + HW_SSP_STATUS(host)) & > + BM_SSP_STATUS_SDIO_IRQ) > + mmc_signal_sdio_irq(host->mmc); > + > } > > static const struct mmc_host_ops mxs_mmc_ops = { Thanks, pushed to mmc-next for 3.6 with a stable@ tag. - Chris. -- Chris Ball <cjb@laptop.org> <http://printf.net/> One Laptop Per Child ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] mmc: mxs-mmc: fix deadlocks 2012-07-17 14:16 [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2012-07-17 14:16 ` [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Lauri Hintsala 2012-07-17 14:16 ` [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop Lauri Hintsala @ 2012-08-28 8:08 ` Lauri Hintsala 2012-08-30 21:05 ` Shawn Guo 2 siblings, 1 reply; 7+ messages in thread From: Lauri Hintsala @ 2012-08-28 8:08 UTC (permalink / raw) To: linux-arm-kernel On 07/17/2012 05:16 PM, Lauri Hintsala wrote: > Two different deadlock fixes in cases with SDIO IRQs > generated by SDIO device. Any comments? Could they be applied? BR, Lauri > Lauri Hintsala (2): > mmc: mxs-mmc: fix deadlock in SDIO IRQ case > mmc: mxs-mmc: fix deadlock caused by recursion loop > > drivers/mmc/host/mxs-mmc.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 0/2] mmc: mxs-mmc: fix deadlocks 2012-08-28 8:08 ` [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala @ 2012-08-30 21:05 ` Shawn Guo 0 siblings, 0 replies; 7+ messages in thread From: Shawn Guo @ 2012-08-30 21:05 UTC (permalink / raw) To: linux-arm-kernel On Tue, Aug 28, 2012 at 11:08:24AM +0300, Lauri Hintsala wrote: > On 07/17/2012 05:16 PM, Lauri Hintsala wrote: > >Two different deadlock fixes in cases with SDIO IRQs > >generated by SDIO device. > > Any comments? Could they be applied? > Chris, can you please send these two fixes for 3.6? Also, stable should be Cc-ed. -- Regards, Shawn ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-08-31 10:12 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-07-17 14:16 [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2012-07-17 14:16 ` [PATCH 1/2] mmc: mxs-mmc: fix deadlock in SDIO IRQ case Lauri Hintsala 2012-08-31 10:11 ` Chris Ball 2012-07-17 14:16 ` [PATCH 2/2] mmc: mxs-mmc: fix deadlock caused by recursion loop Lauri Hintsala 2012-08-31 10:12 ` Chris Ball 2012-08-28 8:08 ` [PATCH 0/2] mmc: mxs-mmc: fix deadlocks Lauri Hintsala 2012-08-30 21:05 ` Shawn Guo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).