From: David Brownell <david-b@pacbell.net>
To: "Wolfgang Mües" <wolfgang.mues@auerswald.de>
Cc: "Matt Fleming" <matt@console-pimps.org>,
"Pierre Ossman" <drzeus@drzeus.cx>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Mike Frysinger" <vapier.adi@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc_spi: use EILSEQ for possible transmission errors
Date: Wed, 20 May 2009 02:20:46 -0700 [thread overview]
Message-ID: <200905200220.46569.david-b@pacbell.net> (raw)
In-Reply-To: <200905201035.23964.wolfgang.mues@auerswald.de>
On Wednesday 20 May 2009, Wolfgang Mües wrote:
> what about the following proposal which is not so aggressive?
Seems plausible to me, though note one comment at the end...
> The current mapping in mmc_spi.c is:
>
> R1_SPI_PARAMETER => EINVAL
> R1_SPI_ADDRESS => EINVAL
> R1_SPI_ILLEGAL_COMMAND => EINVAL
> R1_SPI_COM_CRC => EILSEQ
> R1_SPI_ERASE_SEQ => EIO
> R1_SPI_ERASE_RESET => EIO
Yeah, that took a bit of head-scratching to come up with.
> R1_SPI_COM_CRC is a transmission error - no doubt. Mapping to EILSEQ is OK.
>
> R1_SPI_ERASE_SEQ and R1_SPI_ERASE_RESET are responses to a sector erase
> command. block.c is not sending such commands, so block.c can safely assume
> that each such response is a transmission error.
Hmm, would hope that's not a long-term plan. Remember that the
firmware in the card can leverage "that's erased" knowledge for
things like wear leveling. SSDs and other storage devices would
likewise benefit from such knowledge. I'm quite certain there's
been discussion about adding support for that in the block layer.
> R1_SPI_PARAMETER and R1_SPI_ADDRESS are errors from the card controller
> because a parameter or an address is out of range/invalid. It is mapped to
> EINVAL, and so the caller can not distinguish between errors from the host
> controller and driver or the card. This has to be changed to some other code,
> maybe EFAULT /* Bad address */.
OK.
> R1_SPI_ILLEGAL_COMMAND is mapped to EINVAL, and I suggest it to replace with
> ENOSYS /* Function not implemented */.
>
> A quick scan in the mmc directory for EINVAL reveals that there are no callers
> which need to be changed.
>
> As block.c does not send a command, parameter or address which is invalid/out
> of range,
That is, *today* it doesn't. For the moment I suspect just logging
the actual fault code (a pr_debug) may will suffice; this is the kind
of stuff that shouldn't get buried too deeply.
> these errors must be considered transmission errors in the command
> (if CRC is off) or in the response.
And the key issue is -- correct me if I'm wrong -- that returning
EINVAL makes trouble, so you need to change those three codes. The
others don't much matter, right?
next prev parent reply other threads:[~2009-05-20 9:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 11:24 [PATCH] mmc_spi: use EILSEQ for possible transmission errors Wolfgang Mües
2009-05-19 11:29 ` Matt Fleming
2009-05-19 11:47 ` Wolfgang Mües
2009-05-20 7:53 ` Matt Fleming
2009-05-20 4:49 ` David Brownell
2009-05-20 8:35 ` Wolfgang Mües
2009-05-20 9:20 ` David Brownell [this message]
2009-05-20 10:08 ` Pierre Ossman
2009-05-21 2:02 ` David Brownell
2009-05-25 9:04 ` Wolfgang Mües
2009-05-25 9:43 ` David Brownell
2009-05-25 10:18 ` Wolfgang Mües
2009-05-25 11:50 ` Pierre Ossman
2009-05-25 14:59 ` Wolfgang Mües
2009-06-09 18:07 ` Pierre Ossman
2009-06-10 7:29 ` Wolfgang Mües
2009-06-10 7:37 ` Matt Fleming
2009-06-13 10:57 ` Pierre Ossman
2009-05-25 11:48 ` Pierre Ossman
2009-05-20 10:31 ` Wolfgang Mües
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=200905200220.46569.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=akpm@linux-foundation.org \
--cc=drzeus@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=vapier.adi@gmail.com \
--cc=wolfgang.mues@auerswald.de \
/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