Linux-EFI Archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Romain Gantois <romain.gantois@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Ard Biesheuvel <ardb@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Herve Codina <herve.codina@bootlin.com>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-efi@vger.kernel.org
Subject: Re: [RFC PATCH 0/6] Add GPT parser to MTD layer
Date: Thu, 14 Dec 2023 11:34:07 +0100	[thread overview]
Message-ID: <20231214113407.484e24a5@xps-13> (raw)
In-Reply-To: <cykfpuff32nuq3t27vd5tv463cx32phri473fjnrruvom5dk5u@uao5e3ml73ai>

Hi Davidlohr,

dave@stgolabs.net wrote on Mon, 11 Dec 2023 16:43:58 -0800:

> On Mon, 11 Dec 2023, Romain Gantois wrote:
> 
> >Hello everyone,
> >
> >MTD devices were historically partitioned using fixed partitions schemes
> >defined in the kernel device tree or on the cmdline. More recently, a bunch
> >of dynamic parsers have been introduced, allowing partitioning information
> >to be stored in-band. However, unlike disks, parsers for MTD devices do not
> >support runtime discovery of the partition format. This format is instead
> >named in the device-tree using a compatible string.
> >
> >The GUID Partition Table is one of the most common ways of partitioning a
> >block device. As of now, there is no support in the MTD layer for parsing
> >GPT tables. Indeed, use cases for layouts like GPT on raw Flash devices are
> >rare, and for good reason since these partitioning schemes are sensitive to
> >bad blocks in strategic locations such as LBA 2.  Moreover, they do not
> >allow proper wear-leveling to be performed on the full span of the device.
> >
> >However, allowing GPT to be used on MTD devices can be practical in some
> >cases. In the context of an A/B OTA upgrade that can act on either NOR of
> >eMMC devices, having the same partition table format for both kinds of
> >devices can simplify the task of the update software.
> >
> >This series adds a fully working MTD GPT parser to the kernel. Use of the
> >parser is restricted to NOR flash devices, since NAND flashes are too
> >susceptible to bad blocks. To ensure coherence and code-reuse between
> >subsystems, I've factored device-agnostic code from the block layer GPT
> >parser and moved it to a new generic library in lib/gpt.c. No functional
> >change is intended in the block layer parser.
> >
> >I understand that this can seem like a strange feature for MTD devices, but
> >with the restriction to NOR devices, the partition table can be fairly
> >reliable. Moreover, this addition fits nicely into the MTD parser model.
> >Please tell me what you think.  
> 
> I am not a fan of this. The usecase seems very hacky and ad-hoc to justify
> decoupling from the block layer,

The use case indeed is a bit ad-hoc, as it is an OTA tool which makes
it painful to handle two separate types of partitioning between blocks
and mtd devices, so being able to parse a GPT on an mtd device would
help a lot.

> not to mention move complexity out of
> userspace and into the kernel (new parser) for something that is already
> being done/worked around.

This is the part I don't fully agree with. There is no added
complexity, the parser exists and is kept untouched (apart from the
cosmetic changes). For a long time mtd partitioning information was
kept out of the storage (through fixed-partitions) but it's been quite
some time since the need for more flexible approaches arised, so we do
have "dynamic" partition parsers already and the one proposed by Romain
looks very straightforward and is thus not a problem to me. It
basically just extends the list of partition tables mtd devices know
about with a very common and popular format.

To be honest I do not have a strong opinion on whether this should be
merged or not but my reluctance is more about the mix of styles between
'block' and 'mtd'. People shall not treat them similarly for a number
of reasons, and this parser is an obvious step towards a more common
handling, knowing that it's been exclusively used on blocks for
decades.

> Also, what other user would consume this new gpt
> lib abstraction in the future? I don't think it is worth it.

Well, again I don't feel like this is a problem, sharing code between
two parties is already a win and the choice for a lib sounds rational
to me. The question being, shall we do it/do we want to do it.

Thanks,
Miquèl

      reply	other threads:[~2023-12-14 10:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 15:12 [RFC PATCH 0/6] Add GPT parser to MTD layer Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 1/6] block: partitions: efi: Move efi.h header to include/linux/gpt.h Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 2/6] block: partitions: efi: Fix some style issues Romain Gantois
2023-12-12  0:57   ` Davidlohr Bueso
2023-12-11 15:12 ` [RFC PATCH 3/6] block: partitions: efi: Separate out GPT-specific code Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 4/6] block: partitions: efi: Move GPT-specific code to a new library Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 5/6] drivers: mtd: introduce GPT parser for NOR flash devices Romain Gantois
2023-12-11 15:12 ` [RFC PATCH 6/6] dt-bindings: mtd: add GPT partition bindings Romain Gantois
2023-12-11 16:21   ` Rob Herring
2023-12-12  0:43 ` [RFC PATCH 0/6] Add GPT parser to MTD layer Davidlohr Bueso
2023-12-14 10:34   ` Miquel Raynal [this message]

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=20231214113407.484e24a5@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=ardb@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=conor+dt@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=devicetree@vger.kernel.org \
    --cc=herve.codina@bootlin.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=romain.gantois@bootlin.com \
    --cc=thomas.petazzoni@bootlin.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 read-only IMAP folder(s) and NNTP newsgroup(s).