NAND Bad Block Marking Policy

Guilherme de Oliveira Costa guilherme.oliveira at autotrac.com.br
Thu Feb 18 04:22:42 PST 2016


Hello,

I’m using U-Boot 2013.01.01, and I noticed a behaviour that I could not comprehend
regarding bad block handling by U-Boot: it only checks the first two pages of a block to see if
the block is bad.

Let's say we have a nand with the following features:
   Memory Size 128 MB
   Sector size 128 KiB
   Page size      2048 b
   OOB size         64 b
   Erase size   131072 b

If I try and mark a block as bad manually (via nand markbad), the following happens:

U-Boot at UCC3# nand markbad 0x4290000
block 0x04290000 successfully marked as bad
U-Boot at UCC3# nand bad

Device 0 bad blocks:
  04280000

Everything seems fine. However, after a reboot, the system loses the information. Sifting
through the code, I found the it is only checking the first two pages OOB. Note however that
the block that gets marked as bad is block 0x4280000, which is aligned in memory with the
eraseblock size (1st page in the eraseblock). Also, if I dump the OOB info from 0x428000, it is
not flagged as bad, but  in 0x429000, the first byte is still 0x00, indicating it as bad.
If I mark the 1st or 2nd page in an erase block as bad, then the information persists through
boot cycles. Also, I've verified that we are not using a NAND based BBT.

My main concern is that, because this checking shared between functionalities, every time
we erase a block, we keep losing bad block information, because inner pages (i.e. not the
1st or 2nd in an eraseblock), are flagged as good, and are not skipped by nand erase (which,
in my point of view,  is a bad thing).

So, a few questions:
  - Why is this the default behaviour? It seems to me a bad idea to check only the first two
     pages, since any block could go bad. Unless anytime a page goes bad, we should mark it on
     the first two   pages and on the page itself.
  - If this is indeed the default behaviour, it seems to me that it is due to performance reasons.
    So, in this case, should we mark the whole eraseblock as bad (by writing 0x00 to the 1st or
    2nd pages) if we find a single bad page? Isn't this also a bad solution, since we will be marking
    128kiB as bad due to a single page? Shouldn't this control be made at a finer level (i.e. page level)?

Regards,
Guilherme
Esta mensagem e qualquer anexo a ela são documentos confidenciais e direcionados exclusivamente ao(s) destinatário(s). Qualquer uso, desvio, sonegação, supressão, revelação ou divulgação não autorizada é proibida e sujeita às sanções e/ou reparações legais por ato ilícito (Código Penal, Artigos 151 e 152). Caso não seja um dos destinatários expressamente indicados, por favor entre em contato com o remetente, respondendo este e-mail e destrua quaisquer cópias da mensagem original. Qualquer opinião, crítica ou análise descrita nesta mensagem é de responsabilidade única do remetente, a menos quando estiver explicitamente expresso que seja da empresa remetente.

This message and any attachment are confidential information for the sole use of the intended recipients. Any unauthorized use, deviation, withholdment, suppression, disclosure or distribution is prohibited and is subjected to legal sanctions and/or compensations per illicit act (Penal Code, articles 151 and 152). If you are not one of the intended recipients, please contact the sender by reply e-mail and destroy any copy of the original message. Any view, comment or analysis expressed in this message is sole responsibility from the sender, except when it’s specifically expressed that it’s the view, comment or analysis of the company.



More information about the linux-mtd mailing list