All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ball <cjb@laptop.org>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
	Ian Molton <ian@mnementh.co.uk>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Magnus Damm <damm@opensource.se>
Subject: Re: [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled
Date: Wed, 13 Jul 2011 15:00:41 +0000	[thread overview]
Message-ID: <m2oc0y2pk6.fsf@bob.laptop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1106201803520.11365@axis700.grange> (Guennadi Liakhovetski's message of "Mon, 20 Jun 2011 18:27:50 +0200 (CEST)")

Hi Guennadi,

On Mon, Jun 20 2011, Guennadi Liakhovetski wrote:
> Calling mmc_request_done() under a spinlock with interrupts disabled
> leads to a recursive spin-lock on request retry path and to
> scheduling in atomic context. This patch fixes both these problems
> by moving mmc_request_done() to the scheduler workqueue.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> This is a bug-fix: without it the system Oopses with LOCKDEP enabled, so, 
> it should really go in 3.0. OTOH it is pretty intrusine and non-trivial, 
> so, reviews and tests are highly appreciated! Also, unfortunately, I 
> wasn't able to test it well enough with SDIO, because the driver for the 
> only SDIO card, that I have, reproducibly crashes the kernel:

Having trouble working out how to apply this -- for example, in this hunk:

> @@ -618,7 +631,8 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
>  		if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {
>  			tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |
>  				TMIO_STAT_CARD_REMOVE);
> -			mmc_detect_change(host->mmc, msecs_to_jiffies(100));
> +			if (!work_pending(&host->mmc->detect.work))
> +				mmc_detect_change(host->mmc, msecs_to_jiffies(100));
>  		}
>  
>  		/* CRC and other errors */

In mmc-next there's a "goto out;" after the mmc_detect_change call, which
looks like it's always been there.  Am I missing a patch this depends on?

(It'd be a good time to get a full set of tmio patches for 3.1 pulled
together, if you can do that.)

Thanks!

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

WARNING: multiple messages have this Message-ID (diff)
From: Chris Ball <cjb@laptop.org>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
	Ian Molton <ian@mnementh.co.uk>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Magnus Damm <damm@opensource.se>
Subject: Re: [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled
Date: Wed, 13 Jul 2011 11:00:41 -0400	[thread overview]
Message-ID: <m2oc0y2pk6.fsf@bob.laptop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1106201803520.11365@axis700.grange> (Guennadi Liakhovetski's message of "Mon, 20 Jun 2011 18:27:50 +0200 (CEST)")

Hi Guennadi,

On Mon, Jun 20 2011, Guennadi Liakhovetski wrote:
> Calling mmc_request_done() under a spinlock with interrupts disabled
> leads to a recursive spin-lock on request retry path and to
> scheduling in atomic context. This patch fixes both these problems
> by moving mmc_request_done() to the scheduler workqueue.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> This is a bug-fix: without it the system Oopses with LOCKDEP enabled, so, 
> it should really go in 3.0. OTOH it is pretty intrusine and non-trivial, 
> so, reviews and tests are highly appreciated! Also, unfortunately, I 
> wasn't able to test it well enough with SDIO, because the driver for the 
> only SDIO card, that I have, reproducibly crashes the kernel:

Having trouble working out how to apply this -- for example, in this hunk:

> @@ -618,7 +631,8 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
>  		if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {
>  			tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |
>  				TMIO_STAT_CARD_REMOVE);
> -			mmc_detect_change(host->mmc, msecs_to_jiffies(100));
> +			if (!work_pending(&host->mmc->detect.work))
> +				mmc_detect_change(host->mmc, msecs_to_jiffies(100));
>  		}
>  
>  		/* CRC and other errors */

In mmc-next there's a "goto out;" after the mmc_detect_change call, which
looks like it's always been there.  Am I missing a patch this depends on?

(It'd be a good time to get a full set of tmio patches for 3.1 pulled
together, if you can do that.)

Thanks!

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

  parent reply	other threads:[~2011-07-13 15:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-15 14:06 [PATCH] mmc: tmio: fix recursive spinlock, don't schedule with Guennadi Liakhovetski
2011-06-15 14:06 ` [PATCH] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski
2011-06-15 16:50 ` [PATCH] mmc: tmio: fix recursive spinlock, don't schedule with Guennadi Liakhovetski
2011-06-15 16:50   ` [PATCH] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski
2011-06-20 16:27 ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with Guennadi Liakhovetski
2011-06-20 16:27   ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski
2011-07-12 10:51   ` kuninori.morimoto.gx
2011-07-12 10:51     ` kuninori.morimoto.gx
2011-07-13 15:00   ` Chris Ball [this message]
2011-07-13 15:00     ` Chris Ball
2011-07-13 23:33     ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule Guennadi Liakhovetski
2011-07-13 23:33       ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski
2011-07-14  0:39       ` Chris Ball
2011-07-14  0:39         ` Chris Ball
2011-07-14 10:26     ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule Guennadi Liakhovetski
2011-07-14 10:26       ` [PATCH v2] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski
2011-07-14 10:12   ` [PATCH v3] mmc: tmio: fix recursive spinlock, don't schedule with Guennadi Liakhovetski
2011-07-14 10:12     ` [PATCH v3] mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabled Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2oc0y2pk6.fsf@bob.laptop.org \
    --to=cjb@laptop.org \
    --cc=damm@opensource.se \
    --cc=g.liakhovetski@gmx.de \
    --cc=ian@mnementh.co.uk \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.