[PATCH RFC] spi: spi-qpic-snand: overestimate corrected bitflips

Gabor Juhos j4g8y7 at gmail.com
Mon May 26 12:00:20 PDT 2025


2025. 05. 23. 16:39 keltezéssel, Miquel Raynal írta:
> On 22/05/2025 at 19:33:26 +02, Gabor Juhos <j4g8y7 at gmail.com> wrote:
> 
>> The QPIC hardware is not capable of reporting the exact number of the
>> corrected bitflips, it only reports the number of the corrected bytes.
>> However the current code treats that as corrected bitflips which is
>> quite inaccurate in most cases. For example, even if the hardware reports
>> only one byte as corrected, that byte may have contained multiple bit
>> errors from one up to the maximum number of correctable bits.
>>
>> Change the code to report the maximum of the possibly corrected bits,
>> thus allowing upper layers to do certain actions before the data gets
>> lost due to uncorrectable errors.
>>
>> Signed-off-by: Gabor Juhos <j4g8y7 at gmail.com>
>> ---
>> The patch tries to address Miquel's concerns [1] about the corrected bit
>> error reporting capabilities of the QPIC hardware.
>>
>> [1] https://lore.kernel.org/all/87h61e8kow.fsf@bootlin.com
> 
> Thank you very much for attempting to improve the situation. Giving this
> a second look, it will not work either and will be even worse, forcing
> wear levelling after each read. So let's not change the returned value,
> hopefully the real life is different as the test case and most bitflips
> will be spread and not concentrated in a single byte. However I'd
> welcome either a pr_warn_once() or at least a comment somewhere about
> this.

Ok, I will rework the patch. If it turns out that the current approach behaves
badly in real life, we can still change it later.

Thanks,
Gabor



More information about the linux-mtd mailing list