linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: fengnan chang <fengnanchang@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH v2] mmc: limit the time of retries when analyse tuples failed
Date: Sat, 23 Jan 2021 11:08:01 +0800	[thread overview]
Message-ID: <CALWNXx_x84iPkBzA=6kKziRA030ok5anW9oMsmUUjZFfhd7_Wg@mail.gmail.com> (raw)
In-Reply-To: <CAPDyKFqQ1C4vuyzwTV82q7ty=s5w6-4HX06gFqhhfjtzDbFA-A@mail.gmail.com>

yeah, I think it should tag this for stable kernels as well.
I will send a new version later.

Ulf Hansson <ulf.hansson@linaro.org> 于2021年1月20日周三 下午11:29写道:
>
> On Wed, 20 Jan 2021 at 15:47, Fengnan Chang <fengnanchang@gmail.com> wrote:
> >
> > when analyse tuples failed, may enter an endless loop,so limit the time of retries.
>
> Since this is fixing a real bug for you, it looks like we should tag
> this for stable kernels as well, right?
>
> >
> > Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
> > ---
> >  drivers/mmc/core/sdio_cis.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
> > index dcb3dee59fa5..47423a6d13fb 100644
> > --- a/drivers/mmc/core/sdio_cis.c
> > +++ b/drivers/mmc/core/sdio_cis.c
> > @@ -266,6 +266,7 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func)
> >
> >         do {
> >                 unsigned char tpl_code, tpl_link;
> > +               u64 timeout = get_jiffies_64() + 10 * HZ;
>
> To be consistent with how we do time based polling (see
> __mmc_poll_for_busy() in mmc_ops.c for example) I would prefer if you
> use a define for the timeout, rather than a magic value as here.
>
> #define SDIO_READ_CIS_TIMEOUT_MS  (10 * 1000) /* 10s */
>
> Additionally, regular jiffies should be sufficient I think. Thus I
> prefer if you could specify the timeout along the lines like the
> below:
> timeout = jiffies + msecs_to_jiffies(SDIO_READ_CIS_TIMEOUT_MS);
>
> >
> >                 ret = mmc_io_rw_direct(card, 0, 0, ptr++, 0, &tpl_code);
> >                 if (ret)
> > @@ -318,6 +319,8 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func)
> >                         prev = &this->next;
> >
> >                         if (ret == -ENOENT) {
> > +                               if (time_after64(get_jiffies_64(), timeout))
> > +                                       break;
> >                                 /* warn about unknown tuples */
> >                                 pr_warn_ratelimited("%s: queuing unknown"
> >                                        " CIS tuple 0x%02x (%u bytes)\n",
> > --
> > 2.25.1
> >
>
> Other than that, this looks okay to me.
>
> Kind regards
> Uffe

      reply	other threads:[~2021-01-23  3:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 14:45 [PATCH v2] mmc: limit the time of retries when analyse tuples failed Fengnan Chang
2021-01-20 15:28 ` Ulf Hansson
2021-01-23  3:08   ` fengnan chang [this message]

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='CALWNXx_x84iPkBzA=6kKziRA030ok5anW9oMsmUUjZFfhd7_Wg@mail.gmail.com' \
    --to=fengnanchang@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@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;
as well as URLs for NNTP newsgroup(s).