devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Tero Kristo <t-kristo-l0cyMroinI0@public.gmane.org>,
	Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>,
	Tomi Valkeinen <tomi.valkeinen-l0cyMroinI0@public.gmane.org>,
	Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Masahiro Yamada
	<yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>,
	Michal Marek <mmarek-IBi9RG/b67k@public.gmane.org>,
	Pantelis Antoniou
	<pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>,
	Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] devicetree: Enable generation of __symbols__ in all dtb files
Date: Tue, 15 Aug 2017 16:59:46 -0700	[thread overview]
Message-ID: <59938AF2.1040702@gmail.com> (raw)
In-Reply-To: <59938A6B.4050906-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On 08/15/17 16:57, Frank Rowand wrote:
> On 08/15/17 15:36, Rob Herring wrote:
>> On Tue, Aug 15, 2017 at 4:15 PM, Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> 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-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>>> Cc: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> Cc: Masahiro Yamada <yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
>>> Cc: Michal Marek <mmarek-IBi9RG/b67k@public.gmane.org>
>>> Cc: Pantelis Antoniou <pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>>> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> CC: linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Signed-off-by: Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>>> ---
>>> 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,
>>
>> Plus some amount for the unflattened tree in memory, too.
>>
>>> 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.
>>
>> Agree completely. I don't even like that building dtbs depends on the ARCH.
>>
>> However, option 2 may still be useful. There's no point exposing what
>> can't be used. Furthermore, exposing __symbols__ in /proc/device-tree
>> at all may be a bad idea. We should consider if it should always be
>> hidden. That would also allow storing the __symbols__ data however we
>> want internally (i.e. with less memory usage).
> 
> Yes.  I would prefer to treat the __symbols__ node as an internal
> representation of information used by the device tree subsystem.
> It is not hardware description.
> 
> 
>> The complication is
>> always kexec which I haven't thought about too much here.
> 
> That should not be an issue, because the device tree is exposed to kexec
> via /sys/firmware/fdt instead of /sys/firmware/devicetree/base (which
> is what /proc/device-tree links to), according to
> Documentation/ABI/testing/sysfs-firmware-ofw.  So the __symbols__
> node will be exposed to kexec.
> 
> 
>> Also, perhaps we need finer grain control of __symbols__ generation.
>> We really don't want userspace to be able to modify anything in the DT
>> at any point in time. That's a big can of worms and we don't want to
>> start there. The problem is labels are widely used just for
>> convenience and weren't part of the ABI. With overlays that changes,
>> so we either need to restrict labels usage or define another way. It
>> could be as simple as defining some prefix for label names for labels
>> to export.
> 
> Agreed.  We could also restrict labels in connector nodes to be visible.

                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I meant to say restrict visibility of labels, so that only labels in
connector nodes would be visible.

> 
> 
>>> 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.
>>>
>>> Signed-off-by: Tom Rini <trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org>
>>> ---
>>>  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
>>>
>> .
>>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-08-15 23:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 21:15 [PATCH] devicetree: Enable generation of __symbols__ in all dtb files Tom Rini
2017-08-15 22:36 ` Rob Herring
2017-08-15 22:49   ` Tom Rini
2017-08-16 15:43     ` Rob Herring
     [not found]       ` <CAL_JsqJv-UJzUvAXzTknAq-qko33pA0iyHjEpbe1AgEacP0Neg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-16 15:57         ` Tom Rini
2017-08-16 16:16           ` Rob Herring
     [not found]             ` <CAL_JsqJriAJWi0dxdtPBVVFv8GxFG1=U1aFvHAa5m-V2hg5hyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-16 18:10               ` Frank Rowand
2017-08-15 23:57   ` Frank Rowand
     [not found]     ` <59938A6B.4050906-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-15 23:59       ` Frank Rowand [this message]
2017-08-16  9:42       ` Pantelis Antoniou
2017-08-16 17:55         ` Frank Rowand
     [not found]   ` <CABGGiswpz6k4rnXk-3SLpwD5V8+zah-yaaB+yrrLofKY1eBx2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-16  0:14     ` Frank Rowand
2017-08-15 23:50 ` Frank Rowand
     [not found]   ` <599388D0.9050108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-16  0:42     ` Tom Rini
2017-08-16  3:22       ` Frank Rowand
2017-08-16 15:09         ` Tom Rini
2017-08-16 18:15           ` Frank Rowand
2017-08-16 15:22       ` Rob Herring
2017-08-16 15:41         ` Tom Rini
2017-08-16 16:00           ` Rob Herring
2017-08-16  0:18 ` Frank Rowand
2017-08-16  9:37 ` 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=59938AF2.1040702@gmail.com \
    --to=frowand.list-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mmarek-IBi9RG/b67k@public.gmane.org \
    --cc=nm-l0cyMroinI0@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=t-kristo-l0cyMroinI0@public.gmane.org \
    --cc=tomi.valkeinen-l0cyMroinI0@public.gmane.org \
    --cc=trini-OWPKS81ov/FWk0Htik3J/w@public.gmane.org \
    --cc=yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@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).