From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 84502C433FE for ; Wed, 16 Mar 2022 14:49:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DD87883960; Wed, 16 Mar 2022 15:49:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (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="l3xLaO2R"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFC0983BAE; Wed, 16 Mar 2022 15:49:07 +0100 (CET) Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) (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 4E50183CB4 for ; Wed, 16 Mar 2022 15:48:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf31.google.com with SMTP id e22so1972864qvf.9 for ; Wed, 16 Mar 2022 07:48:53 -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=y2/z0yU+5skGw30KcwL9ZbyejX9dl0zRILTDO0IFGGo=; b=l3xLaO2RK11XNDw5nltMBWWSVYbOxYemIhziFNrSdepBxfMHpaNnxzPeAbaA/3rq4Z HMx+QN6v3jYF6UQoPLFrUv3bXpsAlltpQ0KYYdn/L0OnGIjHaaC8cOmX93e5Msqo8iYc B+lKHnlpyggoBZaeE8oc6EcYKugPdhOlaoUpo= 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=y2/z0yU+5skGw30KcwL9ZbyejX9dl0zRILTDO0IFGGo=; b=g133atw+TmXaI6+5w7Wam9iI8aDQ4CBaD+HkpWy/rJRu0mA+eXbqytZWYJnIsWPWlD MWH5yf/tQpQ5Xoz5BR2mQ/P4l8iEfp4V18sYMPoKcUi4OiNV/TdeucDz8BtXZgoutWcz Gk0VTmYdE/axz5Z+HO6Oy3dIfLE8VO8wPZ6nO7k8NvL0akKp/sCbkfaI/B+5xQlT499i 9WuyYi7tVvJTJmQIrIB1Bio/FqVmFPTSy8LhpSiCHpASJ2u80xzT+y/hA8JYdcRkqKRy k56IFjxylf8talhq4qo0QElv/5nY8eiPg4HgDER+ZF70zY4z0FQDWTYMub9O8WdHtXoZ gWEw== X-Gm-Message-State: AOAM532gEy+PG8ZjWoJveymdgWoqZhWlAW84z+AKIb2ULqF5rtao9EcP CApInlfKJadJ0gyj0rRjIv8Miw== X-Google-Smtp-Source: ABdhPJwfRztCPNzGyU+nXgir+gwPtLyf3hJVkZl1vPsxmp/PGZj01M8NSM/XjcQXXOpRQZZPghnJtg== X-Received: by 2002:a05:6214:2488:b0:435:b2b9:712b with SMTP id gi8-20020a056214248800b00435b2b9712bmr26226qvb.49.1647442131905; Wed, 16 Mar 2022 07:48:51 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id v129-20020a379387000000b0064936bab2fcsm979019qkd.48.2022.03.16.07.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 07:48:50 -0700 (PDT) Date: Wed, 16 Mar 2022 10:48:49 -0400 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List , Marek Vasut , Masahiro Yamada , AKASHI Takahiro , Marek =?iso-8859-1?Q?Beh=FAn?= , Heinrich Schuchardt Subject: Re: [PATCH v2 02/13] Makefile: Allow LTO to be disabled for a build Message-ID: <20220316144849.GR577378@bill-the-cat> References: <20220314124950.GE9986@bill-the-cat> <20220314182954.GL9986@bill-the-cat> <20220314194524.GP9986@bill-the-cat> <20220314202330.GR9986@bill-the-cat> <20220314224220.GU9986@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CGcXfQ1PUDCmwDYp" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean --CGcXfQ1PUDCmwDYp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 16, 2022 at 10:15:17AM +1300, Simon Glass wrote: > Hi Tom, >=20 > On Mon, 14 Mar 2022 at 16:42, Tom Rini wrote: > > > > On Mon, Mar 14, 2022 at 03:43:05PM -0600, Simon Glass wrote: > > > Hi Tom, > > > > > > On Mon, 14 Mar 2022 at 14:23, Tom Rini wrote: > > > > > > > > On Mon, Mar 14, 2022 at 02:18:14PM -0600, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Mon, 14 Mar 2022 at 13:45, Tom Rini wrote: > > > > > > > > > > > > On Mon, Mar 14, 2022 at 01:21:02PM -0600, Simon Glass wrote: > > > > > > > Hi Tom, > > > > > > > > > > > > > > On Mon, 14 Mar 2022 at 12:29, Tom Rini w= rote: > > > > > > > > > > > > > > > > On Mon, Mar 14, 2022 at 12:24:42PM -0600, Simon Glass wrote: > > > > > > > > > Hi Tom, > > > > > > > > > > > > > > > > > > On Mon, 14 Mar 2022 at 06:49, Tom Rini wrote: > > > > > > > > > > > > > > > > > > > > On Sat, Mar 12, 2022 at 10:58:44AM -0700, Simon Glass w= rote: > > > > > > > > > > > Hi Tom, > > > > > > > > > > > > > > > > > > > > > > On Mon, 7 Mar 2022 at 07:33, Tom Rini wrote: > > > > > > > > > > > > > > > > > > > > > > > > On Fri, Mar 04, 2022 at 08:42:57AM -0700, Simon Gla= ss wrote: > > > > > > > > > > > > > > > > > > > > > > > > > LTO (Link-Time Optimisation) is an very useful fe= ature which can > > > > > > > > > > > > > significantly reduce the size of U-Boot binaries.= So far it has been > > > > > > > > > > > > > made available for selected ARM boards and sandbo= x. > > > > > > > > > > > > > > > > > > > > > > > > > > However, incremental builds are much slower when = LTO is used. For example, > > > > > > > > > > > > > an incremental build of sandbox takes 2.1 seconds= on my machine, 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 her= e. > > > > > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > > > > > > > > > > > > > > > > We don't need this since you can do: > > > > > > > > > > > > make EXTRA_CFLAGS=3D"-fno-lto" EXTRA_LDFLAGS=3D"-fn= o-lto" > > > > > > > > > > > > to pass -fno-lto to compile/linking and disable lto= and per > > > > > > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D4690= 5 this has been working > > > > > > > > > > > > for some time. > > > > > > > > > > > > > > > > > > > > > > Thanks for that, it is a big pain point for me, picki= ng up this patch > > > > > > > > > > > for every series I write. The incremental build time = for sandbox goes > > > > > > > > > > > from 3 seconds to 27 seconds on my laptop with LTO, w= hich is > > > > > > > > > > > intolerable. > > > > > > > > > > > > > > > > > > > > Yeah, I noticed it's visible on my laptop, but not at a= ll on my desktop > > > > > > > > > > (i7 vs Ryzen 7). > > > > > > > > > > > > > > > > > > > > > The EXTRA_CFLAGS says it is for 'Backward compatibili= ty' and it still > > > > > > > > > > > does the various LTO things (i.e. it changes the buil= d logic). It > > > > > > > > > > > > > > > > > > > > We're unlikely to move to newer Linux kernel kbuild log= ic so this isn't > > > > > > > > > > going away, and there's not much in the way of logic th= at's changed for > > > > > > > > > > LTO that I see. > > > > > > > > > > > > > > > > > > > > > seems odd to me to enable the option and then disable= it later in the > > > > > > > > > > > command line. It is therefore not quite equivalent. B= ut it seems to > > > > > > > > > > > work well enough for me fom a small amount of testing= =2E If you are > > > > > > > > > > > really set on not having a special option for it, I c= an live with it > > > > > > > > > > > for now. I'm also not convinced that my patch entirel= y removes the LTO > > > > > > > > > > > stuff in a consistent way. > > > > > > > > > > > > > > > > > > > > Yeah, I really don't want to go down the path of overri= ding CONFIG > > > > > > > > > > options via make/environment logic. I'm also open to t= urning off LTO on > > > > > > > > > > sandbox and on with qemu-* so it gets wider CI testing. > > > > > > > > > > > > > > > > > > Yes you did mention that, but the problem is that LTO is = very handy > > > > > > > > > with sandbox, to test the strange things that happen. For= example, I > > > > > > > > > found the bug where LTO was dropping a linker-list item, = using > > > > > > > > > sandbox. We could perhaps make one of the sandbox builds = not use LTO, > > > > > > > > > e.g. sandbox_flattree ? > > > > > > > > > > > > > > > > Well, the big issue with LTO+sandbox is that it slows down = your > > > > > > > > workflow, so I would think you want the inverse, one platfo= rm does > > > > > > > > enable it? > > > > > > > > > > > > > > It slows down all boards that use it, actually, so I normally= don't > > > > > > > want it enabled for my IDE. This is not sandbox-specific. > > > > > > > > > > > > The degree of slowdown depends on what you're building on. I s= ee > > > > > > several seconds of link time on my laptop and nothing on my des= ktop > > > > > > (which isn't that high end either, it's not an EPYC or anything= ) when > > > > > > LTO is/isn't enabled. > > > > > > > > > > For me, on 16-core AMD desktop, incremental build > > > > > > > > > > LTO: real 0m7.744s > > > > > No LTO: real 0m3.172s > > > > > > > > > > On 4-core laptop: > > > > > > > > > > No LTO: real 0m2.429s > > > > > LTO: real 0m15.650s > > > > > > > > > > Perhaps the disconnect here is that you just don't see any differ= ence? > > > > > What times are you seeing? > > > > > > > > My 16 core desktop is 14 seconds without, 15 seconds with (full bui= ld, > > > > not just the link time) and I don't recall what my laptop was but s= ince > > > > it's longer than the desktop I'm always just ssh'd in there anyhow. > > > > > > Seems very slow. Are you sure that is an incremental build? > > > > No, it's a from-scratch build, which should be the worst case for this. >=20 > OK. So I don't do fresh builds very often, mostly they are incremental > (for obvious reasons...I am developing things incrementally). So the > difference is quite dramatic, as you can see. >=20 > Does my problem make more sense now? Yes, I didn't realize incremental non-LTO link was so quick. But no, I don't want to open the door here to other "make iterative build quicker, override the config" options. Maybe just another note to the development docs and see if that leads to a chorus of people asking for this feature after all. --=20 Tom --CGcXfQ1PUDCmwDYp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmIx+NEACgkQFHw5/5Y0 tyyOhgv/U1sS7VU6/OuctGyDbg6VDvZysbCwqKBK24vG9NrVwI0QXWn5Gj9Cctqi UWrHIg2bo4/41C2eKtgPmseWBYlD7GN+gTe4h8547r6EfSFI4ikaG8eMGmHhlbfX 4mIks3b7ChvElzOPeThLZWd9CDxQH/RAQ7UNVJatMH+sGLaHq0h17jtBEHlzrh10 CBlRah7xI6OedYwClXlxjSo7pclgY4zY8s+cic2epyAPYzR13EX5nWrQ1F2VUxa5 0tmjCSQYG+7gDmaKTovYU8gFW3t+EagT0PVcKB9hcztwtwZhywdFJHIMmHI6GuKa DBEeBRWGIFXIMQYHX8FC67mX2S8OHWyfXpnOs9j0+QAzKyLzU/48Z60qXlBtB92b sR/gnLDTRDaQkIphIaKwCH8DEc/b/B//i+gppoXz0Sr35zKwqq+QuQhJstRyWvuY N/Z4G0Mgz1QQypoCz4WdojldZmfdr04kXwlGciL0zJPtwtQaiI8YXJzfh0wADXdg /3Pqo6O3 =0DSN -----END PGP SIGNATURE----- --CGcXfQ1PUDCmwDYp--