Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Fixup aliases checking in the 'vmlinux matches kallsyms' test

There are cases where looking at just the next and prev entries is not
enough, like with:

$ readelf -sW /usr/lib/debug/lib/modules/4.3.3-301.fc23.x86_64/vmlinux | grep ffffffff81065ec0
4979: ffffffff81065ec0 53 FUNC LOCAL DEFAULT 1 try_to_free_pud_page
4980: ffffffff81065ec0 53 FUNC LOCAL DEFAULT 1 try_to_free_pte_page
4981: ffffffff81065ec0 53 FUNC LOCAL DEFAULT 1 try_to_free_pmd_page

So just search by name to see if the symbol is in kallsyms.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-jj1vlljg7ol4i713l60rt5ai@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+5 -19
+5 -19
tools/perf/tests/vmlinux-kallsyms.c
··· 110 110 */ 111 111 for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) { 112 112 struct symbol *pair, *first_pair; 113 - bool backwards = true; 114 113 115 114 sym = rb_entry(nd, struct symbol, rb_node); 116 115 ··· 150 151 continue; 151 152 152 153 } else { 153 - struct rb_node *nnd; 154 - detour: 155 - nnd = backwards ? rb_prev(&pair->rb_node) : 156 - rb_next(&pair->rb_node); 157 - if (nnd) { 158 - struct symbol *next = rb_entry(nnd, struct symbol, rb_node); 159 - 160 - if (UM(next->start) == mem_start) { 161 - pair = next; 154 + pair = machine__find_kernel_symbol_by_name(&kallsyms, type, sym->name, NULL, NULL); 155 + if (pair) { 156 + if (UM(pair->start) == mem_start) 162 157 goto next_pair; 163 - } 164 - } 165 158 166 - if (backwards) { 167 - backwards = false; 168 - pair = first_pair; 169 - goto detour; 159 + pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n", 160 + mem_start, sym->name, pair->name); 170 161 } 171 - 172 - pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n", 173 - mem_start, sym->name, pair->name); 174 162 } 175 163 } else 176 164 pr_debug("%#" PRIx64 ": %s not on kallsyms\n",