linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS
@ 2022-04-20 13:47 Tudor Ambarus
  2022-04-20 13:47 ` [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP Tudor Ambarus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-04-20 13:47 UTC (permalink / raw)
  To: nicolas.ferre, claudiu.beznea, alexandre.belloni
  Cc: codrin.ciubotariu, eugen.hristev, linux-arm-kernel, linux-kernel,
	Tudor Ambarus

Using mtdblock on raw flashes is generally a bad idea as it lacks
wear-leveling, bad block handling or power-cut management.
What happens when you use mtdblock and you change any sector of your
mtdblockX device, is that it reads the whole corresponding eraseblock into
the memory, erases the eraseblock, changes the sector in RAM, and writes
the whole eraseblock back. If you have a power failure when the eraseblock
is being erased, you lose all the block device sectors in it. The flash
will likely decay soon because the eraseblocks will wear out.

Remove this archaic tool as its use case should rather be only for debug
purposes. This means that write-capable block file systems like ext2,
ext3, FAT, etc. will no longer be addressed with at91 defconfigs. For
read only block filesystems like SquashFS, use MTD_UBI_BLOCK instead and
benefit of UBI's bit-flip handling and wear-levelling.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 arch/arm/configs/at91_dt_defconfig | 2 +-
 arch/arm/configs/sama5_defconfig   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 549d01be0b47..cf79510631ea 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -50,13 +50,13 @@ CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_MTD=y
 CONFIG_MTD_TESTS=m
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_BLOCK=y
 CONFIG_MTD_DATAFLASH=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_MTD_UBI_BLOCK=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 03dd80c2a19e..1c4c5a035518 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -57,13 +57,13 @@ CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_MTD=y
 CONFIG_MTD_TESTS=m
 CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_MTD_UBI_BLOCK=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP
  2022-04-20 13:47 [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Tudor Ambarus
@ 2022-04-20 13:47 ` Tudor Ambarus
  2022-05-05 13:49   ` Nicolas Ferre
  2022-04-20 13:47 ` [PATCH 3/3] ARM: configs: at91: sama7: Enable MTD_UBI_BLOCK Tudor Ambarus
  2022-05-05 13:49 ` [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Nicolas Ferre
  2 siblings, 1 reply; 5+ messages in thread
From: Tudor Ambarus @ 2022-04-20 13:47 UTC (permalink / raw)
  To: nicolas.ferre, claudiu.beznea, alexandre.belloni
  Cc: codrin.ciubotariu, eugen.hristev, linux-arm-kernel, linux-kernel,
	Tudor Ambarus

Use fastmap to accelerate the attach procedure.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 arch/arm/configs/sama7_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
index 07b0494ef743..03652454274f 100644
--- a/arch/arm/configs/sama7_defconfig
+++ b/arch/arm/configs/sama7_defconfig
@@ -94,6 +94,7 @@ CONFIG_MTD_NAND_ATMEL=y
 # CONFIG_MTD_NAND_ECC_SW_HAMMING is not set
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=1
@@ -221,9 +222,9 @@ CONFIG_CRC_ITU_T=y
 CONFIG_DMA_CMA=y
 CONFIG_CMA_SIZE_MBYTES=32
 CONFIG_CMA_ALIGNMENT=9
+# CONFIG_DEBUG_MISC is not set
 # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
 CONFIG_DEBUG_FS=y
-# CONFIG_DEBUG_MISC is not set
 # CONFIG_SCHED_DEBUG is not set
 CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ARM: configs: at91: sama7: Enable MTD_UBI_BLOCK
  2022-04-20 13:47 [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Tudor Ambarus
  2022-04-20 13:47 ` [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP Tudor Ambarus
@ 2022-04-20 13:47 ` Tudor Ambarus
  2022-05-05 13:49 ` [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Nicolas Ferre
  2 siblings, 0 replies; 5+ messages in thread
From: Tudor Ambarus @ 2022-04-20 13:47 UTC (permalink / raw)
  To: nicolas.ferre, claudiu.beznea, alexandre.belloni
  Cc: codrin.ciubotariu, eugen.hristev, linux-arm-kernel, linux-kernel,
	Tudor Ambarus

Address read only block filesystems like SquashFS, and use MTD_UBI_BLOCK
to benefit of UBI's bit-flip handling and wear-levelling.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 arch/arm/configs/sama7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
index 03652454274f..b267a49ddac5 100644
--- a/arch/arm/configs/sama7_defconfig
+++ b/arch/arm/configs/sama7_defconfig
@@ -95,6 +95,7 @@ CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_FASTMAP=y
+CONFIG_MTD_UBI_BLOCK=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=1
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP
  2022-04-20 13:47 ` [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP Tudor Ambarus
@ 2022-05-05 13:49   ` Nicolas Ferre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2022-05-05 13:49 UTC (permalink / raw)
  To: Tudor Ambarus, claudiu.beznea, alexandre.belloni
  Cc: codrin.ciubotariu, eugen.hristev, linux-arm-kernel, linux-kernel

On 20/04/2022 at 15:47, Tudor Ambarus wrote:
> Use fastmap to accelerate the attach procedure.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>   arch/arm/configs/sama7_defconfig | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/configs/sama7_defconfig b/arch/arm/configs/sama7_defconfig
> index 07b0494ef743..03652454274f 100644
> --- a/arch/arm/configs/sama7_defconfig
> +++ b/arch/arm/configs/sama7_defconfig
> @@ -94,6 +94,7 @@ CONFIG_MTD_NAND_ATMEL=y
>   # CONFIG_MTD_NAND_ECC_SW_HAMMING is not set
>   CONFIG_MTD_SPI_NOR=y
>   CONFIG_MTD_UBI=y
> +CONFIG_MTD_UBI_FASTMAP=y
>   CONFIG_BLK_DEV_LOOP=y
>   CONFIG_BLK_DEV_RAM=y
>   CONFIG_BLK_DEV_RAM_COUNT=1
> @@ -221,9 +222,9 @@ CONFIG_CRC_ITU_T=y
>   CONFIG_DMA_CMA=y
>   CONFIG_CMA_SIZE_MBYTES=32
>   CONFIG_CMA_ALIGNMENT=9
> +# CONFIG_DEBUG_MISC is not set
>   # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
>   CONFIG_DEBUG_FS=y
> -# CONFIG_DEBUG_MISC is not set
>   # CONFIG_SCHED_DEBUG is not set
>   CONFIG_STACKTRACE=y
>   # CONFIG_FTRACE is not set

I understand the rationale of this change, but it should probably go 
into another patch or it's even sometimes done by arm-soc maintainers, 
so I removed it.
No need to resend, I'll remove while applying.

Best regards,
   Nicolas



-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS
  2022-04-20 13:47 [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Tudor Ambarus
  2022-04-20 13:47 ` [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP Tudor Ambarus
  2022-04-20 13:47 ` [PATCH 3/3] ARM: configs: at91: sama7: Enable MTD_UBI_BLOCK Tudor Ambarus
@ 2022-05-05 13:49 ` Nicolas Ferre
  2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2022-05-05 13:49 UTC (permalink / raw)
  To: Tudor Ambarus, claudiu.beznea, alexandre.belloni
  Cc: codrin.ciubotariu, eugen.hristev, linux-arm-kernel, linux-kernel

On 20/04/2022 at 15:47, Tudor Ambarus wrote:
> Using mtdblock on raw flashes is generally a bad idea as it lacks
> wear-leveling, bad block handling or power-cut management.
> What happens when you use mtdblock and you change any sector of your
> mtdblockX device, is that it reads the whole corresponding eraseblock into
> the memory, erases the eraseblock, changes the sector in RAM, and writes
> the whole eraseblock back. If you have a power failure when the eraseblock
> is being erased, you lose all the block device sectors in it. The flash
> will likely decay soon because the eraseblocks will wear out.
> 
> Remove this archaic tool as its use case should rather be only for debug
> purposes. This means that write-capable block file systems like ext2,
> ext3, FAT, etc. will no longer be addressed with at91 defconfigs. For
> read only block filesystems like SquashFS, use MTD_UBI_BLOCK instead and
> benefit of UBI's bit-flip handling and wear-levelling.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>

For the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

and queued in at91-defconfig for 5.19.

Best regards,
   Nicolas

> ---
>   arch/arm/configs/at91_dt_defconfig | 2 +-
>   arch/arm/configs/sama5_defconfig   | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
> index 549d01be0b47..cf79510631ea 100644
> --- a/arch/arm/configs/at91_dt_defconfig
> +++ b/arch/arm/configs/at91_dt_defconfig
> @@ -50,13 +50,13 @@ CONFIG_DEVTMPFS_MOUNT=y
>   CONFIG_MTD=y
>   CONFIG_MTD_TESTS=m
>   CONFIG_MTD_CMDLINE_PARTS=y
> -CONFIG_MTD_BLOCK=y
>   CONFIG_MTD_DATAFLASH=y
>   CONFIG_MTD_RAW_NAND=y
>   CONFIG_MTD_NAND_ATMEL=y
>   CONFIG_MTD_SPI_NOR=y
>   CONFIG_MTD_UBI=y
>   CONFIG_MTD_UBI_FASTMAP=y
> +CONFIG_MTD_UBI_BLOCK=y
>   CONFIG_BLK_DEV_LOOP=y
>   CONFIG_BLK_DEV_RAM=y
>   CONFIG_BLK_DEV_RAM_COUNT=4
> diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
> index 03dd80c2a19e..1c4c5a035518 100644
> --- a/arch/arm/configs/sama5_defconfig
> +++ b/arch/arm/configs/sama5_defconfig
> @@ -57,13 +57,13 @@ CONFIG_DEVTMPFS_MOUNT=y
>   CONFIG_MTD=y
>   CONFIG_MTD_TESTS=m
>   CONFIG_MTD_CMDLINE_PARTS=y
> -CONFIG_MTD_BLOCK=y
>   CONFIG_MTD_CFI=y
>   CONFIG_MTD_RAW_NAND=y
>   CONFIG_MTD_NAND_ATMEL=y
>   CONFIG_MTD_SPI_NOR=y
>   CONFIG_MTD_UBI=y
>   CONFIG_MTD_UBI_FASTMAP=y
> +CONFIG_MTD_UBI_BLOCK=y
>   CONFIG_BLK_DEV_LOOP=y
>   CONFIG_BLK_DEV_RAM=y
>   CONFIG_BLK_DEV_RAM_COUNT=4


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-05 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 13:47 [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Tudor Ambarus
2022-04-20 13:47 ` [PATCH 2/3] ARM: configs: at91: sama7: Enable MTD_UBI_FASTMAP Tudor Ambarus
2022-05-05 13:49   ` Nicolas Ferre
2022-04-20 13:47 ` [PATCH 3/3] ARM: configs: at91: sama7: Enable MTD_UBI_BLOCK Tudor Ambarus
2022-05-05 13:49 ` [PATCH 1/3] ARM: configs: at91: Remove MTD_BLOCK and use MTD_UBI_BLOCK for read only block FS Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).