perf thread: Make thread__find_map() search all maps

We still have the split internally, but users don't see it anymore,
simplifying the growing number of cases where we end up searching
in the MAP__VARIABLE maps.

This further paves the way for ditching the split.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-86mfxrztf310konutxvhr5ua@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo
2018-04-26 09:34:37 -03:00
parent 117d3c2474
commit 404eb5a436
5 changed files with 16 additions and 39 deletions

View File

@@ -1488,8 +1488,8 @@ int perf_event__process(struct perf_tool *tool __maybe_unused,
return machine__process_event(machine, event, sample);
}
struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
u64 addr, struct addr_location *al)
static struct map *__thread__find_map(struct thread *thread, u8 cpumode, enum map_type type,
u64 addr, struct addr_location *al)
{
struct map_groups *mg = thread->mg;
struct machine *machine = mg->machine;
@@ -1565,12 +1565,18 @@ try_again:
return al->map;
}
struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
struct addr_location *al)
{
struct map *map = __thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al);
return map ?: __thread__find_map(thread, cpumode, MAP__VARIABLE, addr, al);
}
struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
u64 addr, struct addr_location *al)
{
al->sym = NULL;
if (__thread__find_map(thread, cpumode, MAP__FUNCTION, addr, al) ||
__thread__find_map(thread, cpumode, MAP__VARIABLE, addr, al))
if (thread__find_map(thread, cpumode, addr, al))
al->sym = map__find_symbol(al->map, al->addr);
return al->sym;
}
@@ -1668,10 +1674,7 @@ bool sample_addr_correlates_sym(struct perf_event_attr *attr)
void thread__resolve(struct thread *thread, struct addr_location *al,
struct perf_sample *sample)
{
if (!thread__find_map(thread, sample->cpumode, sample->addr, al)) {
__thread__find_map(thread, sample->cpumode, MAP__VARIABLE,
sample->addr, al);
}
thread__find_map(thread, sample->cpumode, sample->addr, al);
al->cpu = sample->cpu;
al->sym = NULL;