Bug 13897 - objdump (ppc64) performance has severely degraded in the binutils 2.22.52_0322
Summary: objdump (ppc64) performance has severely degraded in the binutils 2.22.52_0322
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-23 21:59 UTC by John Russo
Modified: 2012-06-03 04:09 UTC (History)
3 users (show)

See Also:
Host: Linux 2.6.35.6-45.fc14.x86_64
Target: ELF 64-bit MSB executable, 64-bit PowerPC
Build:
Last reconfirmed:


Attachments
tarball containing ELF file I used to test. (309.69 KB, application/x-bzip2)
2012-03-23 21:59 UTC, John Russo
Details
Speed up opd_entry_value() when there are no relocs. (736 bytes, patch)
2012-04-02 09:44 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Russo 2012-03-23 21:59:12 UTC
Created attachment 6300 [details]
tarball containing ELF file I used to test.

We're disassembling the attached file with:

./objdump -d -S -x mtwx53252-core0.elf > out

With binutils 2.22.51, this disassembly happens in

real	0m6.501s
user	0m6.475s
sys	0m0.018s

With binutils 2.22.52 0322 snaphsot, I get:

real	12m23.685s
user	9m0.350s
sys	3m19.035s

12 minutes now vs. 6 seconds previously.

The -S flag is key, performance is fine if -S is excluded from the command.

target:
mtwx53252-core0.elf: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, not stripped

host:
./objdump -v
GNU objdump (GNU Binutils) 2.22.52.20120322

uname -a
Linux  2.6.35.6-45.fc14.x86_64 #1 SMP Mon Oct 18 23:57:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Nick Clifton 2012-04-02 09:44:31 UTC
Created attachment 6311 [details]
Speed up opd_entry_value() when there are no relocs.
Comment 2 Nick Clifton 2012-04-02 09:45:06 UTC
Hi John,

  Please could you try out the uploaded patch and let me know if it works for you.

Cheers
  Nick
Comment 3 Sourceware Commits 2012-04-11 14:16:18 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2012-04-11 14:16:10

Modified files:
	bfd            : ChangeLog elf64-ppc.c 

Log message:
	PR binutils/13897
	* elf64-ppc.c (opd_entry_value): When dealing with sections
	without relocs, keep the last section loaded in order to avoid
	unnecessary reloads.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5647&r2=1.5648
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.378&r2=1.379
Comment 4 Nick Clifton 2012-04-11 14:58:32 UTC
Fixed.
Comment 5 Sourceware Commits 2012-06-01 12:27:05 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2012-06-01 12:26:56

Modified files:
	bfd            : ChangeLog elf64-ppc.c 

Log message:
	PR binutils/13897
	* elf64-ppc.c (opd_entry_value): Rewrite cache code.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5716&r2=1.5717
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.385&r2=1.386
Comment 6 Alan Modra 2012-06-02 13:06:44 UTC
That last patch, while correcting the caching in opd_entry_value, makes addr2line, objdump -S etc. as slow as it was before.  In fact, the cache makes it even slower!  When you consider that opd_entry_value gets called from a loop over symbols within elf_find_function, the reason is obvious: We sequentially look at all function symbols on each call to elf_find_function so nothing can be cached.  Well, there may be some benefit in caching the entire .opd section to avoid making syscalls, but it turns out the section search in opd_entry_value is the most expensive operation.  Investigating..
Comment 7 Sourceware Commits 2012-06-03 04:08:16 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2012-06-03 04:08:07

Modified files:
	bfd            : ChangeLog elf-bfd.h elf.c elf64-ppc.c 

Log message:
	PR binutils/13897
	* elf.c (elf_find_function): Cache last function sym info.
	(_bfd_elf_maybe_function_sym): Return function size, pass in
	section of interest.
	* elf-bfd.h (struct elf_backend_data <maybe_function_sym>): Likewise.
	(_bfd_elf_maybe_function_sym): Likewise.
	* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
	(opd_entry_value): Add in_code_sec param.  Revert caching code.
	Return -1 if in_code_sec and function found in wrong section.
	Update all calls.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5718&r2=1.5719
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf-bfd.h.diff?cvsroot=src&r1=1.340&r2=1.341
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.556&r2=1.557
http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.386&r2=1.387
Comment 8 Alan Modra 2012-06-03 04:09:14 UTC
Fixed.