public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Noted slowness in profile loading with binutils 2.37
@ 2022-02-08 17:44 Alexander Lindsay
  2022-02-08 17:57 ` H.J. Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alexander Lindsay @ 2022-02-08 17:44 UTC (permalink / raw)
  To: binutils

Hi all,

I recently experienced a slow-down in profile loading by the tool pprof,
and I believe I've boiled it down to changing from previous versions of
binutils to binutils version 2.37. Timings of profile loading are
documented on the pprof ticket I originally opened here:
https://github.com/google/pprof/issues/680#issuecomment-1032174210. I
reproduce them below:

- binutils version 2.29.1: 1.1 seconds
- binutils version 2.33.1: 1.1 seconds
- binutils version 2.35.2: 6.8 seconds
- binutils version 2.36.1: 6.5 seconds
- binutils version 2.37: Still not loaded at 6 minutes

I think the relevant binutil tool here is addr2line. Does anyone have a
quick idea for what may have caused the slow-down? I was thinking about
doing a git bisect, but I figured it is probably way more efficient to
contact the experts!

Alex

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-08 17:44 Noted slowness in profile loading with binutils 2.37 Alexander Lindsay
@ 2022-02-08 17:57 ` H.J. Lu
  2022-02-08 18:45   ` Alexander Lindsay
  2022-02-09  1:09 ` Alan Modra
  2022-02-10 11:00 ` Nick Clifton
  2 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2022-02-08 17:57 UTC (permalink / raw)
  To: Alexander Lindsay; +Cc: Binutils

On Tue, Feb 8, 2022 at 9:45 AM Alexander Lindsay via Binutils
<binutils@sourceware.org> wrote:
>
> Hi all,
>
> I recently experienced a slow-down in profile loading by the tool pprof,
> and I believe I've boiled it down to changing from previous versions of
> binutils to binutils version 2.37. Timings of profile loading are
> documented on the pprof ticket I originally opened here:
> https://github.com/google/pprof/issues/680#issuecomment-1032174210. I
> reproduce them below:
>
> - binutils version 2.29.1: 1.1 seconds
> - binutils version 2.33.1: 1.1 seconds
> - binutils version 2.35.2: 6.8 seconds
> - binutils version 2.36.1: 6.5 seconds
> - binutils version 2.37: Still not loaded at 6 minutes
>
> I think the relevant binutil tool here is addr2line. Does anyone have a
> quick idea for what may have caused the slow-down? I was thinking about
> doing a git bisect, but I figured it is probably way more efficient to
> contact the experts!
>

This may be related to:

https://sourceware.org/bugzilla/show_bug.cgi?id=28843

-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-08 17:57 ` H.J. Lu
@ 2022-02-08 18:45   ` Alexander Lindsay
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Lindsay @ 2022-02-08 18:45 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils

Hmm, I'm trying with master and I still see the slowness. I'll note that I
also saw the slowness when I configured a 2.37 build with
`--enable-follow-debug-links=no` when I was wondering if that was the
relevant change.

On Tue, Feb 8, 2022 at 9:58 AM H.J. Lu <hjl.tools@gmail.com> wrote:

> On Tue, Feb 8, 2022 at 9:45 AM Alexander Lindsay via Binutils
> <binutils@sourceware.org> wrote:
> >
> > Hi all,
> >
> > I recently experienced a slow-down in profile loading by the tool pprof,
> > and I believe I've boiled it down to changing from previous versions of
> > binutils to binutils version 2.37. Timings of profile loading are
> > documented on the pprof ticket I originally opened here:
> > https://github.com/google/pprof/issues/680#issuecomment-1032174210. I
> > reproduce them below:
> >
> > - binutils version 2.29.1: 1.1 seconds
> > - binutils version 2.33.1: 1.1 seconds
> > - binutils version 2.35.2: 6.8 seconds
> > - binutils version 2.36.1: 6.5 seconds
> > - binutils version 2.37: Still not loaded at 6 minutes
> >
> > I think the relevant binutil tool here is addr2line. Does anyone have a
> > quick idea for what may have caused the slow-down? I was thinking about
> > doing a git bisect, but I figured it is probably way more efficient to
> > contact the experts!
> >
>
> This may be related to:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=28843
>
> --
> H.J.
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-08 17:44 Noted slowness in profile loading with binutils 2.37 Alexander Lindsay
  2022-02-08 17:57 ` H.J. Lu
@ 2022-02-09  1:09 ` Alan Modra
  2022-02-10 11:00 ` Nick Clifton
  2 siblings, 0 replies; 8+ messages in thread
From: Alan Modra @ 2022-02-09  1:09 UTC (permalink / raw)
  To: Alexander Lindsay; +Cc: binutils

On Tue, Feb 08, 2022 at 09:44:58AM -0800, Alexander Lindsay via Binutils wrote:
> Hi all,
> 
> I recently experienced a slow-down in profile loading by the tool pprof,
> and I believe I've boiled it down to changing from previous versions of
> binutils to binutils version 2.37. Timings of profile loading are
> documented on the pprof ticket I originally opened here:
> https://github.com/google/pprof/issues/680#issuecomment-1032174210. I
> reproduce them below:
> 
> - binutils version 2.29.1: 1.1 seconds
> - binutils version 2.33.1: 1.1 seconds
> - binutils version 2.35.2: 6.8 seconds
> - binutils version 2.36.1: 6.5 seconds
> - binutils version 2.37: Still not loaded at 6 minutes
> 
> I think the relevant binutil tool here is addr2line. Does anyone have a
> quick idea for what may have caused the slow-down? I was thinking about
> doing a git bisect, but I figured it is probably way more efficient to
> contact the experts!

The "experts" here have made lots of changes in the time between 2.33
and 2.37.  It's hard to say which one might have caused the extreme
slowdown.  Bisection is the way to go.  I hope it doesn't turn out to
be one of the many patches made for fuzzed object files, which may
help security a tiny bit but in general don't result in a better
binutils.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-08 17:44 Noted slowness in profile loading with binutils 2.37 Alexander Lindsay
  2022-02-08 17:57 ` H.J. Lu
  2022-02-09  1:09 ` Alan Modra
@ 2022-02-10 11:00 ` Nick Clifton
  2022-02-11 18:16   ` Alexander Lindsay
  2 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2022-02-10 11:00 UTC (permalink / raw)
  To: Alexander Lindsay, binutils

Hi Alexander,

> - binutils version 2.36.1: 6.5 seconds
> - binutils version 2.37: Still not loaded at 6 minutes
> 
> I think the relevant binutil tool here is addr2line. Does anyone have a
> quick idea for what may have caused the slow-down? 

It will be a change in the BFD library.  More specifically it
is likely to be a change to bfd/dwarf2.c.  Have a look at the
ChangeLog in the bfd/ directory for the 2.37 release for more
hints.

I suspect, but do not know for sure, that it could be the patch
for PR 27484 ....

Cheers
   Nick



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-10 11:00 ` Nick Clifton
@ 2022-02-11 18:16   ` Alexander Lindsay
  2022-02-11 18:17     ` Alexander Lindsay
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Lindsay @ 2022-02-11 18:16 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Binutils

Hi Nick,

This was the result of my bisect:

ca8f6bc629cb27792ce449e7253c74a3f6f75fda is the first bad commit
Date:   Tue Mar 2 16:08:23 2021 +0000

    Fix the BFD library's parsing of DIEs where specification attributes
can refer to variables that are defined later on.

            PR 27484
            * dwarf2.c (scan_unit_for_symbols): Scan twice, once to
accumulate
            function and variable tags and a second time to resolve their
            attributes.

 bfd/ChangeLog |   7 ++++
 bfd/dwarf2.c  | 133
++++++++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 114 insertions(+), 26 deletions(-)

On Thu, Feb 10, 2022 at 3:00 AM Nick Clifton <nickc@redhat.com> wrote:

> Hi Alexander,
>
> > - binutils version 2.36.1: 6.5 seconds
> > - binutils version 2.37: Still not loaded at 6 minutes
> >
> > I think the relevant binutil tool here is addr2line. Does anyone have a
> > quick idea for what may have caused the slow-down?
>
> It will be a change in the BFD library.  More specifically it
> is likely to be a change to bfd/dwarf2.c.  Have a look at the
> ChangeLog in the bfd/ directory for the 2.37 release for more
> hints.
>
> I suspect, but do not know for sure, that it could be the patch
> for PR 27484 ....
>
> Cheers
>    Nick
>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-11 18:16   ` Alexander Lindsay
@ 2022-02-11 18:17     ` Alexander Lindsay
  2022-02-14 14:18       ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Lindsay @ 2022-02-11 18:17 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Binutils

So it looks like you were spot-on

On Fri, Feb 11, 2022 at 10:16 AM Alexander Lindsay <alexlindsay239@gmail.com>
wrote:

> Hi Nick,
>
> This was the result of my bisect:
>
> ca8f6bc629cb27792ce449e7253c74a3f6f75fda is the first bad commit
> Date:   Tue Mar 2 16:08:23 2021 +0000
>
>     Fix the BFD library's parsing of DIEs where specification attributes
> can refer to variables that are defined later on.
>
>             PR 27484
>             * dwarf2.c (scan_unit_for_symbols): Scan twice, once to
> accumulate
>             function and variable tags and a second time to resolve their
>             attributes.
>
>  bfd/ChangeLog |   7 ++++
>  bfd/dwarf2.c  | 133
> ++++++++++++++++++++++++++++++++++++++++++++++------------
>  2 files changed, 114 insertions(+), 26 deletions(-)
>
> On Thu, Feb 10, 2022 at 3:00 AM Nick Clifton <nickc@redhat.com> wrote:
>
>> Hi Alexander,
>>
>> > - binutils version 2.36.1: 6.5 seconds
>> > - binutils version 2.37: Still not loaded at 6 minutes
>> >
>> > I think the relevant binutil tool here is addr2line. Does anyone have a
>> > quick idea for what may have caused the slow-down?
>>
>> It will be a change in the BFD library.  More specifically it
>> is likely to be a change to bfd/dwarf2.c.  Have a look at the
>> ChangeLog in the bfd/ directory for the 2.37 release for more
>> hints.
>>
>> I suspect, but do not know for sure, that it could be the patch
>> for PR 27484 ....
>>
>> Cheers
>>    Nick
>>
>>
>>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Noted slowness in profile loading with binutils 2.37
  2022-02-11 18:17     ` Alexander Lindsay
@ 2022-02-14 14:18       ` Nick Clifton
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Clifton @ 2022-02-14 14:18 UTC (permalink / raw)
  To: Alexander Lindsay; +Cc: Binutils

Hi Alexander,

> So it looks like you were spot-on

Yay!

The sad news is that the patch is needed for correct functionality.

>                  PR 27484
>                  * dwarf2.c (scan_unit_for_symbols): Scan twice, once to accumulate
>                  function and variable tags and a second time to resolve their
>                  attributes.

It is a "feature" of the DWARF spec that the debug info can refer
to functions and variables before their definitions are provided,
so a two pass scan is needed.

If you are feeling brave, please feel free to investigate the code
in dwarf2.c and see if there is a faster way to solve the problem.
Maybe by implementing a lazy evaluation of attributes where a function
tag is only searched for when it is referenced ?  Just an idea...

Cheers
   Nick


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-14 14:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 17:44 Noted slowness in profile loading with binutils 2.37 Alexander Lindsay
2022-02-08 17:57 ` H.J. Lu
2022-02-08 18:45   ` Alexander Lindsay
2022-02-09  1:09 ` Alan Modra
2022-02-10 11:00 ` Nick Clifton
2022-02-11 18:16   ` Alexander Lindsay
2022-02-11 18:17     ` Alexander Lindsay
2022-02-14 14:18       ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).