From: David Gibson <david@gibson.dropbear.id.au>
To: Herve Codina <herve.codina@bootlin.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
David Lechner <dlechner@baylibre.com>,
Ayush Singh <ayush@beagleboard.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
devicetree-compiler@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree-spec@vger.kernel.org,
Hui Pu <hui.pu@gehealthcare.com>,
Ian Ray <ian.ray@gehealthcare.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH v3 15/15] Introduce v18 dtb version
Date: Thu, 22 Oct 2026 14:17:38 +1100 [thread overview]
Message-ID: <atmASGg1OZt9jfXI@gractus.seuss> (raw)
In-Reply-To: <20261021172043.4bbd2bc5@bootlin.com>
[-- Attachment #1: Type: text/plain, Size: 6552 bytes --]
On Wed, Oct 21, 2026 at 05:20:43PM +0200, Herve Codina wrote:
> Hi David,
>
> On Wed, 21 Oct 2026 13:26:49 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > >
> > > Ok, my proposal seems to be a no-go and so I will follow your proposal given
> > > above.
> >
> > To be clear, I'm rejecting the original proposal because I think it's
> > internally inconsistent (if you follow the consequences of decisions
> > far enough). I'm not necessarily opposed to something other than the
> > above, as long as the rules for when unknown tags must be invalidated
> > (and what that does to the version) are made very clear in the
> > structured tag spec. e.g. see an alternative proposal below.
>
> No problem, I understand your point.
>
> ...
>
> >
> > Essentially the theory of the proposal above is to be maximally
> > conservative: any write (adding, removing, changing, in-place,
> > whatever) will invalidate all unknown tags and downgrade the version.
> >
> >
> > But, here's an alternative proposal for invalidation/version semantics
> > that I think is consistent, while being a bit closer to your original
> > proposal.
> >
> > 1. version and last_comp_version retain their meanings. No new header
> > version.
>
> Ok
>
> > 2. If version >= 18 the tree may include any structured tags, even if
> > they weren't defined as of v18.
>
> Ok
>
> > 3. Some future version might _require_ certain structured tags to be
> > present. But a client must only rely on those tags if the version
> > indicates it can.
> > - e.g. suppose FDT_FOO tag is introduced in v20. A client
> > reading a v19 tree _might_ see some FDT_FOO tags (because of
> > (2)), but cannot rely on them being present in all the places
> > they should be.
>
> Ok, kind of degraded mode. Whether or not a v20 compatible client can continue
> or not will depend of each tags known by this v20 client. For some tags, having
> them removed will not be a problem whereas it will be a problem for some other.
Exactly.
> Makes sense.
>
> > 4. Any write to a property (including in place) invalidates all
> > unknown tags on that property (they must be stripped)
>
> Ok
>
> > 5. Any write to a property invalidates all unknown tags on that
> > property's node
>
> Will see in the implementation. The offset of the written property will be
> incorrect after the write. Indeed, some tags (tags related to the node)
> available before the property can be removed. With splices instead of
> FDT_NOP, offsets change.
Oh, good point, this rule doesn't work. I think we still have a
consistent set of rules if property writes don't invalidate parent
node tags (subnode add/delete still would). Of coutse, that does
further restrict what sorts of information you could safely put in
node tags under this scheme.
> This also brings a question. Are API functions such as fdt_get_property_by_offset_w()
> need to be deprecated?
I think we can keep it - kind of like fdt_next_tag() this is a
low-level function. If you use it, you're opting in to having to deal
with tag invalidation.
> Those kind of functions return a pointer to the data of a property for modification
> by the caller. We don't know if the caller will modify or not the property.
>
> Without deprecated it we can change the function to
> ---- 8< ----
> struct fdt_property *fdt_get_property_by_offset_w(void *fdt,
> int offset,
> int *lenp)
> {
> int new_offset;
>
> /*
> * The modification is goind to be done out of libfdt.
> * Unknown tags are removed (rules for modification when unknown tags
> * are involved) but also known tags. Indeed, we cannot know if the
> * modification will have impacts on known tags
> */
> new_offset = fdt_remove_all_tags_due_to_property_modification(fdt, offset);
>
> return (struct fdt_property *)(uintptr_t)
> fdt_get_property_by_offset(fdt, new_offset, lenp);
> }
> ---- 8< ----
>
> The idea is to be conservative here also and consider that property data retrieved
> for writing will be modified by the caller.
>
> Also, the offset used as parameter of fdt_get_property_by_offset_w() is no more
> valid after the call.
>
> Last point to have in mind, getting the node offset from the property offset will
> need to walk the tree from the beginning. It can be costly.
Right, that's what I was thinking of when I said this might not be
practical to implement. It's doable in the common case where we alter
properties by node offset + property name, but not when we use a
property offset. But the fact that this would change the offset of
the property in queestion is a much bigger showstopper.
> > 6. Adding or deleting a property on a node invalidates all unknown tags
> > on the node
>
> Ok.
>
> > 7. Adding or deleting a subnode invalidates all unknown tags on the
> > node
>
> Ok.
>
> > 8. Whenever a tag is invalidated and stripped, the overall version
> > must be downgraded (to let clients know they can't count on tags
> > being present)
>
> Ok.
>
> >
> > Points (4)-(7) are all somewhat negotiable. In particular, I'm not
> > sure how feasible (6) is to implement.
>
> Well, this new proposal is more complex to implement than your first
> proposal but it has a finer grain to handle unknown tags on modification.
Certainly - that's why I proposed the other one first :).
> I can try to implement something based on this new proposal.
To be clear, I kind of prefer my first proposal still. The question
is whether what the updated scheme buys (preserving more tags when a
bootloader makes minor writes) worth the added complexity of
implementation. You're better placed to answer that question than I
am.
> > Note that because writes don't invalidate tags on ancestor nodes
> > beyond one level, this proposal doesn't permit tags to contain summary
> > information about an entire subtree that could be invalidated by
> > writes further down in that tree.
> >
>
> Well this doesn't look like an issue on my side. At some point if such tags
> are added, we can avoid any modification using the last_comp_version
> field.
Yes.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-10-22 3:17 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 8:31 [PATCH v3 00/15] Add support for structured tags and " Herve Codina
2026-08-26 8:31 ` [PATCH v3 01/15] fdtget: Use libfdt iterators instead of open coded loops Herve Codina
2026-08-27 3:55 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 02/15] libfdt: Don't assume the root node is available at offset 0 Herve Codina
2026-08-30 3:21 ` David Gibson
2026-08-31 12:01 ` Herve Codina
2026-09-01 7:42 ` David Gibson
2026-09-01 12:18 ` Herve Codina
2026-09-02 7:06 ` David Gibson
2026-09-07 16:46 ` Herve Codina
2026-09-08 6:41 ` David Gibson
2026-09-08 8:08 ` Herve Codina
2026-09-09 6:18 ` David Gibson
2026-09-09 6:58 ` Herve Codina
2026-09-09 7:02 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 03/15] tests: " Herve Codina
2026-09-01 8:03 ` David Gibson
2026-09-01 13:36 ` Herve Codina
2026-09-02 8:56 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 04/15] tests/nopulate: Add a FDT_NOP before the root node Herve Codina
2026-09-01 8:05 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 05/15] tests: treegen: Introduce emit_fdt_header_vers() Herve Codina
2026-09-09 6:38 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 06/15] Introduce structured tag value definition Herve Codina
2026-09-10 4:51 ` David Gibson
2026-09-10 7:41 ` Herve Codina
2026-09-10 9:32 ` David Gibson
2026-09-11 7:16 ` Herve Codina
2026-09-12 2:34 ` David Gibson
2026-09-14 10:19 ` Herve Codina
2026-09-16 5:21 ` David Gibson
2026-09-17 7:04 ` Herve Codina
2026-09-18 4:41 ` David Gibson
2026-09-18 8:16 ` Herve Codina
2026-09-19 4:22 ` David Gibson
2026-09-22 6:41 ` Herve Codina
2026-09-24 3:49 ` David Gibson
2026-09-25 10:48 ` Herve Codina
2026-09-26 1:49 ` David Gibson
2026-09-10 5:33 ` David Gibson
2026-09-10 7:58 ` Herve Codina
2026-09-10 9:41 ` David Gibson
2026-09-11 7:53 ` Herve Codina
2026-09-12 2:35 ` David Gibson
2026-09-17 8:56 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 07/15] fdtdump: Handle unknown tags Herve Codina
2026-09-10 5:25 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 08/15] flattree: " Herve Codina
2026-09-14 8:23 ` David Gibson
2026-09-15 10:16 ` Herve Codina
2026-09-15 11:52 ` David Gibson
2026-09-16 6:31 ` Herve Codina
2026-09-16 8:27 ` David Gibson
2026-09-17 7:11 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 09/15] libfdt: Handle unknown tags in fdt_next_tag() Herve Codina
2026-09-16 9:10 ` David Gibson
2026-09-17 8:34 ` Herve Codina
2026-09-17 9:36 ` David Gibson
2026-09-17 17:28 ` Herve Codina
2026-09-19 4:46 ` David Gibson
2026-09-30 16:47 ` Herve Codina
2026-10-01 3:07 ` David Gibson
2026-08-26 8:31 ` [PATCH v3 10/15] libfdt: Introduce fdt_ptr_offset_() Herve Codina
2026-08-26 8:31 ` [PATCH v3 11/15] libfdt: Introduce fdt_getprop_by_offset_w() Herve Codina
2026-09-16 9:56 ` David Gibson
2026-09-16 10:42 ` Herve Codina
2026-09-17 4:52 ` David Gibson
2026-09-17 8:43 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 12/15] libfdt: Introduce fdt_getprop_offset_namelen() Herve Codina
2026-09-21 6:07 ` David Gibson
2026-09-22 16:25 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 13/15] tests: Add wip_func utility Herve Codina
2026-09-16 10:00 ` David Gibson
2026-09-16 17:27 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 14/15] libfdt: Handle unknown tags on dtb modifications Herve Codina
2026-09-21 6:06 ` David Gibson
2026-09-25 12:40 ` Herve Codina
2026-09-28 4:39 ` David Gibson
2026-09-28 14:54 ` Herve Codina
2026-08-26 8:31 ` [PATCH v3 15/15] Introduce v18 dtb version Herve Codina
2026-09-21 6:20 ` David Gibson
2026-09-25 13:21 ` Herve Codina
2026-10-13 7:10 ` David Gibson
2026-10-13 17:03 ` Herve Codina
2026-10-16 5:18 ` David Gibson
2026-10-19 13:11 ` Herve Codina
2026-10-21 2:26 ` David Gibson
2026-10-21 13:59 ` Herve Codina
2026-10-21 15:20 ` Herve Codina
2026-10-22 3:17 ` David Gibson [this message]
2026-10-13 17:04 ` Ayush Singh
2026-10-13 17:23 ` Herve Codina
2026-10-13 19:49 ` Ayush Singh
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=atmASGg1OZt9jfXI@gractus.seuss \
--to=david@gibson.dropbear.id.au \
--cc=Frank.Li@nxp.com \
--cc=ayush@beagleboard.org \
--cc=conor+dt@kernel.org \
--cc=devicetree-compiler@vger.kernel.org \
--cc=devicetree-spec@vger.kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=geert@linux-m68k.org \
--cc=herve.codina@bootlin.com \
--cc=hui.pu@gehealthcare.com \
--cc=ian.ray@gehealthcare.com \
--cc=krzk@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.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
all inboxes | Powered by JetHome®