From: David Gibson <david@gibson.dropbear.id.au> To: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Cc: Frank Rowand <frowand.list@gmail.com>, Rob Herring <robherring2@gmail.com>, Grant Likely <grant.likely@secretlab.ca>, Tom Rini <trini@konsulko.com>, Franklin S Cooper Jr <fcooper@ti.com>, Matt Porter <mporter@konsulko.com>, Simon Glass <sjg@chromium.org>, Phil Elwell <philip.j.elwell@gmail.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Marek Vasut <marex@denx.de>, Devicetree Compiler <devicetree-compiler@vger.kernel.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: Re: [RFC] yamldt v0.5, now a DTS compiler too Date: Wed, 11 Oct 2017 14:49:51 +1100 [thread overview] Message-ID: <20171011034951.GD10496@umbus.fritz.box> (raw) In-Reply-To: <04D49C2F-9AB8-4007-AE30-7A80980220F0@konsulko.com> [-- Attachment #1: Type: text/plain, Size: 5768 bytes --] On Tue, Oct 10, 2017 at 06:19:03PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 10, 2017, at 04:50 , David Gibson <david@gibson.dropbear.id.au> wrote: > > > > On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > >> Hi David, > >> > >>> On Oct 9, 2017, at 03:00 , David Gibson <david@gibson.dropbear.id.au> wrote: > >>> > >>> On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: > >>>> On 10/07/17 03:23, Pantelis Antoniou wrote: > >>>>> Hi Rob, > >>>>> > >>>>>> On Oct 6, 2017, at 16:55 , Rob Herring <robherring2@gmail.com> wrote: > >>>>>> > >>>>>> On Tue, Oct 3, 2017 at 12:39 PM, Pantelis Antoniou > >>>>>> <pantelis.antoniou@konsulko.com> wrote: > >>>>>>> Hi Rob, > >>>> > >>>> < snip > > >>>> > >>>>>>> eBPF is portable, can be serialized after compiling in the schema file > >>>>>>> and can be executed in the kernel. > >>>>>> > >>>>>> Executing in the kernel is a non-goal for me. > >>>> > >>>> Executing in the kernel is an anti-goal for me. > >>>> > >>>> We are trying to reduce the device tree footprint inside the kernel, > >>>> not increase it. > >>>> > >>>> 99.99% of the validation should be possible statically, in the compile > >>>> phase. > >>>> > >>>> > >>>>>>> By stripping out all documentation related properties and nodes keeping > >>>>>>> only the compiled filters you can generate a dtb blob that passed to > >>>>>>> kernel can be used for verification of all runtime changes in the > >>>>>>> kernel's live tree. eBPF is enforcing an execution model that is 'safe' > >>>>>>> so we can be sure that no foul play is possible. > >>>> > >>>> Run time changes can be assumed correct (short of bugs in the overlay > >>>> application code), if the base tree is validated, the overlay is validated, > >>>> and the interface between the live tree and the overlay is a > >>>> connector. > >>> > >>> In addition, no amount of schema validation can really protect the > >>> kernel from a bad DT. Even if the schemas can 100% verify that the DT > >>> is "syntactically" correct, which is ambitious, it can't protect > >>> against a DT which is in the right form, but contains information that > >>> is simply wrong for the hardware in question. That can stuff the > >>> kernel at least as easily as an incorrectly formatted DT. > >>> > >> > >> I disagree. > >> > >> There are multiple levels of validation. For now we’re only talking about > >> binding validation. There can be SoC level validation, board level validation, > >> revision level validation and finally application specific validation. > >> > >> Binding validation is making sure properties/nodes follow the binding document. > >> For instance that for a foo device there’s a mandatory interrupt property. > >> > >> Simplified > >> > >> interrupt = <X>; > >> > >> Binding validation would ‘catch’ errors like assigning a string or not having the > >> interrupt property available. > >> > >> SoC level validation would list the available interrupt number that a given > >> SoC would support for that device. > >> > >> For example that interrupt can only take the values 10 or 99 in a given SoC. > >> > >> Board level validation would narrow this down even further to a value of 10 for > >> a given board model. > > > >> Similar revision level validation would place further restriction on the allowed > >> configuration. > >> > >> Finally application specific validation could place restriction based on the intended > >> application that piece of hardware is used for. For instance devices that should not > >> exceed a given power budget would have restrictions on the clock frequency of the processor > >> or bus frequencies etc. > > > > This doesn't help. In order to do this, the validator would need > > information that's essentially equivalent to the content of DT, at > > which point there's no point to the DT at all - and you're left with > > the problem of validating the information that the validator has. > > That would be the case if hardware IP only has a single way to be configured. Right, and if if there's more than one way, then the validator can't possibly tell whether the DT has the right one. DTs must always come from a trusted source, because if they don't, then you don't need the DT in the first place (you could build your own). > The industry standard nowadays is picking reusable IP blocks and integrating them > together in an SoC. The driver and the binding is common for every platform that uses > that block, but the allowed configuration varies according to what the hardware > people uses in a given instance. > > Fundamentally a validator that's useful *cannot* tell the difference > > between a correct tree and one which _could_ be correct for some > > theoretical hardware, but isn't for this particular hardware. > > That’s why there’s reason for a nested hierarchy of bindings IMO. Nothing about how you structure the validation can change the basic fact that there are only two possibilities. Either: a) You know the hardware structure independent of the DT, in which case the DT is pointless or b) You don't know everything about the hardware without the DT, in which case you can't know if the DT is right for this hardware > Completeness of validation schemes can be a differentiating factor when > choosing parts for hardware design. They would sure cut down development time. > > > > Regards > > — Pantelis > -- 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 --]
WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> To: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> Cc: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>, Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>, Franklin S Cooper Jr <fcooper-l0cyMroinI0@public.gmane.org>, Matt Porter <mporter-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>, Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>, Phil Elwell <philip.j.elwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>, Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>, Devicetree Compiler <devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> Subject: Re: [RFC] yamldt v0.5, now a DTS compiler too Date: Wed, 11 Oct 2017 14:49:51 +1100 [thread overview] Message-ID: <20171011034951.GD10496@umbus.fritz.box> (raw) In-Reply-To: <04D49C2F-9AB8-4007-AE30-7A80980220F0-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> [-- Attachment #1: Type: text/plain, Size: 5881 bytes --] On Tue, Oct 10, 2017 at 06:19:03PM +0300, Pantelis Antoniou wrote: > Hi David, > > > On Oct 10, 2017, at 04:50 , David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote: > > > > On Mon, Oct 09, 2017 at 06:07:28PM +0300, Pantelis Antoniou wrote: > >> Hi David, > >> > >>> On Oct 9, 2017, at 03:00 , David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote: > >>> > >>> On Sun, Oct 08, 2017 at 04:08:03PM -0700, Frank Rowand wrote: > >>>> On 10/07/17 03:23, Pantelis Antoniou wrote: > >>>>> Hi Rob, > >>>>> > >>>>>> On Oct 6, 2017, at 16:55 , Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>>>>> > >>>>>> On Tue, Oct 3, 2017 at 12:39 PM, Pantelis Antoniou > >>>>>> <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> wrote: > >>>>>>> Hi Rob, > >>>> > >>>> < snip > > >>>> > >>>>>>> eBPF is portable, can be serialized after compiling in the schema file > >>>>>>> and can be executed in the kernel. > >>>>>> > >>>>>> Executing in the kernel is a non-goal for me. > >>>> > >>>> Executing in the kernel is an anti-goal for me. > >>>> > >>>> We are trying to reduce the device tree footprint inside the kernel, > >>>> not increase it. > >>>> > >>>> 99.99% of the validation should be possible statically, in the compile > >>>> phase. > >>>> > >>>> > >>>>>>> By stripping out all documentation related properties and nodes keeping > >>>>>>> only the compiled filters you can generate a dtb blob that passed to > >>>>>>> kernel can be used for verification of all runtime changes in the > >>>>>>> kernel's live tree. eBPF is enforcing an execution model that is 'safe' > >>>>>>> so we can be sure that no foul play is possible. > >>>> > >>>> Run time changes can be assumed correct (short of bugs in the overlay > >>>> application code), if the base tree is validated, the overlay is validated, > >>>> and the interface between the live tree and the overlay is a > >>>> connector. > >>> > >>> In addition, no amount of schema validation can really protect the > >>> kernel from a bad DT. Even if the schemas can 100% verify that the DT > >>> is "syntactically" correct, which is ambitious, it can't protect > >>> against a DT which is in the right form, but contains information that > >>> is simply wrong for the hardware in question. That can stuff the > >>> kernel at least as easily as an incorrectly formatted DT. > >>> > >> > >> I disagree. > >> > >> There are multiple levels of validation. For now we’re only talking about > >> binding validation. There can be SoC level validation, board level validation, > >> revision level validation and finally application specific validation. > >> > >> Binding validation is making sure properties/nodes follow the binding document. > >> For instance that for a foo device there’s a mandatory interrupt property. > >> > >> Simplified > >> > >> interrupt = <X>; > >> > >> Binding validation would ‘catch’ errors like assigning a string or not having the > >> interrupt property available. > >> > >> SoC level validation would list the available interrupt number that a given > >> SoC would support for that device. > >> > >> For example that interrupt can only take the values 10 or 99 in a given SoC. > >> > >> Board level validation would narrow this down even further to a value of 10 for > >> a given board model. > > > >> Similar revision level validation would place further restriction on the allowed > >> configuration. > >> > >> Finally application specific validation could place restriction based on the intended > >> application that piece of hardware is used for. For instance devices that should not > >> exceed a given power budget would have restrictions on the clock frequency of the processor > >> or bus frequencies etc. > > > > This doesn't help. In order to do this, the validator would need > > information that's essentially equivalent to the content of DT, at > > which point there's no point to the DT at all - and you're left with > > the problem of validating the information that the validator has. > > That would be the case if hardware IP only has a single way to be configured. Right, and if if there's more than one way, then the validator can't possibly tell whether the DT has the right one. DTs must always come from a trusted source, because if they don't, then you don't need the DT in the first place (you could build your own). > The industry standard nowadays is picking reusable IP blocks and integrating them > together in an SoC. The driver and the binding is common for every platform that uses > that block, but the allowed configuration varies according to what the hardware > people uses in a given instance. > > Fundamentally a validator that's useful *cannot* tell the difference > > between a correct tree and one which _could_ be correct for some > > theoretical hardware, but isn't for this particular hardware. > > That’s why there’s reason for a nested hierarchy of bindings IMO. Nothing about how you structure the validation can change the basic fact that there are only two possibilities. Either: a) You know the hardware structure independent of the DT, in which case the DT is pointless or b) You don't know everything about the hardware without the DT, in which case you can't know if the DT is right for this hardware > Completeness of validation schemes can be a differentiating factor when > choosing parts for hardware design. They would sure cut down development time. > > > > Regards > > — Pantelis > -- 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 --]
next prev parent reply other threads:[~2017-10-11 3:49 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-09-28 19:58 [RFC] yamldt v0.5, now a DTS compiler too Pantelis Antoniou 2017-09-28 19:58 ` Pantelis Antoniou 2017-10-01 22:00 ` Rob Herring 2017-10-01 22:00 ` Rob Herring 2017-10-02 7:36 ` Pantelis Antoniou 2017-10-02 19:46 ` Pantelis Antoniou 2017-10-03 7:17 ` Geert Uytterhoeven 2017-10-03 7:33 ` Pantelis Antoniou 2017-10-03 13:18 ` Rob Herring 2017-10-03 14:13 ` Pantelis Antoniou 2017-10-03 14:13 ` Pantelis Antoniou 2017-10-03 17:13 ` Rob Herring 2017-10-03 17:39 ` Pantelis Antoniou 2017-10-03 17:39 ` Pantelis Antoniou 2017-10-06 13:55 ` Rob Herring 2017-10-06 13:55 ` Rob Herring 2017-10-07 10:23 ` Pantelis Antoniou 2017-10-08 23:08 ` Frank Rowand 2017-10-08 23:08 ` Frank Rowand 2017-10-09 0:00 ` David Gibson 2017-10-09 0:00 ` David Gibson 2017-10-09 15:07 ` Pantelis Antoniou 2017-10-09 15:07 ` Pantelis Antoniou 2017-10-10 1:50 ` David Gibson 2017-10-10 15:19 ` Pantelis Antoniou 2017-10-10 15:19 ` Pantelis Antoniou 2017-10-11 3:49 ` David Gibson [this message] 2017-10-11 3:49 ` David Gibson 2017-10-09 14:59 ` Pantelis Antoniou 2017-10-20 17:46 ` Grant Likely 2017-10-20 17:46 ` Grant Likely 2017-10-20 19:16 ` Pantelis Antoniou 2017-10-22 17:54 ` Grant Likely 2017-10-22 17:54 ` Grant Likely 2017-10-22 18:23 ` Pantelis Antoniou 2017-10-22 18:23 ` Pantelis Antoniou 2017-10-22 19:13 ` Grant Likely 2017-10-22 19:13 ` Grant Likely 2017-10-23 10:08 ` Pantelis Antoniou 2017-10-23 10:08 ` Pantelis Antoniou
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=20171011034951.GD10496@umbus.fritz.box \ --to=david@gibson.dropbear.id.au \ --cc=devicetree-compiler@vger.kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=fcooper@ti.com \ --cc=frowand.list@gmail.com \ --cc=geert@linux-m68k.org \ --cc=grant.likely@secretlab.ca \ --cc=linux-kernel@vger.kernel.org \ --cc=marex@denx.de \ --cc=mporter@konsulko.com \ --cc=pantelis.antoniou@konsulko.com \ --cc=philip.j.elwell@gmail.com \ --cc=robherring2@gmail.com \ --cc=sjg@chromium.org \ --cc=trini@konsulko.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.