Skip to contentSkip to conversation

protecting env partitions from bad blocks

DISCUSSION Boaz Ben-David 3 participants 4 messages Jun 5, 2011 – Jun 6, 2011

lore
Share & tools
lore
#0 lore raw

Hi all,

I want to protect the env partition on my device from bad blocks (created during operation or already there out of the factory). Couldn't find any good documentation regarding this issue, so I have some questions:

1. Exactly what capabilities the bb devices in Barebox give me?
2. I was thinking of somehow assigning the env partition larger than required in order to later
handle bad blocks by moving the block currenly being used to be the first good block.
Is this a good approach or maybe there is something already ready and I shouldn't bother because I am totally missing the point?

Thanks,

Boaz.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

Hi,

Quoted 2 lines · Boaz Ben-David

I want to protect the env partition on my device from bad blocks (created during operation or already there out of the factory).

Maybe you mean the same, but you cannot really _protect_ them from bad blocks.

Quoted 4 lines

Couldn't find any good documentation regarding this issue, so I have some questions:

1. Exactly what capabilities the bb devices in Barebox give me?

Handling a flash based memory in a linear manner, even if there are "holes" in the memory.

non-bb |---------------------|BB|------------------------------|

                           |---ESU--|
bb     |-----------------------------------------------|

Reading the "non-bb" will give you an error message, when you try to read from the offset the BadBlock is located. Reading the "bb" silently skips the BadBlock for you. By the price the usable size is smaller.
ESU is a "erase size unit" you always will lose if it contains a bad block.

Quoted 6 lines

2. I was thinking of somehow assigning the env partition larger than required in order to later
handle bad blocks by moving the block currenly being used to be the first good block.
Is this a good approach or maybe there is something already ready and I shouldn't bother because I am totally missing the point?

You should increase the partitions in "erase block size units". Recent NAND flashes are using 128 kiB erase size units. So, increasing by 256 kiB will give you two spare "erase block size units".

jbe

Signature · 9 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-5121-206917-5128 |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi Juergen,

Thanks for your reply.
Please correct me if I'm wrong here, but from what you are saying, if my flash has a block
size of 512KB (thats the erase size also) and I define the env partition to have say 5 blocks with one that is bad I'm covered if I do my read/write operations using a bb device.

Also, say a block gets wear out after extended use, will it be marked bad after a failed write operation for example? I think the quiestion above is actually if Barebox can handle a block going bad in it's environment?

Thanks,

Boaz.

Quoted 29 lines · Juergen Beisert

Hi,

Quoted 2 lines · Boaz Ben-David

I want to protect the env partition on my device from bad blocks (created during operation or already there out of the factory).

Maybe you mean the same, but you cannot really _protect_ them from bad blocks.

Quoted 4 lines

Couldn't find any good documentation regarding this issue, so I have some questions:

1. Exactly what capabilities the bb devices in Barebox give me?

Handling a flash based memory in a linear manner, even if there are "holes" in the memory.

non-bb |---------------------|BB|------------------------------|

                            |---ESU--|
bb     |-----------------------------------------------|

Reading the "non-bb" will give you an error message, when you try to read from the offset the BadBlock is located. Reading the "bb" silently skips the BadBlock for you. By the price the usable size is smaller.
ESU is a "erase size unit" you always will lose if it contains a bad block.

Quoted 6 lines

2. I was thinking of somehow assigning the env partition larger than required in order to later
handle bad blocks by moving the block currenly being used to be the first good block.
Is this a good approach or maybe there is something already ready and I shouldn't bother because I am totally missing the point?

Quoted 6 lines

You should increase the partitions in "erase block size units". Recent NAND flashes are using 128 kiB erase size units. So, increasing by 256 kiB will give you two spare "erase block size units".

jbe

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw

Hi Boaz,

Please do not top-post.

Quoted 11 lines · Boaz Ben-David

Hi Juergen,

Thanks for your reply.
Please correct me if I'm wrong here, but from what you are saying, if my flash has a block
size of 512KB (thats the erase size also) and I define the env partition to have say 5 blocks with one that is bad
I'm covered if I do my read/write operations using a bb device.

Also, say a block gets wear out after extended use, will it be marked bad after a failed write operation for example?

barebox currently does not actively mark a block as bad. You can only do it manually from the command line.
However, it correctly handles bad blocks once they are there, so if barebox starts and can't read its environment, you can mark a block bad on the command line. After a 'saveenv' the bad block gets skipped during write (and also during reading next time).

This is a lack of features, so patches welcome.

Sascha

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

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox