Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6497C433EF for ; Thu, 4 Nov 2021 16:44:51 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 956B661213 for ; Thu, 4 Nov 2021 16:44:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 956B661213 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C1F9836AD; Thu, 4 Nov 2021 17:44:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="bkBLvRSK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3697836B2; Thu, 4 Nov 2021 17:44:45 +0100 (CET) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 01F8E836A0 for ; Thu, 4 Nov 2021 17:44:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x735.google.com with SMTP id bp7so6216095qkb.10 for ; Thu, 04 Nov 2021 09:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cqkQBIeoMnrARwXcZ0PAu3OndFyhY9+2FeXJVPBfzyY=; b=bkBLvRSKJngkDX4uaeBAEmhTawGS5UeCRfV/06cJYMWzvd25rV7r5HcSzybcv5K77E kEo+2hqy0Cw+/hCugZAk1bopzJJz2eZa9rkNYNXSCClZSxsBC8bpVmnO7sJCDsPG0ang IHW5HB8NKC2FIJK+1WtCii5C8yWhueD0mGnK0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cqkQBIeoMnrARwXcZ0PAu3OndFyhY9+2FeXJVPBfzyY=; b=wDUxh/ldAf9GZDHbz6Nozztr7CAG0ozOqiYyTqv9PfjeiUp0uAd3CKxd+Ga7OjcRH1 RJzGHyGkvM2vOHx0nQv6RlEM4sqPPkMJEbYMq7ZQUCU2pHoBPRK4uXNyw3YnPZvpF6PL jOoiBhX1kub31Lxr8fjgT417vaVSSu0iLMl6DL9cQJp/DMzWkLWRnIUc5qg6iEZPMQYh yciuFfsyio4wXK79pycJX79YzLpBdjbWMFnvGXNZf0jyRQK9kIjQ3Di/0UULTXN32iL1 7r4FSumNUGtFD9onVAwaKLF57QcVp2ORVyQJ4bvPqMLQfRf/cIgggpkSMOqMxXhlnumk nSwg== X-Gm-Message-State: AOAM532PrjibJcUDwzqwYsekyOB+fdEhvYH4IJky33M6Eqn/SwO3oz42 rHH2NG3LRudKddp9yihcd1w0tw== X-Google-Smtp-Source: ABdhPJyM1zd/aWSUWtrBN15yssxyPpMwImuCdNsa3DxF94S3MZB6P7t0B2Yl5338oewD4Q8JeISCjg== X-Received: by 2002:a05:620a:12e5:: with SMTP id f5mr42634770qkl.453.1636044279247; Thu, 04 Nov 2021 09:44:39 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-c94a-a4cb-a5af-4946.res6.spectrum.com. [2603:6081:7b01:cbda:c94a:a4cb:a5af:4946]) by smtp.gmail.com with ESMTPSA id i13sm4206317qko.66.2021.11.04.09.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 09:44:38 -0700 (PDT) Date: Thu, 4 Nov 2021 12:44:36 -0400 From: Tom Rini To: Simon Glass Cc: Heinrich Schuchardt , U-Boot Mailing List , Michal Simek , Daniel Schwierzeck , Steffen Jaeckel , Marek =?iso-8859-1?Q?Beh=FAn?= , Lukas Auer , Dennis Gilmore , Masahiro Yamada , Ilias Apalodimas , Heinrich Schuchardt Subject: Re: [PATCH v2 02/41] Makefile: Allow LTO to be disabled for a build Message-ID: <20211104164436.GO24579@bill-the-cat> References: <20211023232635.9195-1-sjg@chromium.org> <20211023232635.9195-3-sjg@chromium.org> <20211027131340.GT8284@bill-the-cat> <20211101215805.GN24579@bill-the-cat> <20211104145525.GM24579@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Bk6I6VqSt1TlXFl0" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --Bk6I6VqSt1TlXFl0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 04, 2021 at 09:12:02AM -0600, Simon Glass wrote: > Hi Tom, >=20 > On Thu, 4 Nov 2021 at 08:55, Tom Rini wrote: > > > > On Wed, Nov 03, 2021 at 08:49:01PM -0600, Simon Glass wrote: > > > Hi Tom, > > > > > > On Mon, 1 Nov 2021 at 15:58, Tom Rini wrote: > > > > > > > > On Sun, Oct 31, 2021 at 05:46:43PM -0600, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Wed, 27 Oct 2021 at 07:13, Tom Rini wrote: > > > > > > > > > > > > On Wed, Oct 27, 2021 at 02:21:17PM +0200, Heinrich Schuchardt w= rote: > > > > > > > > > > > > > > > > > > > > > On 10/27/21 10:50, Ilias Apalodimas wrote: > > > > > > > > Hi Simon > > > > > > > > > > > > > > > > How does this patch related to the standard boot series? Sh= ouldn't > > > > > > > > this be a completely separate patch? > > > > > > > > > > > > > > > > Thanks > > > > > > > > /Ilias > > > > > > > > > > > > > > > > On Sun, 24 Oct 2021 at 02:26, Simon Glass wrote: > > > > > > > > > > > > > > > > > > LTO (Link-Time Optimisation) is an very useful feature wh= ich can > > > > > > > > > significantly reduce the size of U-Boot binaries. So far = it has been > > > > > > > > > made available for selected ARM boards and sandbox. > > > > > > > > > > > > > > > > > > However, incremental builds are much slower when LTO is u= sed. For example, > > > > > > > > > an incremental build of sandbox takes 2.1 seconds on my m= achine, but 6.7 > > > > > > > > > seconds with LTO enabled. > > > > > > > > > > > > > > > > > > Add a LTO_BUILD=3Dn parameter to the build, so it can be = disabled during > > > > > > > > > development if needed, for faster builds. > > > > > > > > > > > > > > > > > > Add some documentation about LTO while we are here. > > > > > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > --- > > > > > > > > > > > > > > > > > > (no changes since v1) > > > > > > > > > > > > > > > > > > Makefile | 18 +++++++++++++--= --- > > > > > > > > > arch/arm/config.mk | 4 ++-- > > > > > > > > > arch/arm/include/asm/global_data.h | 2 +- > > > > > > > > > doc/build/gcc.rst | 17 +++++++++++++++= ++ > > > > > > > > > 4 files changed, 33 insertions(+), 8 deletions(-) > > > > > > > > > > > > > > > > > > diff --git a/Makefile b/Makefile > > > > > > > > > index b79b2319ff6..7057723e046 100644 > > > > > > > > > --- a/Makefile > > > > > > > > > +++ b/Makefile > > > > > > > > > @@ -434,6 +434,9 @@ KBUILD_CFLAGS +=3D -fshort-wcha= r -fno-strict-aliasing > > > > > > > > > KBUILD_AFLAGS :=3D -D__ASSEMBLY__ > > > > > > > > > KBUILD_LDFLAGS :=3D > > > > > > > > > > > > > > > > > > +# Set this to "n" use of LTO for this build, e.g. LTO_BU= ILD=3Dn > > > > > > > > > +LTO_BUILD ?=3D y > > > > > > > > > > > > > > This does not allow LTO_BUILD=3Dy to enable LTO for CONFIG_LT= O=3Dn. > > > > > > > > > > > > I don't understand why we need this patch at all. If you want = to > > > > > > disable LTO, disable LTO. Yes, LTO makes linking take longer w= hich can > > > > > > be annoying on iterative development. I have a few different "= HACK: DO > > > > > > NOT PUSH: ..." things I git am at the start of a branch, depen= ding on > > > > > > needs. You can just do that to drop "imply LTO" from the SANDB= OX stanza > > > > > > in arch/Kconfig. We do not need a whole thing around a CONFIG = option > > > > > > that can be disabled in the defconfig, or local .config file ev= en. > > > > > > > > > > > > > > > > Cranky time. > > > > > > > > > > Of course we don't *need* it. I could just buy a slower build mac= hine > > > > > and type with two fingers. There are lots of ways to slow things = down > > > > > and LTO is one of them. I change branches at least a dozen times = a day > > > > > and am always trying things out from patchwork. I am sure others = do > > > > > too. LTO dramatically slows down builds. Having a way to easily do > > > > > this from the build system saves time. > > > > > > > > Maybe the answer is that LTO just isn't appropriate for sandbox. W= e're > > > > not doing any specific tests for LTO anywhere (nor does that seem > > > > appropriate), and we do have platforms in CI that run tests other t= han > > > > building, with LTO. > > > > > > It has value as a test, I presume, and a demo of how it works. Also it > > > runs most of the tests. > > > > > > But I'm happy to disable it if that helps. > > > > > > Still, it doesn't really solve the issue. The same thing happens when > > > building real boards. > > > > Well, a big part of the problem here is I strongly disagree with a > > make-line flag to override a CONFIG option. I also hear your use case > > of "I build this platform so frequently per development session it's a > > noticeable slowdown and a 'LOCAL:' commit will also screw up my > > workflow". So where do we go? LTO is a size versus speed trade-off > > (and -ffunction-sections/-fdata-sections/--gc-unused is a much smaller > > speed trade-off) that's more important on real hardware (and also not > > used as often as it might be, at least so far). On real boards, there's > > less of a "just turn it off" option because it's required to be small > > enough to use on the hardware. Since that's not the case on sandbox, > > maybe we just need to turn it on in more QEMU platforms (to get broader > > test coverage in CI) and off in sandbox. >=20 > This is all true...and certainly sandbox would solve the main issue I > have. If we turn it off for sandbox we should perhaps have CI turn it > on... >=20 > It is similar to the dtc thing, where we have a DTC variable to avoid > pointlessly building dtc. I guess you are worried about having too > many of these sorts of things? Well, the DTC thing to me is at least a case of "external tool exists, stop building it when it's already provided, versioning tools like this is bad". LTO is a thing that impact the build itself and can (so long as it fits in hardware still) be enabled/disabled by the user. --=20 Tom --Bk6I6VqSt1TlXFl0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmGEDe0ACgkQFHw5/5Y0 tyx2Qgv+MCAetoUJ67uxBm9Dd8xtHDQYGbLieC/D1IR1sFwSOBQ5g9MKGCHnv0/y ZvP7BPGT02WhhGgqHyde3vfPPW3J2VCdZUuBFaibya0SAp0lgVe/aU/4OvPmraOA P0dqcIr4NhmHIk+VnBZYjo52vQ9IU4mge9XBlJ08rAiebicCmLh1c0mexrYw9cA2 vWoyhA3Op0FC7UhGsYGma8IEJnKGTDvOCE/rk4HeffWzazfu++rX9309cQRmV3RK I2qQnXPhgjBaLlySzTz/vfbM4SIrg5aiZ5ctoeCTHSVDNR4ZOtl7VTyh8fADtf+N V/DGMlVeKhpDWAy0CwzjnuOAIurHv/EVgrSzctyD+iZgdSdVZdYaZIDzaCv4EuT8 0ZCrIWzWo30oM4XSwpfZe6jH05bOeLb3FP97QrDaNVpywWsFG356WmUZ5lH5Q9Zj oekRjdo1aWAmSnifiYBZao5y3O73oZ6ElwUCLUT2G2XTcJiEMrFTQwmia9/3Cb5z K+Hgk4RY =TQkk -----END PGP SIGNATURE----- --Bk6I6VqSt1TlXFl0--