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 66346C433EF for ; Mon, 14 Mar 2022 22:42:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 370D283B74; Mon, 14 Mar 2022 23:42:32 +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="uUo6qAan"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D52A78399E; Mon, 14 Mar 2022 23:42:29 +0100 (CET) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (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 DB05583B74 for ; Mon, 14 Mar 2022 23:42:24 +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-qk1-x736.google.com with SMTP id q4so14090867qki.11 for ; Mon, 14 Mar 2022 15:42:24 -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=1x/vho/lT4WQwU7crcDwILUxD4lNh38gdlg1U7lDHOw=; b=uUo6qAanQ8EgDID14baDbtaFBMDKfB9loT/u9JKKQGhyAebPmSloZJHHkjfANinjEV Z5wBHO1lcNYrFvqUhT/O7LqzVj7Ho1ovHA8PdzQHr6Ic6tHwuIypZE91zFwXwVbJHCF1 FK6EM3WerAWqUFc/912K9GVUsv8VZ9xYLFQ8U= 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=1x/vho/lT4WQwU7crcDwILUxD4lNh38gdlg1U7lDHOw=; b=1+VP175PHIJhHc82Gv2JRXEySfATcmQOhkubT5BqXjKR2hdjljDO8r2Mv0OlAI0dV1 l1ixN03ubUtoNU+YAJUV5wdC/D30DhR0rWxppXJPYUl2LWoiVqYzQk+J0MS9aWFrdKXD iYcdSRjq4iOn1VNVqI3r37t+kYH2nG+20I161bVpd3CDO06Jgaf+fqHocw56F/YTFN6w Ma/XJguRiOCAyY8ds95dmn7c6Jd1gObRa/CLNA08Def+k3QZ/deSJv8pfjhI5fjFkV0h raH/GYRQDlovRnhQ2+m5UOuIvyQHZdSUcNztmbq9kLt4bXZ4X+HQM4AJs6PTy4h0F65K yTcg== X-Gm-Message-State: AOAM531YCiKQzUSb+wFnsNWdfAzRYIrvimTL0FII4qWV4Gf7p4PtH4M1 QmPfEqrBaM75RR+LYv6i+xYR8A== X-Google-Smtp-Source: ABdhPJwtYd5ZjlOBTYkjYeRUxtgi2GDWFwkdc9UFYERq8REGNBDcXryp2/mUckB9D4tIzAAc4FJeEg== X-Received: by 2002:a05:620a:2985:b0:67d:b9ac:90b2 with SMTP id r5-20020a05620a298500b0067db9ac90b2mr6366380qkp.436.1647297743659; Mon, 14 Mar 2022 15:42:23 -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 j4-20020a37c244000000b0067d79a3fd0esm5389583qkm.106.2022.03.14.15.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 15:42:22 -0700 (PDT) Date: Mon, 14 Mar 2022 18:42:20 -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: <20220314224220.GU9986@bill-the-cat> References: <20220307143302.GA1209254@bill-the-cat> <20220314124950.GE9986@bill-the-cat> <20220314182954.GL9986@bill-the-cat> <20220314194524.GP9986@bill-the-cat> <20220314202330.GR9986@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qK798ZKoBP/Ne2Dr" 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 --qK798ZKoBP/Ne2Dr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 14, 2022 at 03:43:05PM -0600, Simon Glass wrote: > Hi Tom, >=20 > 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 wrote: > > > > > > > > > > > > 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 w= rote: > > > > > > > > > > > > > > > > On Sat, Mar 12, 2022 at 10:58:44AM -0700, Simon Glass wrote: > > > > > > > > > Hi Tom, > > > > > > > > > > > > > > > > > > On Mon, 7 Mar 2022 at 07:33, Tom Rini wrote: > > > > > > > > > > > > > > > > > > > > On Fri, Mar 04, 2022 at 08:42:57AM -0700, Simon Glass w= rote: > > > > > > > > > > > > > > > > > > > > > LTO (Link-Time Optimisation) is an very useful featur= e which 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 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 here. > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > > > > > > > > > > > > We don't need this since you can do: > > > > > > > > > > make EXTRA_CFLAGS=3D"-fno-lto" EXTRA_LDFLAGS=3D"-fno-lt= o" > > > > > > > > > > to pass -fno-lto to compile/linking and disable lto and= per > > > > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D46905 th= is has been working > > > > > > > > > > for some time. > > > > > > > > > > > > > > > > > > Thanks for that, it is a big pain point for me, picking u= p 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, which= is > > > > > > > > > intolerable. > > > > > > > > > > > > > > > > Yeah, I noticed it's visible on my laptop, but not at all o= n my desktop > > > > > > > > (i7 vs Ryzen 7). > > > > > > > > > > > > > > > > > The EXTRA_CFLAGS says it is for 'Backward compatibility' = and it still > > > > > > > > > does the various LTO things (i.e. it changes the build lo= gic). It > > > > > > > > > > > > > > > > We're unlikely to move to newer Linux kernel kbuild logic s= o this isn't > > > > > > > > going away, and there's not much in the way of logic that'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. But i= t seems to > > > > > > > > > work well enough for me fom a small amount of testing. If= you are > > > > > > > > > really set on not having a special option for it, I can l= ive with it > > > > > > > > > for now. I'm also not convinced that my patch entirely re= moves the LTO > > > > > > > > > stuff in a consistent way. > > > > > > > > > > > > > > > > Yeah, I really don't want to go down the path of overriding= CONFIG > > > > > > > > options via make/environment logic. I'm also open to turni= ng 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 exa= mple, 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 platform d= oes > > > > > > 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 see > > > > several seconds of link time on my laptop and nothing on my desktop > > > > (which isn't that high end either, it's not an EPYC or anything) wh= en > > > > 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 difference? > > > What times are you seeing? > > > > My 16 core desktop is 14 seconds without, 15 seconds with (full build, > > not just the link time) and I don't recall what my laptop was but since > > it's longer than the desktop I'm always just ssh'd in there anyhow. >=20 > 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 Tom --qK798ZKoBP/Ne2Dr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmIvxMwACgkQFHw5/5Y0 tywXUQv/UHrsH3RtZ3fG0Szq4A4MSAZWFLz92RwcDkZExUXsdoEMZL/17QuBIXtQ w/uY7PQxaVUbiWS+6lENzUpFN8pS+LU1A3moBVQFVfoT6kUAcO9tG9XfoNw2my47 xKG8+c7GMmrvU+cRJ3Ckp2TWGGc3Rnh+vf1DJYPnOkXKPaMrEB+T9weU9Bj+tteJ MPzsTbPwchp0qRMivYeaY2qiczInRm3Oq3XzcKKn0AfjvTcvPCqj6qY29iul+Vln 6jSLhhszyIY+V+YONGy9NW/csQ4IKWNQmYXcywQoLBX9wMu5l4jwFWLKrKHLXX2b gy4DaEmOYtXGbtgrCiEhAo3jZynRjHoDsnSgHgCPWZiX0LepdfsNWo4KMXIxHjqh yC7FLEwlSWvl0AMdgde8RQJVCu3pJz5Nz2+betvLltwrhAwmAiq7z1nGJBXHxO75 bJxLA0ogo8nQrtqgseuMeE3BD8GtzSFLDyBAPm3EfWD4e9Kzwl2vZJxk5VBStjLr 8klOesDi =zLbO -----END PGP SIGNATURE----- --qK798ZKoBP/Ne2Dr--