Skip to contentSkip to conversation

perf symbols: Fixup symbol sizes before picking best ones

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Sep 5, 2016 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  432746f8e0b6a82ba832b771afe31abd51af6752
Gitweb:     http://git.kernel.org/tip/432746f8e0b6a82ba832b771afe31abd51af6752
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 1 Sep 2016 11:00:23 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 1 Sep 2016 12:42:24 -0300

perf symbols: Fixup symbol sizes before picking best ones

When we call symbol__fixup_duplicate() we use algorithms to pick the "best" symbols for cases where there are various functions/aliases to an address, and those check zero size symbols, which, before calling symbol__fixup_end() are _all_ symbols in a just parsed kallsyms file.

So first fixup the end, then fixup the duplicates.

Found while trying to figure out why 'perf test vmlinux' failed, see the output of 'perf test -v vmlinux' to see cases where the symbols picked as best for vmlinux don't match the ones picked for kallsyms.

Cc Anton Blanchard <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Fixes 694bf407b061 ("perf symbols: Add some heuristics for choosing the best duplicate symbol")
---
 tools/perf/util/symbol-elf.c | 2 +-
 tools/perf/util/symbol.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +1 -1
index 9ba6e49..295d314 100644
@@ -1136,8 +1136,8 @@ new_symbol:
 	 * For misannotated, zeroed, ASM function sizes.
 	 */
 	if (nr > 0) {
-		symbols__fixup_duplicate(&dso->symbols[map->type]);
 		symbols__fixup_end(&dso->symbols[map->type]);
+		symbols__fixup_duplicate(&dso->symbols[map->type]);
 		if (kmap) {
 			/*
 			 * We need to fixup this here too because we create new
tools/perf/util/symbol.c +1 -1
index ef2f913..98cd503 100644
@@ -1243,8 +1243,8 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
 	if (kallsyms__delta(map, filename, &delta))
 		return -1;
 
-	symbols__fixup_duplicate(&dso->symbols[map->type]);
 	symbols__fixup_end(&dso->symbols[map->type]);
+	symbols__fixup_duplicate(&dso->symbols[map->type]);
 
 	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
 		dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS;