* [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength
@ 2024-08-12 1:56 Daniel Golle
2024-08-12 7:26 ` Frieder Schrempf
2024-08-23 17:35 ` Miquel Raynal
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Golle @ 2024-08-12 1:56 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Tudor Ambarus, Daniel Golle, Mika Westerberg, Chia-Lin Kao,
Martin Kurbanov, linux-mtd, linux-kernel
Reporting an unclean read from SPI-NAND only when the maximum number
of correctable bitflip errors has been hit seems a bit late.
UBI LEB scrubbing, which depends on the lower MTD device reporting
correctable bitflips, then only kicks in when it's almost too late.
Set bitflip_threshold to 75% of the ECC strength, which is also the
default for raw NAND.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/mtd/nand/spi/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index e0b6715e5dfed..018c854d06193 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_device *spinand)
/* Propagate ECC information to mtd_info */
mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
+ mtd->bitflip_threshold = DIV_ROUND_UP(mtd->ecc_strength * 3, 4);
ret = spinand_create_dirmaps(spinand);
if (ret) {
--
2.46.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength
2024-08-12 1:56 [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength Daniel Golle
@ 2024-08-12 7:26 ` Frieder Schrempf
2024-08-23 17:35 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Frieder Schrempf @ 2024-08-12 7:26 UTC (permalink / raw)
To: Daniel Golle, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Tudor Ambarus, Mika Westerberg,
Chia-Lin Kao, Martin Kurbanov, linux-mtd, linux-kernel
Hi Daniel,
On 12.08.24 3:56 AM, Daniel Golle wrote:
> Reporting an unclean read from SPI-NAND only when the maximum number
> of correctable bitflip errors has been hit seems a bit late.
> UBI LEB scrubbing, which depends on the lower MTD device reporting
> correctable bitflips, then only kicks in when it's almost too late.
>
> Set bitflip_threshold to 75% of the ECC strength, which is also the
> default for raw NAND.
>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> drivers/mtd/nand/spi/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index e0b6715e5dfed..018c854d06193 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -1287,6 +1287,7 @@ static int spinand_init(struct spinand_device *spinand)
> /* Propagate ECC information to mtd_info */
> mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
> mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
> + mtd->bitflip_threshold = DIV_ROUND_UP(mtd->ecc_strength * 3, 4);
Is this just a theoretical adjustment or did you encounter any issues on
a real device? If the latter, could you add a sentence about your
use-case to the commit message?
In general the change looks good to me, so feel free to add:
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
But it would still be good to hear further opinions.
Thanks
Frieder
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength
2024-08-12 1:56 [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength Daniel Golle
2024-08-12 7:26 ` Frieder Schrempf
@ 2024-08-23 17:35 ` Miquel Raynal
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2024-08-23 17:35 UTC (permalink / raw)
To: Daniel Golle, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Tudor Ambarus, Mika Westerberg,
Chia-Lin Kao, Martin Kurbanov, linux-mtd, linux-kernel
On Mon, 2024-08-12 at 01:56:41 UTC, Daniel Golle wrote:
> Reporting an unclean read from SPI-NAND only when the maximum number
> of correctable bitflip errors has been hit seems a bit late.
> UBI LEB scrubbing, which depends on the lower MTD device reporting
> correctable bitflips, then only kicks in when it's almost too late.
>
> Set bitflip_threshold to 75% of the ECC strength, which is also the
> default for raw NAND.
>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-23 17:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-12 1:56 [PATCH] mtd: spinand: set bitflip_threshold to 75% of ECC strength Daniel Golle
2024-08-12 7:26 ` Frieder Schrempf
2024-08-23 17:35 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®