From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: "U-Boot Mailing List" <u-boot@lists.denx.de>,
"Marek Vasut" <marex@denx.de>,
"Masahiro Yamada" <yamada.masahiro@socionext.com>,
"AKASHI Takahiro" <takahiro.akashi@linaro.org>,
"Marek Behún" <marek.behun@nic.cz>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>
Subject: Re: [PATCH v2 02/13] Makefile: Allow LTO to be disabled for a build
Date: Mon, 14 Mar 2022 18:42:20 -0400 [thread overview]
Message-ID: <20220314224220.GU9986@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ3R=tmgAZw3jK_HyKnMM=1BmZyc8U5Gs4o=kNsjXd6mXg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5683 bytes --]
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 <trini@konsulko.com> 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 <trini@konsulko.com> 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 <trini@konsulko.com> 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 <trini@konsulko.com> wrote:
> > > > > > > >
> > > > > > > > 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 <trini@konsulko.com> wrote:
> > > > > > > > > >
> > > > > > > > > > On Fri, Mar 04, 2022 at 08:42:57AM -0700, Simon Glass wrote:
> > > > > > > > > >
> > > > > > > > > > > LTO (Link-Time Optimisation) is an very useful feature 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=n 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 <sjg@chromium.org>
> > > > > > > > > >
> > > > > > > > > > We don't need this since you can do:
> > > > > > > > > > make EXTRA_CFLAGS="-fno-lto" EXTRA_LDFLAGS="-fno-lto"
> > > > > > > > > > to pass -fno-lto to compile/linking and disable lto and per
> > > > > > > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46905 this has been working
> > > > > > > > > > for some time.
> > > > > > > > >
> > > > > > > > > Thanks for that, it is a big pain point for me, picking 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, which is
> > > > > > > > > intolerable.
> > > > > > > >
> > > > > > > > Yeah, I noticed it's visible on my laptop, but not at all on 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 logic). It
> > > > > > > >
> > > > > > > > We're unlikely to move to newer Linux kernel kbuild logic so 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 it 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 live with it
> > > > > > > > > for now. I'm also not convinced that my patch entirely removes 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 turning 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 platform 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 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) 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 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.
>
> 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.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2022-03-14 22:42 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 15:42 [PATCH v2 00/13] event: Provide support for events to connect subsystems Simon Glass
2022-03-04 15:42 ` [PATCH v2 01/13] phy: nop-phy: Fix phy reset if no reset-gpio defined Simon Glass
2022-03-08 13:16 ` Heinrich Schuchardt
2022-03-04 15:42 ` [PATCH v2 02/13] Makefile: Allow LTO to be disabled for a build Simon Glass
2022-03-07 14:33 ` Tom Rini
2022-03-12 17:58 ` Simon Glass
2022-03-14 12:49 ` Tom Rini
2022-03-14 18:24 ` Simon Glass
2022-03-14 18:29 ` Tom Rini
2022-03-14 19:21 ` Simon Glass
2022-03-14 19:45 ` Tom Rini
2022-03-14 20:18 ` Simon Glass
2022-03-14 20:23 ` Tom Rini
2022-03-14 21:43 ` Simon Glass
2022-03-14 22:42 ` Tom Rini [this message]
2022-03-15 21:15 ` Simon Glass
2022-03-16 14:48 ` Tom Rini
2022-03-04 15:42 ` [PATCH v2 03/13] sandbox: start: Sort the header files Simon Glass
2022-03-10 13:25 ` Tom Rini
2022-03-04 15:42 ` [PATCH v2 04/13] binman: Expand elf support a little Simon Glass
2022-03-10 13:25 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 05/13] event: Add basic support for events Simon Glass
2022-03-07 4:26 ` AKASHI Takahiro
2022-03-08 16:05 ` Simon Glass
2022-03-10 13:25 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 06/13] event: Add a simple test Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 07/13] event: Set up the event system on start-up Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 08/13] event: Add events for device probe/remove Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 09/13] event: Convert misc_init_f() to use events Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 10/13] event: Convert arch_cpu_init_dm() " Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 11/13] event: Add a command Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 12/13] event: Add a script to decode the event-spy list Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-04 15:43 ` [PATCH v2 13/13] event: Add documentation Simon Glass
2022-03-10 13:26 ` Tom Rini
2022-03-08 13:11 ` [PATCH v2 00/13] event: Provide support for events to connect subsystems Heinrich Schuchardt
2022-03-08 13:26 ` Tom Rini
2022-03-08 16:06 ` Simon Glass
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=20220314224220.GU9986@bill-the-cat \
--to=trini@konsulko.com \
--cc=marek.behun@nic.cz \
--cc=marex@denx.de \
--cc=sjg@chromium.org \
--cc=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
--cc=yamada.masahiro@socionext.com \
/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