All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	phone-devel@vger.kernel.org,
	Stephan Gerhold <stephan@gerhold.net>,
	newbyte@disroot.org
Subject: Re: [PATCH] mmc: core: Add a card quirk for broken boot partitions
Date: Wed, 30 Jun 2021 17:27:35 +0200	[thread overview]
Message-ID: <CAPDyKForEi09uyXL4nDn27bth+btEYAhzd6+YusMrRBygCdtEA@mail.gmail.com> (raw)
In-Reply-To: <CACRpkdYX5RiUy7u_SeCqhytbyL1Ta9iVmx500uwAq8sNmW+3Ug@mail.gmail.com>

On Wed, 30 Jun 2021 at 16:26, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Wed, Jun 30, 2021 at 1:50 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> > > We wait forever in mmc_wait_for_req_done() since the completion
> > > never arrives.
> >
> > Thanks for sharing these details. It looks like the mmci driver is
> > waiting for the busy completion IRQ, forever.
>
> Yep
>
> > Either the HW busy detection isn't working properly in mmci or the
> > eMMC card is behaving a bit odd (continues to deassert the DAT0 line
> > forever).
>
> Yep. I think the card is odd because I have this working fine on
> 3 other ux500 phones, this is the odd one out. I will try to check
> what eMMC is in the others as well.
>
> > What certainly is missing in the mmci driver, is a software based
> > timeout for cases like these. The mmci driver should better complete
> > the request with -ETIMEDOUT error for the cmd, rather than hanging
> > forever and waiting for the busy completion IRQ.
>
> That is true, it would make the driver more robust.
>
> > > I think you also mentioned the timeout in EXT_CSD maybe not being
> > > long enough? How do I play around with this?
> > > MMC_QUIRK_LONG_READ_TIME?
> >
> > As mmci doesn't care about busy timeouts, but waits forever, this is
> > likely not the problem.
> >
> > However, I would like to try to narrow down the problem even further.
> > Would you mind try the below debug patch?
>
> With this patch mmc2 comes up and I can mount and browse
> the eMMC.
>
> I think it is because these lines in mmci_cmd_irq() will not
> be executed:
>
>         /* Handle busy detection on DAT0 if the variant supports it. */
>         if (busy_resp && host->variant->busy_detect)
>                 if (!host->ops->busy_complete(host, status, err_msk))
>                         return;
>
> These seemed to be especially problematic to me.

Yes, exactly. The IRQ based busy detection code gets disabled with my
debug patch.

It looks like there are some race conditions in the HW busy detection
path for mmci, which gets triggered by this eMMC card.

>
> However the core can still use ->card_busy() at times?

It can and will.

Although, it's more optimal to receive an IRQ when busy on DAT0 is
de-asserted, rather than polling with ->card_busy(). Hence we also
have MMC_CAP_WAIT_WHILE_BUSY.

I will have another look at the code in mmci, to see if there is
something we can try to improve.

Kind regards
Uffe

  reply	other threads:[~2021-06-30 15:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28 23:29 [PATCH] mmc: core: Add a card quirk for broken boot partitions Linus Walleij
2021-06-29 13:56 ` Ulf Hansson
2021-06-29 17:23   ` Linus Walleij
2021-06-30 11:49     ` Ulf Hansson
2021-06-30 14:25       ` Linus Walleij
2021-06-30 15:27         ` Ulf Hansson [this message]
2021-06-30 22:33           ` Linus Walleij
2021-07-01 14:26             ` Ulf Hansson
2021-07-01 15:52               ` Linus Walleij

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=CAPDyKForEi09uyXL4nDn27bth+btEYAhzd6+YusMrRBygCdtEA@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=newbyte@disroot.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=stephan@gerhold.net \
    /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.