devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Kyle Evans <kevans-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
Cc: Frank Rowand
	<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jon Loeliger <jdl-CYoMK+44s/E@public.gmane.org>,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/2] overlays: auto allocate phandles for nodes in base fdt
Date: Wed, 17 Jan 2018 10:38:48 +1100	[thread overview]
Message-ID: <20180116233848.GS30352@umbus.fritz.box> (raw)
In-Reply-To: <CACNAnaEWNAXMFReZxQGJn2uyUvx_c0GuLWCo4h53bZOt7Fhvrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6873 bytes --]

On Tue, Jan 16, 2018 at 09:24:44AM -0600, Kyle Evans wrote:
> On Tue, Jan 16, 2018 at 8:05 AM, David Gibson
> <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> > On Fri, Jan 05, 2018 at 06:47:46PM -0600, Kyle Evans wrote:
> >> On Fri, Jan 5, 2018 at 3:22 PM, Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> > On 01/05/18 13:04, Kyle Evans wrote:
> >> >> On Fri, Jan 5, 2018 at 2:40 PM, Frank Rowand <frowand.list-Re5JQEeQqe8@public.gmane.orgm> wrote:
> >> >>> On 01/04/18 21:47, Kyle Evans wrote:
> >> >>>> On Thu, Jan 4, 2018 at 11:02 PM, Frank Rowand <frowand.list@gmail.com> wrote:
> > [snip]
> >> > Yes, so not a base overlay that has not been compiled by the dtc (in
> >> > this project) with the "-@" flag specified.  Either the __symbols__
> >> > node was hand coded, or a compiler other than dtc was used, which
> >> > chooses to not create a phandle property for a node whose label
> >> > is not de-referenced in the same source file.
> >>
> >> My understanding was that libfdt was not necessarily supposed to be so
> >> tightly coupled to this dtc that it would make such assumptions when
> >> it's otherwise not a malformed blob. Ditto for the comment below about
> >> the use case being described in the patch- I had goofed and not
> >> checked that this particular dtc implementation does it differently,
> >> but I also was of the belief that libfdt was only supposed to be
> >> loosely coupled to the dtc implementation in this same repository.
> >>
> >> Of course, I can't recall/find what I had looked at that gave me this
> >> impression. =)
> >>
> >> > This use case should have been clearly described in the patch
> >> > description.  And David can then choose to accept or reject the
> >> > patch as he sees fit.  I clearly think it is a bad idea, but
> >> > David will either agree or disagree with my opinion.
> >
> > Sorry I've taken so long to reply to all these, I've been super busy.
> >
> >> David: If I may, I would appreciate if you would re-re-consider this
> >> patch set on the following basis:
> >>
> >> 1.) For base blobs compiled by your dtc, this is a no-op. The latest
> >> version does entail one extra tree walk at the beginning of applying
> >> /__fixups__ even if all phandles are assigned, but I've since realized
> >> this could be moved further down to a tree walk the first time it has
> >> to assign a phandle so that it really is a no-op for blobs compiled by
> >> your compiler.
> >>
> >> 2.) For other base blobs, you have compatibility. As of right now, how
> >> phandles are assigned in a base blob is an implementation detail,
> >> given that there is no clear spec on this. You gain nothing from
> >> remaining strict on this, and you lose compatibility with blobs that
> >> aren't blatantly invalid that libfdt can't control as well as
> >> potential (other) users of your library that may value this. Of
> >> course, you wouldn't lose us as users, we'd adapt.
> >>
> >> I consider this one to be fairly important. We had to implement
> >> reading of older formats (see nathanw@'s recent patch to this effect)
> >> because we can't control what we're given in all cases. I fully expect
> >> that even if I'm asked to drop this and we adapt our dtc, we'll
> >> eventually run into a case where this is needed because of
> >> vendor-provided DTS via EFI.
> >>
> >> 3.) There's nothing inherently wrong with what I've done in this
> >> patch, I've just supplemented the arbitrary assignment of phandles by
> >> dtc with arbitrary assignment of phandles by libfdt. There is no
> >> change to how the referenced node is looked up or generated, and this
> >> has no bearing on how anything is actually written.
> >
> > Note that the comments I've made elsewhere in the thread about not
> > having seem strong arguments for your position were written before I
> > got to reading this mail.
> >
> > You've got a reasonably compelling case above - let me mull on it a
> > while.
> >
> >> As an aside, IMO, phandles assigned to nodes are pointless once you
> >> have a symbol table to reference; just a nice thing to have so you
> >> don't *have* to take the performance hit at runtime to assign them.
> >
> > I'm really not sure what you're getting at here.  phandles are a
> > fundamental structural element of device trees going back to the year
> > dot, symbols really can't make them go away.  In particular you can't
> > easily determine if the phandle on a given node is necessary - doing
> > so requires full understanding of *every* binding used anywhere in the
> > tree so that you can interpret every other property to see if they
> > reference the phandle.
> 
> Sorry, my wording is quite inconsistent here: the above should read
> "explicit phandles" as I say in some other e-mails.
> 
> From my perspective, this isn't a particularly hard problem to solve-
> dtc already has to read the entire DTS into its internal
> representation before writing it to another format. It already has
> some understanding of every binding used everywhere in the tree by the
> time it's done. Deferring explicit phandle assignment until after it's
> made a full pass over the DTS and knows what's been referenced
> elsewhere isn't too bad.

That doesn't follow.  dtc only operates more-or-less at the structural
level - it knows what the nodes are and what the properties are at
byte strings, but not how those byte strings are interpreted.  That
means it *doesn't* know about bindings, which tell you how to
interpret each property - whether it consists of addresses, strings,
phandles or whatever else.

dtc gets a *hint* about phandles, if you use the reference syntax, but
it's just a hint - and it's lost after the tree has passed through the
compiler once.

> 
> >> The labels you would otherwise be losing are now stored in the blob's
> >> symbol table, so references are not ambiguous as they would be in a
> >> normal blob compiled without -@.
> >
> > Not sure what you're getting at here.  References aren't _ambiguous_
> > without -@; they simply make no sense - what are you referencing.
> 
> Sorry, I've been dealing with a lot of "the labels match the unit
> name" nodes lately. You're right. =) The point here is that you can
> resolve these references in a DTS compiled with -@, with or without
> phandles being explicitly assigned. They don't offer that much value
> in this case, other than keeping the resolution of the references into
> the compiler.

I don't see what you mean by "keeping the resolution of the references
into the compiler".

-- 
David Gibson			| 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 --]

  parent reply	other threads:[~2018-01-16 23:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 20:15 [PATCH v2 1/2] overlays: auto allocate phandles for nodes in base fdt Kyle Evans
     [not found] ` <CACNAnaEGfaZ=s5x8pw2AHf+SQHLTCTGCedL+TxOKXbA=e=kj0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04 20:33   ` Frank Rowand
     [not found]     ` <9711cac8-2501-7d68-2fb3-1c3a952fa96a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-04 20:41       ` Kyle Evans
     [not found]         ` <CACNAnaHck=vyC8dYa0HeFzd=MryucvOUSyYvkJw68tBe_goxWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04 21:34           ` Kyle Evans
     [not found]             ` <CACNAnaG=kcaUFFH7Dh70o1x-=1WxgJJGE1s0zsTdLvdYCcviMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04 21:47               ` Kyle Evans
     [not found]                 ` <CACNAnaHa=OuCrzVegg=7AemS8x=ADFsDs88WQ0phM+TLuYcZJw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04 22:08                   ` Ian Lepore
     [not found]                     ` <1515103688.1759.29.camel-h+KGxgPPiopAfugRpC6u6w@public.gmane.org>
2018-01-05  3:53                       ` David Gibson
     [not found]                         ` <20180105035317.GJ24581-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-05  4:23                           ` Kyle Evans
     [not found]                             ` <CACNAnaEXyhHcxCPz7MYmKS=uh-QdxUDZx7dSuY2=fpzLO44SWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05 20:43                               ` Frank Rowand
2018-01-05  1:55                   ` Frank Rowand
     [not found]                     ` <fe1b36f1-9e38-0d32-6879-b9cd495afd12-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-05  2:39                       ` Kyle Evans
     [not found]                         ` <CACNAnaFX6D8xqPFpgGGP6n7OzA29gB1pjFUpmmNM9roJgpPrdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05  3:14                           ` Frank Rowand
     [not found]                             ` <41a2006b-9b54-d803-7a28-457091db6f42-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-05  3:50                               ` Kyle Evans
     [not found]                                 ` <CACNAnaGoZ+Ne6-d75q7bRokQ-Kr4iDr5kJAEXUybYvw2g2cbPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05  5:02                                   ` Frank Rowand
     [not found]                                     ` <5c11d86d-da33-ece5-3170-8fa0bbe5b546-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-05  5:47                                       ` Kyle Evans
     [not found]                                         ` <CACNAnaER1_EW0_HSWcViSiGPTqoLKkh-JF0UKLN1hAwzxhizvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05 20:40                                           ` Frank Rowand
     [not found]                                             ` <79ae4708-6a55-a6b6-7eaf-e473baa2c1ac-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-05 21:04                                               ` Kyle Evans
     [not found]                                                 ` <CACNAnaFHQSPz4c_hLtGdn+9K6fz9iAZ+wL0Z+Tmz_7+=CJfkOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05 21:22                                                   ` Frank Rowand
     [not found]                                                     ` <2a75a5f8-dba9-7ff2-4443-f1c2ffb374cc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-06  0:47                                                       ` Kyle Evans
     [not found]                                                         ` <CACNAnaFA7WHR1aDzX9qu=cbV48bDkdTDpR0x=bbARdOSmx7VOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-06  1:59                                                           ` Kyle Evans
     [not found]                                                             ` <CACNAnaE0AWtiTELCy07EVs2uGELU7Ber5cpg=O1TZjDsGdKPUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 14:07                                                               ` David Gibson
2018-01-16 14:05                                                           ` David Gibson
     [not found]                                                             ` <20180116140512.GO30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-16 15:24                                                               ` Kyle Evans
     [not found]                                                                 ` <CACNAnaEWNAXMFReZxQGJn2uyUvx_c0GuLWCo4h53bZOt7Fhvrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 23:38                                                                   ` David Gibson [this message]
2018-01-12  5:33                                               ` David Gibson
     [not found]                                                 ` <20180112053310.GL24770-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-12  7:07                                                   ` Frank Rowand
2018-01-12 15:57                                                   ` Kyle Evans
     [not found]                                                     ` <CACNAnaEWn4+hOREZ57-UNKRuypgght1C6_5oVkqhwmaj-1yGLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-12 16:24                                                       ` Kyle Evans
     [not found]                                                         ` <CACNAnaHL2q7kxNdete2L+ZNs7kDZY-g-Ly4bgYWfQsBy0R5KdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 13:34                                                           ` David Gibson
     [not found]                                                             ` <20180116133418.GL30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-16 15:37                                                               ` Kyle Evans
2018-01-16 13:30                                                       ` David Gibson
     [not found]                                                         ` <20180116133040.GK30352-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-16 15:32                                                           ` Kyle Evans
     [not found]                                                             ` <CACNAnaFfXLVCG0e7KHtvU3rboKJpwMYV-WPqFw+kSMQeMqHu+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 23:40                                                               ` David Gibson
2018-01-10  9:44                                       ` David Gibson
     [not found]                                         ` <20180110094431.GC24770-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-10 14:15                                           ` Kyle Evans
2018-01-10  9:38                                   ` David Gibson
2018-01-10  9:19                           ` David Gibson
2018-01-05  3:40           ` David Gibson
     [not found]             ` <20180105034057.GH24581-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-05  4:00               ` Kyle Evans
  -- strict thread matches above, loose matches on Subject: below --
2018-01-01  6:59 [PATCHv2 0/2] " kevans-HZy0K5TPuP5AfugRpC6u6w
     [not found] ` <20180101065945.65451-1-kevans-HZy0K5TPuP5AfugRpC6u6w@public.gmane.org>
2018-01-01  6:59   ` [PATCH v2 1/2] " kevans-HZy0K5TPuP5AfugRpC6u6w
     [not found]     ` <20180101065945.65451-2-kevans-HZy0K5TPuP5AfugRpC6u6w@public.gmane.org>
2018-01-03  5:42       ` David Gibson
     [not found]         ` <20180103054220.GP24581-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-03 14:04           ` Kyle Evans
     [not found]             ` <CACNAnaHW19kCE24KUpi2LFNUS94H2xajq6WWpi0NgY53FAymzw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-04  3:26               ` David Gibson
     [not found]                 ` <20180104032600.GA24581-K0bRW+63XPQe6aEkudXLsA@public.gmane.org>
2018-01-04 14:21                   ` Kyle Evans
     [not found]                     ` <CACNAnaHf6bQcJCkStCWy56cUYeXjZcO6TQfT2pCq=oBviDMckg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-05  3:39                       ` David Gibson
2018-01-04 20:11       ` Frank Rowand

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=20180116233848.GS30352@umbus.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jdl-CYoMK+44s/E@public.gmane.org \
    --cc=kevans-h+KGxgPPiopAfugRpC6u6w@public.gmane.org \
    /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).