[U-Boot] [PATCH 1/3] mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN

Paul Burton paul.burton at imgtec.com
Tue Aug 20 11:53:47 CEST 2013


I'm not entirely sure whether it's a regression from the MTD merge or 
not, I only started adding support for my board in the past few months 
so I haven't tried older versions. From a glance at the history I 
suspect it might have always been possible, but since it only affects 
setups using software ECC with UBI nobody hit it before. Indeed I've 
since switched to using hardware ECC for my board so it wouldn't hit it 
any more either.

I can't remember the exact call chain off the top of my head, but it 
essentially led to UBI constantly scrubbing PEBs since they often 
(almost always) had some small number of correctable errors. It happened 
enough that the boot just appeared to hang. Prior to the patch a single 
bit flip caused mtd to return -EUCLEAN signalling to UBI that the data 
is potentially at risk and leading it to start scrubbing. In reality 
since a single bit flip is fine there's no need to.

I can switch to software ECC & without my patch to rediscover the exact 
call chain if you require, but it'll probably be a while before I do - 
busy week!

Thanks,
     Paul

On 19/08/13 09:55, Stefan Roese wrote:
> On 06.08.2013 12:13, Paul Burton wrote:
>> Linux modified the MTD driver interface in commit edbc4540 (with the
>> same name as this commit). The effect is that calls to mtd_read will not
>> return -EUCLEAN if the number of ECC-corrected bit errors is below a
>> certain threshold, which defaults to the strength of the ECC. This
>> allows -EUCLEAN to stop indicating "some bits were corrected" and begin
>> indicating "a large number of bits were corrected, the data held in this
>> region of flash may be lost soon". UBI makes use of this and when
>> -EUCLEAN is returned from mtd_read it will move data to another block of
>> flash. Without adopting this interface change UBI on U-boot attempts to
>> move data between blocks every time a single bit is corrected using the
>> ECC, which is a very common occurance on some devices. For some devices
>> it can be so common that UBI gets stuck constantly moving data around
>> because each block it attempts to use has a single bit error.  This
>> patch adopts the interface change as in Linux commit edbc4540 in order
>> to avoid such situations.
>>
>> Given that none of the drivers under drivers/mtd return -EUCLEAN, this
>> should only affect those using software ECC. I have tested that it works
>> on a board which is currently out of tree, but which I hope to be able
>> to begin upstreaming soon.
> Paul, a quick question to clarify this. This patch fixes a regression in
> the current mtd->_read implementation (used by UBI) that was introduced
> by the MTD sync to v3.7.1? Is this correct?
>
> And what error exactly did occur on your system?
>
> Thanks,
> Stefan
>




More information about the U-Boot mailing list