From: david@gibson.dropbear.id.au (David Gibson)
To: linux-arm-kernel@lists.infradead.org
Subject: [Ksummit-2013-discuss] Defining schemas for Device Tree
Date: Tue, 30 Jul 2013 09:45:32 +1000 [thread overview]
Message-ID: <20130729234532.GH29970@voom.fritz.box> (raw)
In-Reply-To: <20130729224840.GZ29916@titan.lakedaemon.net>
On Mon, Jul 29, 2013 at 06:48:40PM -0400, Jason Cooper wrote:
> On Tue, Jul 30, 2013 at 08:29:20AM +1000, David Gibson wrote:
> > On Mon, Jul 29, 2013 at 01:23:39PM -0400, Jason Cooper wrote:
> > > On Mon, Jul 29, 2013 at 05:49:05PM +0100, Dave Martin wrote:
> > > > On Mon, Jul 29, 2013 at 11:01:24AM -0400, Jason Cooper wrote:
> > > > > On Mon, Jul 29, 2013 at 02:21:52AM +0200, Tomasz Figa wrote:
> > >
> > > > > > b) What information should be specified in schemas? What level of
> > > > > > granularity is required?
> > > > >
> > > > > One item I don't see in this list is node ordering. There's been some
> > > > > discussion lately on deferred probing (re boot times). If we were to
> > > > > intentionally declare that DT are parsed in the order written, then a
> > > > > lot of deferred probes could be avoided by moving eg the pinctrl node to
> > > > > near the top of the tree.
> > > > >
> > > > > This doesn't impact buses as much, since the nodes needing the bus are
> > > > > already children. However, anything accessed via phandles: pins,
> > > > > clocks, regulators, etc could benefit from declaring and enforcing this.
> > > > > Eg having the dtc warn when a phandle is used before it's corresponding
> > > > > node is declared.
> > > > >
> > > > > Not critical though, just a thought.
> > > >
> > > > I don't think that siblings have any defined order in DT. If reading a
> > > > device tree, there's no guarantee you get nodes or properties out in the
> > > > same order as the original .dts file.
> > >
> > > That's why I raised the point. If people think encoding initialization
> > > order in the DT is a good idea, then we should change the dtc so it
> > > compiles/decompiles in the same order.
> >
> > I've always considered the DT to be unordered, although the flattened
> > representation obviously has to have some order. It is much safer to
> > explicitly represent any required orderings with properties, rather
> > than to rely on the flattened tree order. I really don't think trying
> > to have dtc magically understand device initialization ordering in
> > this way is a good idea.
> >
> > Fwiw, dtc generally preserves order between input and output, with the
> > exception of the -s option, which sorts the subnodes of each node by
> > name (useful for dtdiff).
> >
> > > > Provided child/parent relationships are maintained and the set of nodes
> > > > and values is the same, I think completely rearranging a .dts file does
> > > > not change its meaning.
> > > >
> > > > "depends-on" relationships mostly have to come from the semantics of
> > > > the bindings themselves: for example, if a device is connected to some
> > > > clocks and regulators, the kernel may need to probe those first.
> > >
> > > true, the answer to this problem may be to create a depgraph of the
> > > nodes based on phandles and child status, then init. However, if the
> > > goal is to accelerate boot times, then that should not be calculated
> > > during each boot, especially since it doesn't likely change from boot to
> > > boot.
> > >
> > > Which means it would either go in the dtc (dts node ordering is
> > > irrelevant), or in the dts. I'm inclined to say dtc should do it, but I
> > > like the aesthetics of things being in the proper order in something I
> > > can read. After all, C requires functions to be declared before use,
> > > even though the compiler could figure it out.
> >
> > It's not necessarily possible to encode device initialization order in
> > flattened tree order. Suppose you have bus A with devices A1 and A2,
> > and bus B with devices B1 and B2. A1 must be initialized before B1,
> > but B2 must be initialized before A2. There are no loops there, it's
> > a valid set of initialization order constraints, but you can't get
> > both of them right in the flat tree ordering.
>
> True, but is there a real scenario where this is the case? In any
> event, this could still fall back to deferred probing.
I never count on weird and wonderful arrangements _not_ appearing in
embedded.
But, in regards to falling back do deferred probing. If you're
thinking of the fdt ordering as purely an optimization, rather than
_required_ to get device init correct, then that's a very different
matter. I have no problem with optimizing the ordering, as long as
its expected that the kernel will still be correct with arbitrary
ordering.
> As I think about it more, working with only what dtc can definitely see,
> eg busses and phandles, some ordering optimization could be done to
> reduce the number of probe deferrals.
Well. It depends what you mean here. To do this fully would require
dtc to interpret properties much more than it currently does - in
nearly all cases it treats them as opaque blobs, whereas many
different kinds of properties can potentially include phandles, and
you have to know how to parse them to discover them.
On the other hand, if what you're referring to is dtc's &-syntax for
phandle references, then I guess we could topsort on that. As long as
we bear in mind that that can miss cases, if people hand craft their
phandles, instead of using references.
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130730/04bf655e/attachment.sig>
next prev parent reply other threads:[~2013-07-29 23:45 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 0:21 Defining schemas for Device Tree Tomasz Figa
2013-07-29 1:30 ` jonsmirl at gmail.com
2013-07-29 8:27 ` David Woodhouse
2013-07-29 8:40 ` Tomasz Figa
2013-07-29 15:01 ` Jason Cooper
2013-07-29 16:49 ` Dave Martin
2013-07-29 17:11 ` Jason Gunthorpe
2013-07-29 17:23 ` [Ksummit-2013-discuss] " Jason Cooper
2013-07-29 17:29 ` Jason Gunthorpe
2013-07-29 19:48 ` Mark Brown
2013-07-29 22:29 ` David Gibson
2013-07-29 22:48 ` Jason Cooper
2013-07-29 23:45 ` David Gibson [this message]
2013-07-30 12:12 ` Jason Cooper
2013-07-30 0:41 ` David Lang
2013-07-30 0:49 ` jonsmirl at gmail.com
2013-07-30 1:50 ` David Gibson
2013-07-30 12:17 ` Jason Cooper
2013-07-29 18:15 ` Jason Gunthorpe
2013-07-29 22:26 ` Tomasz Figa
2013-07-29 21:47 ` Stephen Warren
2013-07-29 22:20 ` Tomasz Figa
2013-07-30 0:02 ` Stephen Warren
2013-07-29 22:23 ` jonsmirl at gmail.com
2013-07-29 22:45 ` Tomasz Figa
2013-07-30 0:30 ` jonsmirl at gmail.com
2013-07-30 10:25 ` Mark Brown
2013-07-30 13:14 ` jonsmirl at gmail.com
2013-07-30 17:19 ` Stephen Warren
2013-07-30 17:29 ` jonsmirl at gmail.com
2013-07-30 17:34 ` Stephen Warren
2013-07-30 17:45 ` jonsmirl at gmail.com
2013-07-30 17:49 ` Stephen Warren
2013-07-30 18:03 ` jonsmirl at gmail.com
2013-07-30 18:04 ` jonsmirl at gmail.com
2013-07-30 18:25 ` Stephen Warren
2013-07-30 18:28 ` jonsmirl at gmail.com
2013-07-31 7:01 ` Tony Lindgren
2013-08-01 20:04 ` Matt Sealey
2013-07-30 18:26 ` jonsmirl at gmail.com
2013-07-30 20:57 ` Mark Brown
2013-07-30 22:19 ` jonsmirl at gmail.com
2013-07-30 23:03 ` Mark Brown
2013-07-30 23:23 ` jonsmirl at gmail.com
2013-07-31 11:34 ` Mark Brown
2013-07-31 12:01 ` jonsmirl at gmail.com
2013-07-31 12:21 ` Tomasz Figa
2013-07-31 16:29 ` [Ksummit-2013-discuss] " Thomas Petazzoni
2013-07-31 16:41 ` Sascha Hauer
2013-07-31 16:59 ` Dave Martin
2013-07-31 18:59 ` Mark Brown
2013-08-01 14:29 ` Dave Martin
2013-07-31 19:57 ` Stephen Warren
2013-07-31 20:47 ` Stephen Warren
2013-07-31 23:04 ` Tomasz Figa
2013-07-30 22:16 ` Tomasz Figa
2013-07-30 22:26 ` Stephen Warren
2013-07-30 22:27 ` jonsmirl at gmail.com
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=20130729234532.GH29970@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=linux-arm-kernel@lists.infradead.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).