linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mike Dunn <mikedunn@newsguy.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Ivan Djelic <ivan.djelic@parrot.com>,
	linux-mtd@lists.infradead.org,
	David Woodhouse <David.Woodhouse@intel.com>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH 2/4] MTD: flash drivers set ecc strength
Date: Fri, 30 Mar 2012 17:05:45 -0700	[thread overview]
Message-ID: <4F764A59.1030908@newsguy.com> (raw)
In-Reply-To: <CAN8TOE_BxgTMJb0beyDC17jcmavmuz0WGvLw3NbJRCiuvB4VnA@mail.gmail.com>

On 03/29/2012 10:24 AM, Brian Norris wrote:
> Hi Mike, Artem, David,
> 
> Sorry for the late review here. It looks like this is already queued
> up for merging soon by David...


Thanks for having a look Brian.


> (BTW, patch 1 and 2 seem to do nothing by themselves; should they
> really be merged in the 3.4 window?)


Correct; it's just cruft currently.  There is a flaw in the patchset that was
pointed out by Ivan.  Basically, the threshold should be determined based on the
ecc strength of each ecc step, not on the aggregate ecc strength of the entire
page.  Since no one is clamoring for this change, I figured I'd wait until this
merge window passed before following up.  Fixing this flaw will require patching
many individual drivers.  The scope of the original patches was limited to the
nand infrastructure code.


> 
> On Sun, Mar 11, 2012 at 2:21 PM, Mike Dunn <mikedunn@newsguy.com> wrote:
>> Flash device drivers initialize 'ecc_strength' in struct mtd_info, which is the
>> maximum number of bit errors that can be corrected in one writesize region.
>>
>> Drivers using the nand interface intitialize 'strength' in struct nand_ecc_ctrl,
>> which is the maximum number of bit errors that can be corrected in one ecc step.
>> Nand infrastructure code translates this to 'ecc_strength'.
>>
>> Also for nand drivers, the nand infrastructure code sets ecc.strength for ecc
>> modes NAND_ECC_SOFT, NAND_ECC_SOFT_BCH, and NAND_ECC_NONE.  It is set in the
>> driver for all other modes.
> 
> I agree that the other modes should be set by the driver, but is there
> any kind of sanity check? We've seen problems with the addition of the
> mtd->writebufsize parameter that didn't get caught as uninitialized in
> a large number of drivers. I don't think your later patches handle the
> case that mtd->ecc_strength is not initialized or is 0.


I'll look into adding sanity checks.


> 
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index 1e907dc..8008853 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -3350,6 +3350,7 @@ int nand_scan_tail(struct mtd_info *mtd)
>>                if (!chip->ecc.size)
>>                        chip->ecc.size = 256;
>>                chip->ecc.bytes = 3;
>> +               chip->ecc.strength = 1;
>>                break;
>>
>>        case NAND_ECC_SOFT_BCH:
>> @@ -3384,6 +3385,8 @@ int nand_scan_tail(struct mtd_info *mtd)
>>                        pr_warn("BCH ECC initialization failed!\n");
>>                        BUG();
>>                }
>> +               chip->ecc.strength =
>> +                       chip->ecc.bytes*8 / fls(8*chip->ecc.size);
> 
> Isn't this spacing against coding style? I'd suggest spaces around the
> '*'. Also, after a few minutes, I have no idea where this calculation
> comes from. But I'm not familiar with SOFT_BCH. Maybe a comment is in
> order?
> 
>> @@ -3397,6 +3400,7 @@ int nand_scan_tail(struct mtd_info *mtd)
>>                chip->ecc.write_oob = nand_write_oob_std;
>>                chip->ecc.size = mtd->writesize;
>>                chip->ecc.bytes = 0;
>> +               chip->ecc.strength = 0;
>>                break;
> 
> This will cause problems with your patch 4, I think. I'll comment on
> the other email.
> 
> Brian
> 
> 

  reply	other threads:[~2012-03-31  0:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-11 21:21 [PATCH 0/4] MTD: Change meaning of -EUCLEAN return code on reads Mike Dunn
2012-03-11 21:21 ` [PATCH 1/4] MTD: add ecc_strength fields to mtd structs Mike Dunn
2012-03-13 12:25   ` Artem Bityutskiy
2012-03-11 21:21 ` [PATCH 2/4] MTD: flash drivers set ecc strength Mike Dunn
2012-03-13 12:27   ` Artem Bityutskiy
2012-03-16 14:13   ` Ivan Djelic
2012-03-16 20:02     ` Mike Dunn
2012-03-29 17:24   ` Brian Norris
2012-03-31  0:05     ` Mike Dunn [this message]
2012-04-02 17:34     ` Mike Dunn
2012-04-03  8:03       ` Ivan Djelic
2012-03-11 21:21 ` [PATCH 3/4] MTD: euclean_threshold added to mtd_info and sysfs Mike Dunn
2012-03-13 12:29   ` Artem Bityutskiy
2012-03-11 21:21 ` [PATCH 4/4] MTD: drivers return max_bitflips, mtd returns -EUCLEAN Mike Dunn
2012-03-14 11:05   ` Shmulik Ladkani
2012-03-14 11:45     ` Shmulik Ladkani
2012-03-29 17:30   ` Brian Norris
2012-03-30 12:13     ` Artem Bityutskiy
2012-03-31  1:17       ` Mike Dunn
2012-04-02  7:17         ` Artem Bityutskiy
2012-04-02 15:33           ` Mike Dunn
2012-03-31  1:05     ` Mike Dunn
2012-03-31  6:37       ` Shmulik Ladkani
2012-04-02 16:40         ` Mike Dunn
2012-04-03  8:48           ` Shmulik Ladkani
2012-04-13 15:54             ` Artem Bityutskiy
2012-04-13 18:18               ` Mike Dunn
2012-03-13 12:03 ` [PATCH 0/4] MTD: Change meaning of -EUCLEAN return code on reads Artem Bityutskiy
2012-03-13 17:46   ` Mike Dunn
2012-03-13 22:14     ` Mike Dunn
2012-03-14 10:56     ` Artem Bityutskiy

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=4F764A59.1030908@newsguy.com \
    --to=mikedunn@newsguy.com \
    --cc=David.Woodhouse@intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=ivan.djelic@parrot.com \
    --cc=linux-mtd@lists.infradead.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).