Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753406AbdHPAmn (ORCPT ); Tue, 15 Aug 2017 20:42:43 -0400 Received: from mail-yw0-f173.google.com ([209.85.161.173]:34381 "EHLO mail-yw0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753151AbdHPAml (ORCPT ); Tue, 15 Aug 2017 20:42:41 -0400 Date: Tue, 15 Aug 2017 20:42:38 -0400 From: Tom Rini To: Frank Rowand Cc: devicetree@vger.kernel.org, Tero Kristo , Nishanth Menon , Tomi Valkeinen , Sekhar Nori , Rob Herring , Masahiro Yamada , Michal Marek , Pantelis Antoniou , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: Re: [PATCH] devicetree: Enable generation of __symbols__ in all dtb files Message-ID: <20170816004238.GH20467@bill-the-cat> References: <1502831736-28282-1-git-send-email-trini@konsulko.com> <599388D0.9050108@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J7s6NjMO8dg/okC9" Content-Disposition: inline In-Reply-To: <599388D0.9050108@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6510 Lines: 142 --J7s6NjMO8dg/okC9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 15, 2017 at 04:50:40PM -0700, Frank Rowand wrote: > On 08/15/17 14:15, Tom Rini 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. > >=20 > > Cc: Rob Herring > > Cc: Frank Rowand > > Cc: Masahiro Yamada > > Cc: Michal Marek > > Cc: Pantelis Antoniou > > Cc: devicetree@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > CC: linux-kbuild@vger.kernel.org > > Signed-off-by: Tom Rini > > --- > > 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). > >=20 > > 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. >=20 > I also was hoping that other people might have ideas for additional > approaches. Yes, please. > > 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. > >=20 > > 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. >=20 > I hope that dtb contents are independent of CONFIG options, but I don't > feel confident is stating that there is not such dependency. (Of course, > whether to build a dtb can be dependent on a CONFIG option in the Makefil= e, > but that is not the same concept.) >=20 > The only existing rule that I am aware of that helps avoid a dts dependen= cy > on kernel CONFIG options is that included files can not be from general k= ernel > header files; they must be in include/dt-bindings/. I'm fairly certain for in-kernel stuff at least, the assumption is correct. > Should we add text to Documentation/devicetree/bindings/submitting-patche= s.txt > that explicitly states that dts files are not allowed to contain any > dependency on kernel CONFIG options? Certainly can't hurt. > > 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 >=20 > I disagree with this. My _opinion_ is that overlays should be the except= ion, > not the common case. Overlays require extra complexity in the various > subsystems that interact with device trees. For an overlay to work, these > subsystems must be able to react to changes made to the device tree by > an overlay. The current mechanism is via notifiers, which only exist > for a few subsystems. Ah. Now, I can't blame you for thinking with your kernel hat on, but, you're thinking with your kernel hat on :) (And taking mine off for a minute is why I changed my mind between when we talked on IRC, and what I posted). Kernel run-time apply an overlay has various use cases that I don't want to discount, but don't want to try and go in detail on either. At heart, one of the issues here is that the Linux kernel is the authoritative source of dts and dtb files. Assembling a dtb and N overlays at some point prior to booting Linux, in order to give it a complete and valid system is going to be a common case. Even setting aside all of the hobbyist board families out there, SoMs are a big thing. Eval modules are a big thing. This turns not just enabling these as a vendor but using them as a developer into a much less error prone system. To try and re-state my rational, if the Linux kernel needs some safe-guards or other mechanisms to restrict what can be done on top of OF_OVERLAY (which is not widely enabled in mainline), OK, that's certainly a discussion to have and think about implications of. But, the Linux kernel is the producer of most dtbs that will be consumed by a variety of platforms. I feel it needs to generate the dtb that can be used for all consumers, since it is the source of these resources. --=20 Tom --J7s6NjMO8dg/okC9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJZk5T+AAoJEIf59jXTHXZSu9sP/0fbClBeoUkW+7ntRPlVdZvm bA8xScTpC63oZ1Y6yu4hjtRgFkgmAcMSzHmALMgiiOSjkkUqSclTP5CSgPGKunED 08/FO3xU3doPgm8ehex2d4uegRMdwOSvcXtteGrRrqA3E6L9sJ+ElqjHgK3rQOrs s00Gs8vXqCKQ1E/xdeR1lNYsAAQlHV5Psoz4MK8EOSJLCmBUrKu2d8E6i2iFjWTZ ZNynwd4jO9SQj0QkLNaUWFJv9tjISd7oE4va11JWhuPi9nOwCX6E0Vz4a9fE4XQU tCtXmsGQSPjS+j2s8oDhEEdeX2S5FosPIaJeacBq/WMyhwG726jMGJRF3a2x3H4S vauaKqWnDg3A/ebHj4EZ9Q/71QqglOeP3uvk9Cy3l/HQOWjjLmxPV/UPBTcv+sOZ sF920j6lKIQ0UD2z9ZtD/VBagss1ljDAZuSIkz0hyLsFlrvKHISw3FK9KHYrWS2+ LHKAkkJ1kogNqWscews5LUTurmBvxHgYZ6l715RfbeJKJp1/pgszyQoHaHX0ggqn v56FN/zPXQTZzCbEM0I0Mgsiksypbjbacv0bXsqrSCVyK0fejX5BC4jWOKh2Iihy smC99TD9P2Ym+YDj8s0KlZB3M7kXkYv+ZZ3v1Qu7mT1bhqyzIcX9x8mzV+pLHs9z qP8Hlwmp+9Rz3beQAARn =x2EZ -----END PGP SIGNATURE----- --J7s6NjMO8dg/okC9--