Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Christian Loehle <CLoehle@hyperstone.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: Avri Altman <avri.altman@wdc.com>, Jens Axboe <axboe@kernel.dk>,
	Michael Wu <michael@allwinnertech.com>,
	Ming Lei <ming.lei@redhat.com>,
	Seunghui Lee <sh043.lee@samsung.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH] [RFC] Revert "mmc: core: Fixup support for writeback-cache for eMMC and SD"
Date: Wed, 31 May 2023 23:33:53 +0200	[thread overview]
Message-ID: <3ade78ec-c908-48d0-7d60-a9a4e20c6f76@denx.de> (raw)
In-Reply-To: <e1816811f70f490fba860e5838b15495@hyperstone.com>

On 5/31/23 15:08, Christian Loehle wrote:
> One thing that comes to my mind that would explain the behavior, since all commands itself complete fine is:
> Issuing sd cache flush:
> [   61.992588] mmc1: starting CMD49 arg 10020a00 flags 00000035
> [   61.998152] mmc1:     blksz 512 blocks 1 flags 00000100 tsac 3000 ms
> nsac 0
> [   62.005158] mmci-pl18x 58005000.mmc: blksz 0200 blks 0001 flags 00000100
> [   62.011778] mmci-pl18x 58005000.mmc: op 31 arg 10020a00 flags 00000035
> [   62.018317] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000040
> [   62.024011] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000100
> [   62.029801] mmc1: req done (CMD49): 0: 00000900 00000000 00000000
> 00000000
> [   62.036708] mmc1:     512 bytes transferred: 0
> [   62.041083] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000000
> [   62.046988] mmc1: starting CMD48 arg 10020a00 flags 000000b5
> [   62.052487] mmc1:     blksz 512 blocks 1 flags 00000200 tsac 100 ms
> nsac 0
> [   62.059443] mmci-pl18x 58005000.mmc: blksz 0200 blks 0001 flags 00000200
> [   62.066154] mmci-pl18x 58005000.mmc: op 30 arg 10020a00 flags 000000b5
> [   62.072688] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000040
> [   62.078382] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000100
> 
> The kernel reads back the page to ensure it has completed.
> 
> [   62.084173] mmc1: req done (CMD48): 0: 00000900 00000000 00000000
> 00000000
> [   62.091081] mmc1:     512 bytes transferred: 0
> [   62.095455] mmci-pl18x 58005000.mmc: irq0 (data+cmd) 00000000
> 
> 
> [   62.101381] I/O error, dev mmcblk1, sector 8192 op 0x1:(WRITE) flags
> 0x800 phys_seg 1 prio class 2
> 
> Fail here implies that it did indeed fail right after CMD48.
> 
> I would expect a card that does not hold down busy the entire cache flush time would produce the observed behavior.
> The CMD48 is issued ~100ms after the CMD49, so not nearly close to the timeout of 1s.
> 
> That is just one possibility of course, it would need a full trace to confirm.

What kind of trace ?

> For you easier probably something like:
> 
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 72b664ed90cf..c9d3cae0678d 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -1354,8 +1354,11 @@ static int sd_flush_cache(struct mmc_host *host)
>                  goto out;
>          }
> 
> -       if (reg_buf[0] & BIT(0))
> +       if (reg_buf[0] & BIT(0)) {
> +               pr_warn("%s: Cache Flush bit still active after busy phase\n",
> +                       mmc_hostname(host));
>                  err = -ETIMEDOUT;
> +       }

Adrian provided a bit more complete patch, I tested that, see my reply 
there.

  reply	other threads:[~2023-05-31 21:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  0:27 [PATCH] [RFC] Revert "mmc: core: Fixup support for writeback-cache for eMMC and SD" Marek Vasut
2023-05-31  5:46 ` Adrian Hunter
2023-05-31 11:34   ` Marek Vasut
2023-05-31 13:08     ` Christian Loehle
2023-05-31 21:33       ` Marek Vasut [this message]
2023-05-31 13:13     ` Adrian Hunter
2023-05-31 21:31       ` Marek Vasut
2023-06-01  6:20         ` Adrian Hunter
2023-06-02 21:46           ` Marek Vasut
2023-06-04 16:30             ` Adrian Hunter
2023-06-07 20:43               ` Marek Vasut
2023-06-12  4:59                 ` Adrian Hunter
2023-06-12  8:59                   ` Marek Vasut
2023-06-12  9:29                     ` Adrian Hunter
2023-06-15 15:14                     ` Ulf Hansson
2023-06-15 15:32                       ` Marek Vasut
2023-06-15 15:35                       ` Adrian Hunter
2023-06-15 15:36                         ` Marek Vasut
2023-06-16 10:02                           ` Ulf Hansson
2023-06-16 10:24                             ` Marek Vasut
2023-06-16 10:33                               ` Ulf Hansson
2023-06-20  1:44                                 ` Marek Vasut
2023-06-16 10:20                       ` Marek Vasut
2023-05-31  6:01 ` Avri Altman
2023-05-31 11:34   ` Marek Vasut

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=3ade78ec-c908-48d0-7d60-a9a4e20c6f76@denx.de \
    --to=marex@denx.de \
    --cc=CLoehle@hyperstone.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=michael@allwinnertech.com \
    --cc=ming.lei@redhat.com \
    --cc=sh043.lee@samsung.com \
    --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