<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/objtool/elf.c, branch v5.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-04-22T21:14:46Z</updated>
<entry>
<title>objtool: Fix off-by-one in symbol_by_offset()</title>
<updated>2020-04-22T21:14:46Z</updated>
<author>
<name>Julien Thierry</name>
<email>jthierry@redhat.com</email>
</author>
<published>2020-04-03T13:17:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7f9b34f36cf6b2099f19e679a9e8315c955ef2ee'/>
<id>urn:sha1:7f9b34f36cf6b2099f19e679a9e8315c955ef2ee</id>
<content type='text'>
Sometimes, WARN_FUNC() and other users of symbol_by_offset() will
associate the first instruction of a symbol with the symbol preceding
it.  This is because symbol-&gt;offset + symbol-&gt;len is already outside of
the symbol's range.

Fixes: 2a362ecc3ec9 ("objtool: Optimize find_symbol_*() and read_symbols()")
Signed-off-by: Julien Thierry &lt;jthierry@redhat.com&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Signed-off-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
</content>
</entry>
<entry>
<title>objtool: Optimize find_rela_by_dest_range()</title>
<updated>2020-03-25T17:28:31Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T10:30:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74b873e49d92f90deb41d1a2a8fbb70328aebd67'/>
<id>urn:sha1:74b873e49d92f90deb41d1a2a8fbb70328aebd67</id>
<content type='text'>
Perf shows there is significant time in find_rela_by_dest(); this is
because we have to iterate the address space per byte, looking for
relocation entries.

Optimize this by reducing the address space granularity.

This reduces objtool on vmlinux.o runtime from 4.8 to 4.4 seconds.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.861321325@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize read_sections()</title>
<updated>2020-03-25T17:28:30Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T10:23:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8b5fa6bc326bf02f293b5a39a8f5b3de816265d3'/>
<id>urn:sha1:8b5fa6bc326bf02f293b5a39a8f5b3de816265d3</id>
<content type='text'>
Perf showed that __hash_init() is a significant portion of
read_sections(), so instead of doing a per section rela_hash, use an
elf-wide rela_hash.

Statistics show us there are about 1.1 million relas, so size it
accordingly.

This reduces the objtool on vmlinux.o runtime to a third, from 15 to 5
seconds.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.739153726@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize find_symbol_by_name()</title>
<updated>2020-03-25T17:28:30Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T09:17:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cdb3d057a17d56363a831e486ea39e4c389a6cf9'/>
<id>urn:sha1:cdb3d057a17d56363a831e486ea39e4c389a6cf9</id>
<content type='text'>
Perf showed that find_symbol_by_name() takes time; add a symbol name
hash.

This shaves another second off of objtool on vmlinux.o runtime, down
to 15 seconds.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.676865656@infradead.org
</content>
</entry>
<entry>
<title>objtool: Rename find_containing_func()</title>
<updated>2020-03-25T17:28:29Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-16T09:36:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=53d20720bbc8718ef86fdfe53dec0accfb593ef8'/>
<id>urn:sha1:53d20720bbc8718ef86fdfe53dec0accfb593ef8</id>
<content type='text'>
For consistency; we have:

  find_symbol_by_offset() / find_symbol_containing()
  find_func_by_offset()   / find_containing_func()

fix that.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.558470724@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize find_symbol_*() and read_symbols()</title>
<updated>2020-03-25T17:28:29Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T08:34:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2a362ecc3ec9632aeea4b9a9062db91b2bd9975a'/>
<id>urn:sha1:2a362ecc3ec9632aeea4b9a9062db91b2bd9975a</id>
<content type='text'>
All of:

  read_symbols(), find_symbol_by_offset(), find_symbol_containing(),
  find_containing_func()

do a linear search of the symbols. Add an RB tree to make it go
faster.

This about halves objtool runtime on vmlinux.o, from 34s to 18s.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.499016559@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize find_section_by_name()</title>
<updated>2020-03-25T17:28:29Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T08:32:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ae358196fac3a0b4d2a7d47a4f401e3421027b03'/>
<id>urn:sha1:ae358196fac3a0b4d2a7d47a4f401e3421027b03</id>
<content type='text'>
In order to avoid yet another linear search of (20k) sections, add a
name based hash.

This reduces objtool runtime on vmlinux.o by some 10s to around 35s.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.440174280@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize find_section_by_index()</title>
<updated>2020-03-25T17:28:28Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-10T17:43:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=530389968739883a61192767e1c215653ba4ba2b'/>
<id>urn:sha1:530389968739883a61192767e1c215653ba4ba2b</id>
<content type='text'>
In order to avoid a linear search (over 20k entries), add an
section_hash to the elf object.

This reduces objtool on vmlinux.o from a few minutes to around 45
seconds.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.381249993@infradead.org
</content>
</entry>
<entry>
<title>objtool: Add a statistics mode</title>
<updated>2020-03-25T17:28:28Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-12T08:26:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1e11f3fdc326d7466e43185ea943b6156143387c'/>
<id>urn:sha1:1e11f3fdc326d7466e43185ea943b6156143387c</id>
<content type='text'>
Have it print a few numbers which can be used to size the hashtables.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.321381240@infradead.org
</content>
</entry>
<entry>
<title>objtool: Optimize find_symbol_by_index()</title>
<updated>2020-03-25T17:28:28Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>peterz@infradead.org</email>
</author>
<published>2020-03-10T17:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=65fb11a7f6aeae678043738d06248a4e21f4e4e4'/>
<id>urn:sha1:65fb11a7f6aeae678043738d06248a4e21f4e4e4</id>
<content type='text'>
The symbol index is object wide, not per section, so it makes no sense
to have the symbol_hash be part of the section object. By moving it to
the elf object we avoid the linear sections iteration.

This reduces the runtime of objtool on vmlinux.o from over 3 hours (I
gave up) to a few minutes. The defconfig vmlinux.o has around 20k
sections.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Miroslav Benes &lt;mbenes@suse.cz&gt;
Acked-by: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lkml.kernel.org/r/20200324160924.261852348@infradead.org
</content>
</entry>
</feed>
