linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Thibaut VARÈNE" <hacks+kernel@slashdirt.org>
To: linux-mtd@lists.infradead.org
Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	tudor.ambarus@microchip.com, p.yadav@ti.com, michael@walle.cc,
	git@johnthomson.fastmail.com.au,
	"Thibaut VARÈNE" <hacks+kernel@slashdirt.org>
Subject: [PATCH v3 0/3] mtd: write support for minor-aligned partitions
Date: Fri, 29 Jul 2022 11:16:33 +0200	[thread overview]
Message-ID: <20220729091636.59287-1-hacks+kernel@slashdirt.org> (raw)

This patch series enable write support for minor-aligned mtd partitions
on devices that support multiple erasesizes.

On supporting hardware, they enable RW operations on mtd partitions that
break "major" (largest) erasesize boundary (e.g. too small or not
correctly aligned) without sacrificing performance (i.e. forcing
everything to use 4K sectors). Finally, they address an historical FIXME
in mtdpart.c.

The following performance numbers were measured with v5.10 kernel on OpenWrt:
(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y forces the use of the new code path)

OpenWrt 5.10 ramips MT7621 w25q128jv 0xfc0000 firmware partition length
time mtd erase firmware

Without this patch:
MTD_SPI_NOR_USE_4K_SECTORS=n	|y
real    0m 50.86s		|2m 11.66s
user    0m 0.00s		|0m 0.00s
sys     0m 50.80s		|1m 56.20s
can write minor-aligned parts? N|Y

With this patch:
MTD_SPI_NOR_USE_VARIABLE_ERASE=n|y		|4K_SECTORS=y
real    0m 51.68s		|0m 50.85s	|2m 12.89s
user    0m 0.00s		|0m 0.00s	|0m 0.01s
sys     0m 46.94s		|0m 50.38s	|2m 12.46s
can write minor-aligned parts? N|Y		|Y


NB: This patchset was previously submitted as a monolithic patch (RFC[0],
v1[1]). While not submitted upstream v2 was however reviewed, tested and
accepted in OpenWrt, and backported into the upcoming 22.03 stable branch:
https://github.com/openwrt/openwrt/pull/3271

[0] 20210104122853.18428-1-git@johnthomson.fastmail.com.au
[1] 20210608040719.14431-1-git@johnthomson.fastmail.com.au

Changes v2 -> v3:
  - Split patch into incremental, functionally-separate changes.
  - Adjusted erasesize_minor assignment check in spi-nor/core.c
  - Addressed checkpatch warning on "printk(KERN_WARNING..."
  - Documented new sysfs attribute

Changes v1 -> v2:
  - Added mtdcore sysfs attribute for erasesize_minor
  - Removed finding minor erasesize for variable erase regions device,
    (untested and no response to RFC).
  - Moved IF_ENABLED() to guard setting erasesize_minor in spi-nor/core.c
  - Removed setting major erasesize to minor where partition boundaries
    require minor erase to be writable
  - Simplified minor boundary check by relying on minor being a factor
    of major

Changes RFC -> v1:
  - Fixed uninitialized variable smatch warning

Thibaut VARÈNE (3):
  mtd: mtdpart: write support for minor-aligned partitions
  mtd: spi-nor: set erasesize_minor in spi_nor_select_erase()
  mtd: spi-nor: allow overriding uniform erase

 Documentation/ABI/testing/sysfs-class-mtd |  8 ++++++
 drivers/mtd/mtdcore.c                     | 10 +++++++
 drivers/mtd/mtdpart.c                     | 35 ++++++++++++++++-------
 drivers/mtd/spi-nor/Kconfig               | 10 +++++++
 drivers/mtd/spi-nor/core.c                | 13 +++++++--
 include/linux/mtd/mtd.h                   |  2 ++
 6 files changed, 65 insertions(+), 13 deletions(-)


base-commit: e0dccc3b76fb35bb257b4118367a883073d7390e
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2022-07-29  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  9:16 Thibaut VARÈNE [this message]
2022-07-29  9:16 ` [PATCH v3 1/3] mtd: mtdpart: write support for minor-aligned partitions Thibaut VARÈNE
2022-07-29  9:16 ` [PATCH v3 2/3] mtd: spi-nor: set erasesize_minor for non-uniform erase Thibaut VARÈNE
2022-07-29  9:16 ` [PATCH v3 3/3] mtd: spi-nor: allow overriding uniform erase Thibaut VARÈNE
2022-08-09  9:23 ` [PATCH v3 0/3] mtd: write support for minor-aligned partitions Thibaut VARÈNE
2022-08-09 15:45   ` Tudor.Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220729091636.59287-1-hacks+kernel@slashdirt.org \
    --to=hacks+kernel@slashdirt.org \
    --cc=git@johnthomson.fastmail.com.au \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).