From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Dong Aisheng <dongas86@gmail.com>
Cc: Shawn Guo <shawn.guo@linaro.org>,
Dong Aisheng <b29396@freescale.com>, Chris Ball <cjb@laptop.org>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: UHS-1 cards with iMX6Q
Date: Mon, 10 Feb 2014 10:33:36 +0000 [thread overview]
Message-ID: <20140210103335.GQ26684@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAA+hA=TVA-4uSB+RSaCjG52N4CSD+gdw_u4iqfrLr7jYyGkf9w@mail.gmail.com>
On Mon, Feb 10, 2014 at 11:31:40AM +0800, Dong Aisheng wrote:
> On Sun, Feb 9, 2014 at 11:14 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > Okay, I have this working now - there was a hardware problem. However,
> > it's obvious that this has never been tested with lockdep enabled beacuse
> > of the following:
> >
> > disable_irq(host->irq);
> > spin_lock(&host->lock);
> > host->mrq = &mrq;
> >
> > sdhci_send_command(host, mrq.cmd);
> >
> > spin_unlock(&host->lock);
> > enable_irq(host->irq);
> >
> > You can't "work around" stuff like this. Use spin_lock_irq()..
> > spin_unlock_irq(). You can't just disable the interrupt line and
> > expect lockdep to know that it's safe.
> >
>
> Yes, i missed this.
> Such kind of code was originally referenced from sdhci_execute_tuning.
> It was formerly fixed in commit 2b35bd83.
> But i did miss sdhci-esdhci-imx also has such issue.
> Thanks for the reminder.
>
> You can try the following fix and I will send out a patch for it later.
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c
> b/drivers/mmc/host/sdhci-esdhc-imx.c
> index b841bb7..0372baf 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -720,6 +720,7 @@ static int esdhc_send_tuning_cmd(struct sdhci_host
> *host, u32 opcode)
> struct mmc_data data = {0};
> struct scatterlist sg;
> char tuning_pattern[ESDHC_TUNING_BLOCK_PATTERN_LEN];
> + unsigned long flags;
>
> cmd.opcode = opcode;
> cmd.arg = 0;
> @@ -742,14 +743,12 @@ static int esdhc_send_tuning_cmd(struct
> sdhci_host *host, u32 opcode)
> mrq.done = esdhc_request_done;
> init_completion(&(mrq.completion));
>
> - disable_irq(host->irq);
> - spin_lock(&host->lock);
> + spin_lock_irqsave(&host->lock, flags);
> host->mrq = &mrq;
>
> sdhci_send_command(host, mrq.cmd);
>
> - spin_unlock(&host->lock);
> - enable_irq(host->irq);
> + spin_unlock_irqrestore(&host->lock, flags);
>
> wait_for_completion(&mrq.completion);
You don't need to use irqsave/irqrestore here - IRQs must be enabled here
otherwise wait_for_completion() will scream - scheduling with interrupts
disabled is not allowed.
--
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
next prev parent reply other threads:[~2014-02-10 10:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 15:29 UHS-1 cards with iMX6Q Russell King - ARM Linux
2014-02-07 15:59 ` Shawn Guo
2014-02-07 16:16 ` Russell King - ARM Linux
2014-02-08 13:55 ` Dong Aisheng
2014-02-09 15:14 ` Russell King - ARM Linux
2014-02-10 3:31 ` Dong Aisheng
2014-02-10 10:33 ` Russell King - ARM Linux [this message]
2014-02-10 12:11 ` Dong Aisheng
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=20140210103335.GQ26684@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=b29396@freescale.com \
--cc=cjb@laptop.org \
--cc=dongas86@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=shawn.guo@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox