lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5B16CB62-98C0-48C6-B50F-F06AA31CC20B@konsulko.com>
Date:   Wed, 16 Aug 2017 12:37:44 +0300
From:   Pantelis Antoniou <pantelis.antoniou@...sulko.com>
To:     Tom Rini <trini@...sulko.com>
Cc:     devicetree <devicetree@...r.kernel.org>,
        Tero Kristo <t-kristo@...com>, Nishanth Menon <nm@...com>,
        Tomi Valkeinen <tomi.valkeinen@...com>,
        Sekhar Nori <nsekhar@...com>, Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <mmarek@...e.com>,
        "linux-kernel @ vger . kernel . org" <linux-kernel@...r.kernel.org>,
        linux-kbuild@...r.kernel.org
Subject: Re: [PATCH] devicetree: Enable generation of __symbols__ in all dtb files

Hi Tom,

Sorry for taking a little bit of time to reply to this (vacation time).

> On Aug 16, 2017, at 00:15 , Tom Rini <trini@...sulko.com> wrote:
> 
> With support for stacked overlays being part of libfdt it is now
> possible and likely that overlays which require __symbols__ will be
> applied to the dtb files generated by the kernel.  This is done by
> passing -@ to dtc.  This does increase the filesize (and resident memory
> usage) based on the number of __symbol__ entries added to match the
> contents of the dts.
> 
> Cc: Rob Herring <robh+dt@...nel.org>
> Cc: Frank Rowand <frowand.list@...il.com>
> Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>
> Cc: Michal Marek <mmarek@...e.com>
> Cc: Pantelis Antoniou <pantelis.antoniou@...sulko.com>
> Cc: devicetree@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> CC: linux-kbuild@...r.kernel.org
> Signed-off-by: Tom Rini <trini@...sulko.com>
> ---
> In order for a dtb file to be useful with all types of overlays, it
> needs to be generated with the -@ flag passed to dtc so that __symbols__
> are generated.  This however is not free, and increases the resulting
> dtb file by up to approximately 50% today.  In the current worst case
> this is moving from 88KiB to 133KiB.  In talking with Frank about this,
> he outlined 3 possible ways (with the 4th option of something else
> entirely).
> 
> 1. Make passing -@ to dtc be dependent upon some CONFIG symbol.
> 2. In the kernel, if the kernel does not have overlay support, discard
> the __symbols__ information that we've been passed.
> 3. Have the bootloader pass in, or not, __symbols__ information.
> 
> This patch is an attempt to implement something between the 3rd option
> and a different, 4th option.  Frank was thinking that we might introduce
> a new symbol to control generation of __symbol__ information for option
> 1.  I think this gets the usage backwards and will lead to confusion
> among users and developers.
> 
> My proposal is that we do not want __symbols__ existence to be dependent
> on some part of the kernel configuration for a number of reasons.
> First, this is out of step with the rest of how dtbs are created today
> and more importantly, thought about.  Today, all dtb content is
> independent of CONFIG options.  If you build a dtb from a given kernel
> tree, everyone will agree on the result.  This is part of the "contract"
> on passing old kernels and new dtb files even.
> 
> Second, I think this is out of step with how a lot of overlay usage will
> occur.  My thinking is that with maximally useful overlays being
> available in mainline, lots of use-cases that we have today that result
> in a number of DTS files being included can become just overlays.  This
> is true in terms of not only evaluation kits but also when these systems
> are turned into custom hardware.  This is even more true for SoM based
> systems where a physical widget would be a SoM + carrier overlay +
> custom parts overlay.  These cases are going to be resolved with
> overlays being applied outside of the kernel.
> 

FWIW here are some thoughts of mine on this subject.

First, the whole business with the __symbols__ (& the fixup nodes) is meant
to be used as a method to pass along symbol information, inband with the DTB
in such a way as it would require absolutely no changes to booloaders and
the kernel unflattening methods with the downside of the increased memory
consumption.

That said, there’s no reason to keep the __symbols__ node as part of the
in kernel device tree structure after loading. In fact operations would be
much easier if that would be the case. That would go hand in hand with the
a previously posted patch that turns phandle lookups into hash/idr lookups.

I would think that whether overlays would be supported could be a board level
option, but I would hate for overlay support to be dependent on a kernel config
option. Yes, this is contradictory, I know :(. The problem is that if you don’t
have symbols generated at compile time of the kernel DTB you’re SOL loading an
overlay later. I was thinking of a patch that would allow ‘patching in’ the
symbols of an kernel at runtime, when that would be required (using a kernel
module containing that symbol information).

Finally Tom is absolutely correct; the way that system design for EVM+SoM is
done leads naturally to thinking in ‘overlay’ terms. So instead of the all
the different DTBs for different variants of boards we could have the .DTSIs
compiled as overlays and then the final DTB reconstructed at boot time (whether
by the bootloader or the kernel).

Regards

— Pantelis


> Signed-off-by: Tom Rini <trini@...sulko.com>
> ---
> drivers/of/unittest-data/Makefile | 5 -----
> scripts/Makefile.lib              | 3 +++
> 2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
> index 6e00a9c69e58..70731cfe8900 100644
> --- a/drivers/of/unittest-data/Makefile
> +++ b/drivers/of/unittest-data/Makefile
> @@ -11,8 +11,3 @@ targets += overlay_base.dtb overlay_base.dtb.S
> .PRECIOUS: \
> 	$(obj)/%.dtb.S \
> 	$(obj)/%.dtb
> -
> -# enable creation of __symbols__ node
> -DTC_FLAGS_overlay := -@
> -DTC_FLAGS_overlay_bad_phandle := -@
> -DTC_FLAGS_overlay_base := -@
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 58c05e5d9870..a1f4a6b29d75 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -293,6 +293,9 @@ DTC_FLAGS += -Wnode_name_chars_strict \
> 	-Wproperty_name_chars_strict
> endif
> 
> +# enable creation of __symbols__ node
> +DTC_FLAGS += -@
> +
> DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
> 
> # Generate an assembly file to wrap the output of the device tree compiler
> -- 
> 1.9.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ