Skip to contentSkip to conversation

mtd:ubi: Read disturb and Data retention handling

PATCH Richard Weinberger 3 participants 6 messages Nov 10, 2014 – Nov 11, 2014 1 message not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

Richard Weinberger

author maintainer
#1 lore raw
In reply to a message not in the archive

Am 10.11.2014 um 13:07 schrieb Juergen Borleis:

Quoted 214 lines

Hi Richard,

sorry to jump in so lately:

Quoted 8 lines · Richard Weinberger
Quoted 5 lines

If we ignore read-disturb and don't' scrubb heavily read blocks we will have data loss as well. the only difference between the 2 scenarios is "how long before it happens". Read-disturb wasn't an issue since average lifespan of a nand device was ~5 years. Read-disturb occurs in a longer lifespan. that's why it's required now: a need for a "long life nand".

Okay, read-disturb will only happen if you read blocks *very* often. Do you have numbers, datasheets, etc...?

I have made some simple test by reading the first 2048 pages of my NAND in an endless loop. Only reading, nothing else (made while the bootloader was run, nothing else touches the NAND memory).

Below a result of my test with a 512 MiB SLC NAND with 2kiB page size and 128kiB block size:

The used NAND controller is able to correct up to 8 flipped bits. After the 9th bit is flipped the read returns -74.

This log is a snapshot after the whole area of the first 4 MiB of the NAND were read 201688 times.

Page no
/ 1st bitflip after iteration #

|    /        2nd bitflip after iteration #
|    |       /         3rd     4th     5th     6th     7th     8th bitflip after iteration #
|    |       |        /       /       /       /       /       /          error <errcode> @ iteration #
|    |       |       |       |       |       |       |       |          /
|    |       |       |       |       |       |       |       |          |
[...]
529: 91760   -       -       -       -       -       -       -       err: 0 @ 0
530: 67168   -       -       -       -       -       -       -       err: 0 @ 0
531: 141039  -       -       -       -       -       -       -       err: 0 @ 0
532: 100288  -       -       -       -       -       -       -       err: 0 @ 0
533: 133754  -       -       -       -       -       -       -       err: 0 @ 0
534: 130095  -       -       -       -       -       -       -       err: 0 @ 0
535: -       -       -       -       -       -       -       -       err: 0 @ 0
536: -       -       -       -       -       -       -       -       err: 0 @ 0
537: -       -       -       -       -       -       -       -       err: 0 @ 0
538: 116134  -       -       -       -       -       -       -       err: 0 @ 0
539: 198269  -       -       -       -       -       -       -       err: 0 @ 0
540: 61589   -       -       -       -       -       -       -       err: 0 @ 0
541: 69437   126618  -       -       -       -       -       -       err: 0 @ 0
542: 127839  146936  -       -       -       -       -       -       err: 0 @ 0
543: 90092   112675  -       -       -       -       -       -       err: 0 @ 0
544: 110714  -       -       -       -       -       -       -       err: 0 @ 0
545: 102323  179716  -       -       -       -       -       -       err: 0 @ 0
546: 63838   107524  -       -       -       -       -       -       err: 0 @ 0
547: 140739  -       -       -       -       -       -       -       err: 0 @ 0
548: 129423  -       -       -       -       -       -       -       err: 0 @ 0
549: 79855   172562  189242  -       -       -       -       -       err: 0 @ 0
550: 59809   95758   -       -       -       -       -       -       err: 0 @ 0
551: 61590   102645  182467  199394  -       -       -       -       err: 0 @ 0
552: 34892   47024   169765  -       -       -       -       -       err: 0 @ 0
553: 26725   99616   168528  -       -       -       -       -       err: 0 @ 0
554: 23348   117529  160522  194367  -       -       -       -       err: 0 @ 0
555: 108062  175917  -       -       -       -       -       -       err: 0 @ 0
556: 49259   120590  188435  -       -       -       -       -       err: 0 @ 0
557: 54306   96666   120881  -       -       -       -       -       err: 0 @ 0
558: 29085   31802   42191   43422   108748  167569  -       -       err: 0 @ 0
559: 56507   93286   -       -       -       -       -       -       err: 0 @ 0
560: 81849   101134  143402  152513  -       -       -       -       err: 0 @ 0
561: 13890   135991  199507  -       -       -       -       -       err: 0 @ 0
562: 34135   69826   90917   107625  147321  161796  194928  199981  err: 0 @ 0
563: 36564   83188   89780   110756  113977  132219  171701  181298  err: -74 @ 196719
564: 24710   84965   131464  136672  143401  166123  196109  -       err: 0 @ 0
565: 63052   190669  200874  -       -       -       -       -       err: 0 @ 0
566: 23602   62334   107324  108235  111701  141831  143176  170709  err: 0 @ 0
567: 7827    81759   105200  146536  175196  181900  192630  200021  err: 0 @ 0
568: 19248   38095   42491   85788   108021  150404  178145  -       err: 0 @ 0
569: 77853   93441   116798  149955  175747  -       -       -       err: 0 @ 0
570: 23229   34546   60418   84112   169202  191880  198953  -       err: 0 @ 0
571: 53596   66769   106074  133504  134134  163610  169159  178226  err: -74 @ 180360
572: 74009   83572   89710   103833  116947  147067  167137  -       err: 0 @ 0
573: 23161   43896   89573   95705   102324  102887  115829  122581  err: -74 @ 138582

[...]

You can see some pages start to suffer from read disturbance after about 7,000 reads and fail after 200,000 reads, other pages start at 23,000 reads but fails at 120,000 reads. There is no rule when a page starts to suffer from read disturbance and how fast. So a simple read counter with a threshhold to detect when to recover a page/block seems not helpful to me.

I'm still trying to interpret the test results. At least there are areas in the 4 MiB areas which show massive bit flips, while other areas have still no flipped bits.

For example the log shown above continues with this pattern:

574: -       -       -       -       -       -       -       -       err: 0 @ 0
575: -       -       -       -       -       -       -       -       err: 0 @ 0
576: -       -       -       -       -       -       -       -       err: 0 @ 0
577: -       -       -       -       -       -       -       -       err: 0 @ 0
578: -       -       -       -       -       -       -       -       err: 0 @ 0
579: -       -       -       -       -       -       -       -       err: 0 @ 0
580: -       -       -       -       -       -       -       -       err: 0 @ 0
581: -       -       -       -       -       -       -       -       err: 0 @ 0
582: -       -       -       -       -       -       -       -       err: 0 @ 0
583: -       -       -       -       -       -       -       -       err: 0 @ 0
584: -       -       -       -       -       -       -       -       err: 0 @ 0
585: -       -       -       -       -       -       -       -       err: 0 @ 0
586: -       -       -       -       -       -       -       -       err: 0 @ 0
587: -       -       -       -       -       -       -       -       err: 0 @ 0
588: -       -       -       -       -       -       -       -       err: 0 @ 0
589: -       -       -       -       -       -       -       -       err: 0 @ 0
590: -       -       -       -       -       -       -       -       err: 0 @ 0
591: -       -       -       -       -       -       -       -       err: 0 @ 0
592: 194921  -       -       -       -       -       -       -       err: 0 @ 0
593: -       -       -       -       -       -       -       -       err: 0 @ 0
594: -       -       -       -       -       -       -       -       err: 0 @ 0
595: 99328   186011  -       -       -       -       -       -       err: 0 @ 0
596: 178049  188598  -       -       -       -       -       -       err: 0 @ 0
597: -       -       -       -       -       -       -       -       err: 0 @ 0
598: 88247   -       -       -       -       -       -       -       err: 0 @ 0
599: 66701   -       -       -       -       -       -       -       err: 0 @ 0
600: 68454   -       -       -       -       -       -       -       err: 0 @ 0
601: 152351  -       -       -       -       -       -       -       err: 0 @ 0
602: 33574   56123   -       -       -       -       -       -       err: 0 @ 0
603: 130160  -       -       -       -       -       -       -       err: 0 @ 0
604: 87415   -       -       -       -       -       -       -       err: 0 @ 0
605: 121079  140456  -       -       -       -       -       -       err: 0 @ 0
606: 78960   201089  -       -       -       -       -       -       err: 0 @ 0
607: 67561   -       -       -       -       -       -       -       err: 0 @ 0
608: 136825  -       -       -       -       -       -       -       err: 0 @ 0
609: 46315   -       -       -       -       -       -       -       err: 0 @ 0
610: 38588   86638   100277  149299  193350  -       -       -       err: 0 @ 0
611: 77835   106222  184955  -       -       -       -       -       err: 0 @ 0
612: 82427   196739  -       -       -       -       -       -       err: 0 @ 0
613: 45261   69448   -       -       -       -       -       -       err: 0 @ 0
614: 49466   177882  -       -       -       -       -       -       err: 0 @ 0
615: 68595   130868  -       -       -       -       -       -       err: 0 @ 0
616: 40169   134280  151830  -       -       -       -       -       err: 0 @ 0
617: 47167   130047  -       -       -       -       -       -       err: 0 @ 0
618: 62839   114948  125289  -       -       -       -       -       err: 0 @ 0
619: 45988   -       -       -       -       -       -       -       err: 0 @ 0
620: 22611   70944   125715  183733  185630  193842  -       -       err: 0 @ 0
621: 71908   171400  -       -       -       -       -       -       err: 0 @ 0
622: 21252   44002   114774  154423  190673  -       -       -       err: 0 @ 0
623: 33323   35582   101091  117813  -       -       -       -       err: 0 @ 0
624: 68726   108034  113045  -       -       -       -       -       err: 0 @ 0
625: 45920   63497   122692  159199  165520  169147  200725  -       err: 0 @ 0
626: 39039   60375   92903   101632  102331  118883  -       -       err: 0 @ 0
627: 44046   102881  163181  -       -       -       -       -       err: 0 @ 0
628: 53511   89063   158921  194571  -       -       -       -       err: 0 @ 0
629: 45185   78174   118801  160227  192668  -       -       -       err: 0 @ 0
630: 106109  117537  165575  170772  183222  -       -       -       err: 0 @ 0
631: 8848    15614   120298  -       -       -       -       -       err: 0 @ 0
632: 58004   -       -       -       -       -       -       -       err: 0 @ 0
633: 102767  155246  200323  -       -       -       -       -       err: 0 @ 0
634: 44970   45381   78299   103220  108726  174601  -       -       err: 0 @ 0
635: 24964   46413   58086   71776   195353  -       -       -       err: 0 @ 0
636: 16024   64719   77322   83557   120118  134934  137786  157911  err: -74 @ 173650
637: 54520   76187   89813   97778   125270  150291  178132  185518  err: -74 @ 199306
638: -       -       -       -       -       -       -       -       err: 0 @ 0
639: -       -       -       -       -       -       -       -       err: 0 @ 0
640: -       -       -       -       -       -       -       -       err: 0 @ 0
641: -       -       -       -       -       -       -       -       err: 0 @ 0
642: -       -       -       -       -       -       -       -       err: 0 @ 0
643: -       -       -       -       -       -       -       -       err: 0 @ 0
644: -       -       -       -       -       -       -       -       err: 0 @ 0
645: -       -       -       -       -       -       -       -       err: 0 @ 0
646: -       -       -       -       -       -       -       -       err: 0 @ 0
647: -       -       -       -       -       -       -       -       err: 0 @ 0
648: -       -       -       -       -       -       -       -       err: 0 @ 0

[...]

More confusing: the same test running on a 256 MiB NAND shows a different result with much less failures. After about 200,000 loops *all* pages are still okay (or correctable). The max bit flips in one page were four.

[...]

546: -       -       -       -       -       -       -       -       err: 0 @ 0
547: -       -       -       -       -       -       -       -       err: 0 @ 0
548: -       -       -       -       -       -       -       -       err: 0 @ 0
549: -       -       -       -       -       -       -       -       err: 0 @ 0
550: -       -       -       -       -       -       -       -       err: 0 @ 0
551: -       -       -       -       -       -       -       -       err: 0 @ 0
552: -       -       -       -       -       -       -       -       err: 0 @ 0
553: -       -       -       -       -       -       -       -       err: 0 @ 0
554: 198362  -       -       -       -       -       -       -       err: 0 @ 0
555: 138881  -       -       -       -       -       -       -       err: 0 @ 0
556: -       -       -       -       -       -       -       -       err: 0 @ 0
557: -       -       -       -       -       -       -       -       err: 0 @ 0
558: -       -       -       -       -       -       -       -       err: 0 @ 0
559: 77431   -       -       -       -       -       -       -       err: 0 @ 0
560: 100023  -       -       -       -       -       -       -       err: 0 @ 0
561: -       -       -       -       -       -       -       -       err: 0 @ 0
562: 83265   -       -       -       -       -       -       -       err: 0 @ 0
563: 154552  -       -       -       -       -       -       -       err: 0 @ 0
564: 154541  -       -       -       -       -       -       -       err: 0 @ 0
565: -       -       -       -       -       -       -       -       err: 0 @ 0
566: -       -       -       -       -       -       -       -       err: 0 @ 0
567: -       -       -       -       -       -       -       -       err: 0 @ 0
568: 105275  -       -       -       -       -       -       -       err: 0 @ 0
569: 91386   186096  -       -       -       -       -       -       err: 0 @ 0
570: -       -       -       -       -       -       -       -       err: 0 @ 0
571: 43163   -       -       -       -       -       -       -       err: 0 @ 0
572: 79839   190846  -       -       -       -       -       -       err: 0 @ 0
573: 184267  -       -       -       -       -       -       -       err: 0 @ 0
574: -       -       -       -       -       -       -       -       err: 0 @ 0
575: -       -       -       -       -       -       -       -       err: 0 @ 0
576: -       -       -       -       -       -       -       -       err: 0 @ 0
577: -       -       -       -       -       -       -       -       err: 0 @ 0
578: -       -       -       -       -       -       -       -       err: 0 @ 0
579: -       -       -       -       -       -       -       -       err: 0 @ 0
[...]
1848: -       -       -       -       -       -       -       -       err: 0 @ 0
1849: 115731  168972  178123  196740  -       -       -       -       err: 0 @ 0
1850: -       -       -       -       -       -       -       -       err: 0 @ 0
Quoted 1 line

[...]

Thanks a lot for this report, your number are a very valuable input.
They prove what Artem and I feared, it is almost impossible to define a sane threshold. So, having exact read-counters will be almost useless.
All we can do is scrubbing PEBs unconditionally.

Can you share your test program? I'd like to run it also on one of my boards.

Thanks,
//richard

#2 lore raw

Hi Richard,

On Monday 10 November 2014 13:35:26 Richard Weinberger wrote:
[...]

Quoted 2 lines

Can you share your test program? I'd like to run it also on one of my boards.

Please find the patch attached. Its intended for the Barebox bootloader and can be applied to its current git. The "-c" option seems currently somehow broken. I have to talk to Sascha first.

jbe

Signature · 4 lines
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | Phone: +49-5121-206917-5128 |
Peiner Str. 6-8, 31137 Hildesheim, Germany    | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

commit f3deffa6abf6ab563eaa1842fa3836351d867f30

Author: Sascha Hauer <[email protected]>
Date:   Thu Jul 24 10:32:52 2014 +0200

Commands: Add a nand-read-test command

NAND flashes suffer from read disturbance. This means that if a page is read often enough there will be bitflips. This test tool continuously reads a bunch of pages and shows a statistic over the number of bitfips occured after which read iteration. This can be used to test a NAND flash but also to test a NAND driver. The page reads are optionally compared to the initial read of the page. If there is a difference, but the driver has not reported an error the driver is buggy.

commands/Kconfig +5 -0
index d73a393885e9..e1d4fba6bc08 100644
@@ -1800,6 +1800,11 @@ config CMD_NANDTEST
 		  -o OFFS	start offset on flash
 		  -l LEN	length of flash to test
 
+config CMD_NAND_READ_TEST
+	tristate
+	depends on NAND
+	prompt "nand read test"
+
 config CMD_POWEROFF
 	tristate
 	depends on HAS_POWEROFF
commands/Makefile +1 -0
index b1cdf331c441..66d63c8c869a 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_CMD_SAVEENV)	+= saveenv.o
 obj-$(CONFIG_CMD_LOADENV)	+= loadenv.o
 obj-$(CONFIG_CMD_NAND)		+= nand.o
 obj-$(CONFIG_CMD_NANDTEST)	+= nandtest.o
+obj-$(CONFIG_CMD_NAND_READ_TEST) += nand-read-test.o
 obj-$(CONFIG_CMD_MEMTEST)	+= memtest.o
 obj-$(CONFIG_CMD_TRUE)		+= true.o
 obj-$(CONFIG_CMD_FALSE)		+= false.o
commands/nand-read-test.c new file +275 -0

275 lines not on this page · raw message

#4 lore raw
In reply to Richard Weinberger
Quoted 22 lines · Richard Weinberger

Am 10.11.2014 um 13:07 schrieb Juergen Borleis:

Quoted 20 lines

I have made some simple test by reading the first 2048 pages of my NAND in an endless loop. Only reading, nothing else (made while the bootloader was run, nothing else touches the NAND memory).

Below a result of my test with a 512 MiB SLC NAND with 2kiB page size and 128kiB block size:
...

You can see some pages start to suffer from read disturbance after about 7,000 reads and fail after 200,000 reads, other pages start at 23,000 reads but fails at 120,000 reads. There is no rule when a page starts to suffer from read disturbance and how fast. So a simple read counter with a threshhold to detect when to recover a page/block seems not helpful to me.

More confusing: the same test running on a 256 MiB NAND shows a different result with much less failures. After about 200,000 loops *all* pages are still okay (or correctable). The max bit flips in one page were four.

[...]

These are interesting figures. I must admit I've never seen anything quite so bad before.

We use 128 MiB and 256 MiB SLC NAND chips in our products, and as part of the device qualification we run a test on a couple of samples where we repeatedly read the first four blocks of the flash in an endless loop, and measure the number of correctable and uncorrectable errors that occur.

Normally, we can read millions of times before even getting a single bit flip. I've currently had a Macronix 128 MiB flash under test, which according to the data sheet requires 4-bit ECC, but after 68 million reads of the type just mentioned is still performing well with only single-bit errors in various places in the test area. (The fact that errors do start to occur after a while puts any suspicions of unexpected read caching to rest). Admittedly, this is all at room temperature, etc, and only a single sample, but it still is quite far from 200 000 reads. Other chips of the same sizes that we use which specify 1-bit ECC have a similar performance.

The fact that 512 MiB is worse than 256 MiB is not too surprising, there could well be a technology jump between those sizes, with smaller bit cells for the larger flash.

Quoted 1 line

Can you share your test program? I'd like to run it also on one of my boards.

Agreed, it would be interesting to see what the results would be here too.

/Ricard

Signature · 3 lines
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
#5 lore raw

Hi Ricard,

Quoted 3 lines · On Monday 10 November 2014 14:13:27 Ricard Wanderlof wrote:

[...]
These are interesting figures. I must admit I've never seen anything quite so bad before.

That leads me to the question if I have done the test in a correct way.

Quoted 15 lines

We use 128 MiB and 256 MiB SLC NAND chips in our products, and as part of the device qualification we run a test on a couple of samples where we repeatedly read the first four blocks of the flash in an endless loop, and measure the number of correctable and uncorrectable errors that occur.

Normally, we can read millions of times before even getting a single bit flip. I've currently had a Macronix 128 MiB flash under test, which according to the data sheet requires 4-bit ECC, but after 68 million reads of the type just mentioned is still performing well with only single-bit errors in various places in the test area. (The fact that errors do start to occur after a while puts any suspicions of unexpected read caching to rest). Admittedly, this is all at room temperature, etc, and only a single sample, but it still is quite far from 200 000 reads. Other chips of the same sizes that we use which specify 1-bit ECC have a similar performance.

Quoted 3 lines

The fact that 512 MiB is worse than 256 MiB is not too surprising, there could well be a technology jump between those sizes, with smaller bit cells for the larger flash.

I have no idea how the two boards were programmend I run these two tests on. Maybe the NAND programming was done in a wrong way which leads to this bad result.
On these boards the first 4 MiB area is the 'bootloader area', which must have a special layout to enable the ROM code to load the bootloader from it.

I have a bunch of boards here with 128/256/512 MiB NANDs where I can repeat the tests. Any recommendations how to setup the NAND before to do the tests again?

jbe

Signature · 4 lines
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | Phone: +49-5121-206917-5128 |
Peiner Str. 6-8, 31137 Hildesheim, Germany    | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
#6 lore raw
Quoted 8 lines · Juergen Borleis

Hi Ricard,

Quoted 3 lines · On Monday 10 November 2014 14:13:27 Ricard Wanderlof wrote:

[...]
These are interesting figures. I must admit I've never seen anything quite so bad before.

That leads me to the question if I have done the test in a correct way.

Could be. Or there's a lot of difference between flash manufacturers. We had very bad experience with a certain manufacturer several years ago.

Quoted 3 lines

I have no idea how the two boards were programmend I run these two tests on. Maybe the NAND programming was done in a wrong way which leads to this bad result.

Unlike for instance old EPROMs, where the software programming the chip had to have a programming algorithm, with a NAND flash you basically send the data to the flash and wait for the embedded programming algorithm on the flash to finish, then check the result.

One problem could be if the page had been programmer more than the specified number of times without being erased. E.g. most SLC flashes specify a maximum of 3 writes per page before erase becomes necessary. If this is violated it could result in unstable bits.

Another problem could be if the power supply was out of spec during programming.

Quoted 3 lines

I have a bunch of boards here with 128/256/512 MiB NANDs where I can repeat the tests. Any recommendations how to setup the NAND before to do the tests again?

Not really, more than checking so that the data in the flash is the result of a single write operation (i.e. not written in 16 byte bursts for instance), and that the specs for the flash chip haven't been violated during programming; in essence, that the write operation is allowed to finish on its own (but I'm not sure it can be interrupted except by a power cycle anyway, so I don't think there's much that can be abused here. Perhaps someone else knows of a more concrete case of abusing a flash in software so it fails to retain its data?.)

/Ricard

Signature · 3 lines
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
author maintainer
#3 lore raw
In reply to Juergen Borleis

Am 10.11.2014 um 14:12 schrieb Juergen Borleis:

Quoted 10 lines

Hi Richard,

On Monday 10 November 2014 13:35:26 Richard Weinberger wrote:
[...]

Quoted 2 lines

Can you share your test program? I'd like to run it also on one of my boards.

Please find the patch attached. Its intended for the Barebox bootloader and can be applied to its current git. The "-c" option seems currently somehow broken. I have to talk to Sascha first.

Tanya, can you please run this test program on your board too?

Thanks,
//richard