linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	"jonsmirl@gmail.com" <jonsmirl@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"ksummit-2013-discuss@lists.linuxfoundation.org" 
	<ksummit-2013-discuss@lists.linuxfoundation.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Ian Campbell <ian.campbell@citrix.com>,
	Pawel Moll <Pawel.Moll@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	Domenico Andreoli <cavokz@gmail.com>,
	Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	Dave P Martin <Dave.Martin@arm.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [Ksummit-2013-discuss] DT bindings as ABI [was: Do we have people interested in device tree janitoring / cleanup?]
Date: Tue, 30 Jul 2013 11:44:53 +1000	[thread overview]
Message-ID: <20130730014453.GJ29970@voom.fritz.box> (raw)
In-Reply-To: <1374988276.1973.29.camel@dabdike>

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

On Sat, Jul 27, 2013 at 10:11:16PM -0700, James Bottomley wrote:
> On Sat, 2013-07-27 at 21:28 -0600, Grant Likely wrote:
> > On Sat, Jul 27, 2013 at 2:25 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> > > On Sat, Jul 27, 2013 at 2:01 PM, jonsmirl@gmail.com <jonsmirl@gmail.com> wrote:
> > >> On Sat, Jul 27, 2013 at 3:45 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> > >>> On Sat, Jul 27, 2013 at 4:59 AM, Arend van Spriel <arend@broadcom.com> wrote:
> > >>>> Let's see how many people go and scream if I say this: Too bad .dts files
> > >>>> are not done using XML format as DT bindings could be described using XML
> > >>>> Schema.
> > >>>
> > >>> Draft an example and show us how it would look!  :-)  There is
> > >>> absolutely nothing preventing us from expressing a DT in XML format,
> > >>> or even using XSLT to define DT schema while still using our current
> > >>> .dts syntax. It would be trivial to do lossless translation between
> > >>> .dts syntax and xml.
> > >>>
> > >>> The problem that I have with XML and XSLT is that it is very verbose
> > >>> and not entirely friendly to mere-mortals. However, I'm more than
> > >>> willing to be proved wrong on this point.
> > >>
> > >> I considered this approach a while ago and discarded it. It would work
> > >> but it is just too much of a Frankenstein monster.
> > >>
> > >> Much cleaner to modify dtc to take a schema as part of the compilation
> > >> process. The schema language itself has no requirement to look like
> > >> DTS syntax. Whoever wrote dtc probably has a favorite language that
> > >> would be good for writing schemas in.
> > >
> > > Making it part of dtc is a required feature as far as I'm concerned.
> > > Using XML/XSLT and dtc-integration are not mutually exclusive, but I
> > > digress.
> > 
> > Oops, ignore the XSLT bit. XSLT isn't schema and has no bearing on the
> > discussion of schema. Sorry for the noise.
> 
> XSLT is a transform language ... you'd use it say to transform xml to
> dtc, so it would be an integral component of an xml/xslt based schema.
> 
> If you want actually to describe and have validated the xml schema
> itself, then you'd use xsd (XML schema description language) and its
> associated tools.
> 
> I'm not saying you *should* do this, just that it's possible (plus I've
> just blown my kernel cred by knowing about xml, sigh).

Heh.  So, it was said in jest, but that actually raises an important
point.

There are basically two criteria to keep in mind for our
representation of schemas:
   1) Adequate expressiveness to validate a sufficiently large part,
of a sufficiently large number of bindings to be useful.
   2) Ease of use and ease of learning **for the target audience**.

To the best of my knowledge xsd would do well on (1), but I'm not
convinced it does very well on (2).  In an environment where XML was
already widely used, XSD would make perfect sense.  Here, I think it
would be pretty ugly to wire onto the existing DT tools and
infrastructure, and unpleasantly unfamiliar for many kernel and board
developers trying to work with DT schemas.


So, by way of investigation, let me propose an alternative expression
of schemas, that I'm also not convinced we should do, but is possible
and expressive.  It's illustrative, because it's kind of the polar
opposite approach to XSD: just use C.

dtc already has a (so far limited) "checks" mechanism which verifies
various aspects of DT content.  These are implemented by C functions
in checks.c.  There's obviously ample expressiveness - you can express
any constraint you want that way.  It can be pretty verbose, and
fiddly.  A good library of helper functions can mitigate that, but
it's not clear how much.  On the other hand, a very good fraction of
people working with this will already be familiar with C, which is a
big plus.  This is, after all, the reason that the dts syntax is
chiefly C inspired.

Now, in practice, I think we will want a more convenient schema
language (just as we wanted dts, rather than manually constructing
FDTs as C structures).  But I absolutely do think, that the schema
handling should be handled as plugins to the checks mechanism -
basically we'd have a validate_schemas() check function.

I also think we should consider the option of having a simple and
straightforward schema language which handles, say, 80% of cases with
a fall back to C for the 20% of curly cases.  That might actually be
simpler to work with in practice than a schema language which can
express absolutely anything, at the cost of being awkward for simple
cases or difficult to get your head around.

Remember, a schema language is only a win if it is - for the target
audience - more convenient to express schemas in than C.

-- 
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: Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2013-07-30  1:48 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 16:09 DT bindings as ABI [was: Do we have people interested in device tree janitoring / cleanup?] Olof Johansson
2013-07-25 17:57 ` Mark Rutland
2013-07-25 18:05   ` Stephen Warren
2013-07-25 18:25     ` Olof Johansson
2013-07-25 18:50       ` Stephen Warren
2013-07-25 19:30       ` [Ksummit-2013-discuss] " Mark Brown
2013-07-25 18:29     ` Mark Rutland
2013-07-25 18:48       ` Richard Cochran
2013-07-25 18:53         ` Stephen Warren
2013-07-25 21:41           ` Domenico Andreoli
2013-07-26  4:43           ` Richard Cochran
2013-07-25 21:37         ` Jason Gunthorpe
2013-07-26  4:54           ` Richard Cochran
2013-07-26 13:42             ` Rob Herring
2013-07-26 17:15             ` Jason Gunthorpe
2013-07-27  8:48               ` Richard Cochran
2013-07-27 10:40                 ` [Ksummit-2013-discuss] " Mark Brown
2013-07-27 17:37                   ` Richard Cochran
2013-07-27 17:57                     ` David Lang
2013-07-27 18:17                       ` Richard Cochran
2013-07-28 11:27                     ` Mark Brown
2013-07-29 17:54                 ` Jason Gunthorpe
2013-07-29 18:16                   ` Russell King - ARM Linux
2013-07-29 18:40                     ` Jason Gunthorpe
2013-07-27  8:53               ` Richard Cochran
2013-07-27 10:20                 ` Tomasz Figa
2013-07-27 11:36                 ` [Ksummit-2013-discuss] " Mark Brown
2013-07-27 18:07                   ` Richard Cochran
2013-07-28 12:10                     ` Mark Brown
2013-07-26  8:01           ` Richard Cochran
2013-07-26  9:42             ` [Ksummit-2013-discuss] " David Woodhouse
2013-07-26 13:09               ` Richard Cochran
2013-07-26 13:14                 ` Russell King - ARM Linux
2013-07-27 15:28                   ` David Gibson
2013-07-26 13:27                 ` Jason Cooper
2013-07-26 13:38                   ` Russell King - ARM Linux
2013-07-26 13:45                     ` Jason Cooper
2013-07-26 13:50                       ` David Woodhouse
2013-07-26 13:59                         ` Jason Cooper
2013-07-26 13:41                   ` David Woodhouse
2013-07-26 13:47                     ` Jason Cooper
2013-07-26 14:14                     ` jonsmirl
2013-07-26 14:16                       ` David Woodhouse
2013-07-26 14:21                       ` Russell King - ARM Linux
2013-07-26 14:39                         ` jonsmirl
2013-07-26 14:40                         ` Mark Brown
2013-07-29 15:32                           ` Matt Porter
2013-07-27 15:19                         ` David Gibson
2013-07-27 19:37                         ` Grant Likely
2013-07-27  9:16                       ` Ming Lei
2013-07-26 14:10                 ` Mark Brown
2013-07-26 15:49                   ` Olof Johansson
2013-07-26 16:36                     ` Rob Herring
2013-07-27  4:57                       ` Richard Cochran
2013-07-27  5:04                     ` Richard Cochran
2013-07-27  9:51                       ` Tomasz Figa
2013-07-27 10:24                         ` Arend van Spriel
2013-07-27 10:34                           ` Arend van Spriel
2013-07-27 11:09                             ` Russell King - ARM Linux
2013-07-27 10:36                           ` Tomasz Figa
2013-07-27 10:59                             ` Arend van Spriel
2013-07-27 19:45                               ` Grant Likely
2013-07-27 20:01                                 ` jonsmirl
2013-07-27 20:03                                   ` David Woodhouse
2013-07-27 20:25                                   ` Grant Likely
2013-07-28  3:28                                     ` Grant Likely
2013-07-28  5:11                                       ` James Bottomley
2013-07-28  5:13                                         ` Grant Likely
2013-07-30  1:44                                         ` David Gibson [this message]
2013-07-30  2:15                                           ` jonsmirl
2013-07-30  3:29                                             ` David Gibson
2013-07-30  4:35                                               ` Grant Likely
2013-07-30  8:39                                                 ` Maxime Ripard
2013-07-30 16:30                                             ` Stephen Warren
2013-07-30 17:27                                               ` John W. Linville
2013-07-30 16:40                                           ` Stephen Warren
2013-07-29  9:19                                   ` Arend van Spriel
2013-07-29 10:16                                     ` Arend van Spriel
2013-07-27 18:31                           ` Richard Cochran
2013-07-27 18:51                             ` Tomasz Figa
2013-07-27 19:22                               ` jonsmirl
2013-07-28  8:56                               ` Richard Cochran
2013-07-28  9:12                                 ` Tomasz Figa
2013-07-28 13:19                                   ` Richard Cochran
2013-07-28 13:39                                     ` Tomasz Figa
2013-07-28 14:09                                       ` jonsmirl
2013-07-28 15:35                                         ` Richard Cochran
2013-07-28 15:50                                           ` jonsmirl
2013-07-28 17:41                                             ` Mark Brown
2013-07-28 21:46                                           ` David Gibson
2013-07-28 15:30                                       ` Richard Cochran
2013-07-29  7:31                                     ` Maxime Ripard
2013-07-29 18:38                                       ` Richard Cochran
2013-07-29 18:51                                         ` Richard Cochran
2013-07-29 18:05                               ` Jason Gunthorpe
2013-07-29 18:27                                 ` Russell King - ARM Linux
2013-07-29 22:20                                 ` David Gibson
2013-07-29 23:14                                   ` Jason Gunthorpe
2013-07-29 23:49                                     ` David Gibson
2013-07-31 10:37                               ` Maxime Bizon
2013-07-31 10:59                                 ` Tomasz Figa
2013-07-31 15:07                                   ` Richard Cochran
2013-07-31 15:23                                     ` Tomasz Figa
2013-07-31 19:12                                       ` Richard Cochran
2013-07-31 19:29                                         ` Tomasz Figa
2013-07-31 20:00                                           ` Richard Cochran
2013-07-31 20:14                                             ` Russell King - ARM Linux
2013-07-31 20:37                                               ` jonsmirl
2013-07-31 20:48                                                 ` Russell King - ARM Linux
2013-07-31 21:26                                                   ` jonsmirl
2013-08-01  9:57                                                     ` Arend van Spriel
2013-08-01 10:09                                                       ` Mark Brown
2013-08-01 10:18                                                     ` David Woodhouse
2013-08-01 13:34                                                       ` jonsmirl
2013-08-01 13:43                                                         ` jonsmirl
2013-08-01 13:48                                                       ` Rob Herring
2013-08-02  3:50                                                     ` David Gibson
2013-08-13 23:32                                                       ` H. Peter Anvin
2013-08-14  1:49                                                         ` Guenter Roeck
2013-08-14 14:46                                                           ` H. Peter Anvin
2013-08-02  8:49                                               ` Tony Lindgren
2013-07-29 15:45                     ` Matt Porter
2013-07-31 12:58   ` Ian Campbell
2013-07-25 17:59 ` Stephen Warren
2013-07-25 19:11 ` Rob Herring
2013-07-25 19:31   ` Jason Cooper
2013-07-25 20:04     ` [Ksummit-2013-discuss] " Mark Brown
2013-07-25 20:08       ` Jason Cooper
2013-07-25 20:16     ` Rob Herring
2013-07-25 20:32       ` Jason Cooper
2013-07-25 21:53         ` [Ksummit-2013-discuss] " Ben Hutchings
2013-07-26  0:36           ` Stephen Warren
2013-07-26 12:14           ` Jason Cooper
2013-07-26  0:34       ` Stephen Warren
2013-07-26 22:11         ` Rob Herring
2013-07-25 23:18     ` Russell King - ARM Linux
2013-07-26  0:27       ` jonsmirl
2013-07-26 11:38         ` Jason Cooper
2013-07-26 14:08           ` [Ksummit-2013-discuss] " David Woodhouse
2013-07-26 13:57       ` Mark Brown
2013-07-26 10:55   ` Mark Brown
2013-07-28  4:39 ` Grant Likely

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=20130730014453.GJ29970@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=Dave.Martin@arm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Pawel.Moll@arm.com \
    --cc=cavokz@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@secretlab.ca \
    --cc=ian.campbell@citrix.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=jonsmirl@gmail.com \
    --cc=ksummit-2013-discuss@lists.linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=richardcochran@gmail.com \
    --cc=rob.herring@calxeda.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tomasz.figa@gmail.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).