From patchwork Mon Jul 16 05:57:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lauri Hintsala X-Patchwork-Id: 1199971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1265FDF24C for ; Mon, 16 Jul 2012 06:05:39 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SqeL7-0007Lu-LO; Mon, 16 Jul 2012 05:59:25 +0000 Received: from [194.100.31.45] (helo=darkblue.bluegiga.com) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SqeKU-0007Le-W6 for linux-arm-kernel@lists.infradead.org; Mon, 16 Jul 2012 05:58:53 +0000 Received: from [10.1.1.28] ([10.1.1.28]) by darkblue.bluegiga.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 16 Jul 2012 08:57:38 +0300 Message-ID: <5003AD52.7070304@bluegiga.com> Date: Mon, 16 Jul 2012 08:57:38 +0300 From: Lauri Hintsala User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Attila Kinali Subject: Re: mmc: mxs: DEADLOCK References: <4FFC367A.8020100@bluegiga.com> <20120711060607.GE14060@S2101-09.ap.freescale.net> <20120712160008.03731746cdc5cf4bb0548256@kinali.ch> In-Reply-To: <20120712160008.03731746cdc5cf4bb0548256@kinali.ch> X-OriginalArrivalTime: 16 Jul 2012 05:57:38.0505 (UTC) FILETIME=[E7A04390:01CD6317] X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.1 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS Cc: Marek Vasut , Koen Beel , linux-mmc@vger.kernel.org, Wolfram Sang , Veli-Pekka Peltola , Shawn Guo , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi Attila, On 07/12/2012 05:00 PM, Attila Kinali wrote: > I ran into the same problem today, but the proposed fix doesn't seem > to work for me: > > ---schnipp--- > # modprobe libertas_sdio > [ 59.200000] lib80211: common routines for IEEE802.11 drivers > [ 59.240000] cfg80211: Calling CRDA to update world regulatory domain > [ 59.320000] libertas_sdio: Libertas SDIO driver > [ 59.330000] libertas_sdio: Copyright Pierre Ossman > # modprobe mxs-mmc > [ 64.210000] mxs-mmc 80010000.ssp: initialized > [ 64.260000] mxs-mmc 80034000.ssp: initialized > [ 64.270000] mmc0: new SDIO card at address 0001 > # [ 65.440000] libertas_sdio mmc0:0001:1: (unregistered net_device): 00:13:04:80:00:3f, fw 9.70.3p24, cap 0x00000303 > [ 65.470000] > [ 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: [] 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: [] 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: [] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc] > [ 65.470000] > [ 65.470000] stack backtrace: > [ 65.470000] [] (unwind_backtrace+0x0/0xf4) from [] (__lock_acquire+0x14f8/0x1b98) > [ 65.470000] [] (__lock_acquire+0x14f8/0x1b98) from [] (lock_acquire+0xa0/0x108) > [ 65.470000] [] (lock_acquire+0xa0/0x108) from [] (_raw_spin_lock_irqsave+0x48/0x5c) > [ 65.470000] [] (_raw_spin_lock_irqsave+0x48/0x5c) from [] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) > [ 65.470000] [] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) > [ 65.470000] [] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [] (sdio_irq_thread+0x1bc/0x274) > [ 65.470000] [] (sdio_irq_thread+0x1bc/0x274) from [] (kthread+0x8c/0x98) > [ 65.470000] [] (kthread+0x8c/0x98) from [] (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] [] (unwind_backtrace+0x0/0xf4) from [] (do_raw_spin_lock+0x100/0x144) > [ 65.470000] [] (do_raw_spin_lock+0x100/0x144) from [] (_raw_spin_lock_irqsave+0x50/0x5c) > [ 65.470000] [] (_raw_spin_lock_irqsave+0x50/0x5c) from [] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) > [ 65.470000] [] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) > [ 65.470000] [] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [] (sdio_irq_thread+0x1bc/0x274) > [ 65.470000] [] (sdio_irq_thread+0x1bc/0x274) from [] (kthread+0x8c/0x98) > [ 65.470000] [] (kthread+0x8c/0x98) from [] (kernel_thread_exit+0x0/0x8) > ---schnapp--- > > Any hints how to work around or fix this, would be appreciated Does this patch fix your issue? >>>>>>> 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 = { <<<<<<< mxs_mmc_enable_sdio_irq was called by mmc_signal_sdio_irq. mmc_signal_sdio_irq was called inside spin lock. So the lock was tried to acquire before it was released. Best regards, Lauri Hintsala Acked-by: Shawn Guo --- 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,