Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627400
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: fsl_ifc_nand: are blank pages protected by ECC? |
| Date | 2017-04-20 14:20 +0200 |
| Message-ID | <tyje1-o7-1@gated-at.bofh.it> (permalink) |
| References | <txWKu-3m5-21@gated-at.bofh.it> <ty5b4-8qb-19@gated-at.bofh.it> <ty678-z3-15@gated-at.bofh.it> <ty6gO-DP-17@gated-at.bofh.it> <tyiL0-8qv-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 20 Apr 2017 13:40:57 +0200
Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
> > > Would it make sense to only do hweight if *bitmap != ~0ULL ? Would it
> > > make sense to only check for bitflips > bitflips_threshold each 128
> > > bytes or something like that?
> >
> > I didn't go as far as you did and simply assumed hweight32/64() were
> > already optimized. Feel free to propose extra improvements.
>
> I'd propose this one (only compile tested, sorry, not sure how to test
> this one). If we see ~0UL, there's no need for hweight, and no need to
> check number of bitflips. So this should be net win.
Looks good to me. Can you send a patch with a real commit message?
Thanks,
Boris
>
> Signed-off-by: Pavel Machek <pavel@denx.de>
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index b0524f8..96c27ec 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1357,7 +1357,10 @@ static int nand_check_erased_buf(void *buf, int len, int bitflips_threshold)
>
> for (; len >= sizeof(long);
> len -= sizeof(long), bitmap += sizeof(long)) {
> - weight = hweight_long(*((unsigned long *)bitmap));
> + unsigned long d = *((unsigned long *)bitmap);
> + if (d == ~0UL)
> + continue;
> + weight = hweight_long(d);
> bitflips += BITS_PER_LONG - weight;
> if (unlikely(bitflips > bitflips_threshold))
> return -EBADMSG;
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-19 14:20 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-19 23:20 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-20 00:20 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-20 00:30 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-20 13:50 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-20 14:20 +0200
[PATCH] nand_base: optimize checking of erased buffers Pavel Machek <pavel@ucw.cz> - 2017-04-21 13:00 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-21 12:10 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Richard Weinberger <richard@nod.at> - 2017-04-21 12:20 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-21 14:10 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-21 15:40 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-21 15:50 +0200
Re: fsl_ifc_nand: are blank pages protected by ECC? Pavel Machek <pavel@ucw.cz> - 2017-04-22 09:10 +0200
[PATCH] tango_nand.c: fix ecc.stats_corrected in empty flash case Pavel Machek <pavel@ucw.cz> - 2017-04-22 12:50 +0200
tango_nand: is logic right in error cases? (was Re: fsl_ifc_nand: are blank pages protected by ECC?) Pavel Machek <pavel@ucw.cz> - 2017-04-23 12:00 +0200
Re: tango_nand: is logic right in error cases? (was Re: fsl_ifc_nand: are blank pages protected by ECC?) Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-04-24 09:20 +0200
csiph-web