From: Pierre Ossman <drzeus@drzeus.cx>
To: Adrian Hunter <ext-adrian.hunter@nokia.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mmc_block: print better data error message after timeout
Date: Sun, 26 Oct 2008 12:11:55 +0100 [thread overview]
Message-ID: <20081026121155.69692474@mjolnir.drzeus.cx> (raw)
In-Reply-To: <48F7411F.3020109@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 2799 bytes --]
On Thu, 16 Oct 2008 16:26:55 +0300
Adrian Hunter <ext-adrian.hunter@nokia.com> wrote:
> In particular, if the card gets an ECC error it will
> timeout, in which case it is much more helpful to see
> an ECC error rather than a timeout error.
>
> Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
> ---
Woo. I think you're the first I've seen that has been able to trigger
an actual card error. :)
As for the patch, I like the idea but I'm not entirely satisfied with
the implementation.
> +static void print_data_error(struct mmc_blk_request *brq, struct mmc_card *card,
> + struct request *req)
> +{
> + struct mmc_command cmd;
> + char *emsg;
> + u32 status;
> + int status_err = 0;
> +
> + if (brq->data.error != -ETIMEDOUT || mmc_host_is_spi(card->host))
> + goto out_print;
> +
The error codes are more of a hint than anything else, so you should
check the status for all non-zero codes. You should also not just check
data.error, but all of them.
And why exclude spi?
> + if (brq->mrq.stop)
> + /* 'Stop' response contains card status */
> + status = brq->mrq.stop->resp[0];
> + else {
> + cmd.opcode = MMC_SEND_STATUS;
> + cmd.arg = card->rca << 16;
> + cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
> + status_err = mmc_wait_for_cmd(card->host, &cmd, 0);
> + if (status_err)
> + goto out_print;
> + status = cmd.resp[0];
> + }
Errors can occur on writes as well, so I suggest accumulating the
status bits instead of trying to get the entire set in one go. I.e.:
status = 0;
if (mrq.stop)
status |= mrq.stop.resp[0];
while (card not ready)
status |= send_status();
IOW, you should do this in the main handler (that already has the
status loop for writes).
> +
> + emsg = (status & R1_CARD_ECC_FAILED) ? "ECC" : "I/O";
> +
There are also some other error codes that can be of interest.
"Internal controller error" for example.
(it's probably also better to state "Unknown" error and not "I/O" for
the fallback)
> @@ -281,10 +322,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
> req->rq_disk->disk_name, brq.cmd.error);
> }
>
> - if (brq.data.error) {
> - printk(KERN_ERR "%s: error %d transferring data\n",
> - req->rq_disk->disk_name, brq.data.error);
> - }
> + if (brq.data.error)
> + print_data_error(&brq, card, req);
>
Please keep the old message and add this as a new extra piece of
information. It is helpful for debugging to see both what the driver
and the card reported.
Rgds
--
-- Pierre Ossman
WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-10-26 11:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-16 13:26 Adrian Hunter
2008-10-26 11:11 ` Pierre Ossman [this message]
2008-10-27 15:33 ` Adrian Hunter
2008-10-29 10:29 ` Adrian Hunter
2008-11-10 8:20 ` Adrian Hunter
2008-11-10 9:53 ` Pierre Ossman
2008-11-30 18:48 ` Pierre Ossman
2008-12-04 13:35 ` Adrian Hunter
2008-12-21 14:22 ` Pierre Ossman
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=20081026121155.69692474@mjolnir.drzeus.cx \
--to=drzeus@drzeus.cx \
--cc=ext-adrian.hunter@nokia.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®