Skip to content

Commit a913ef6

Browse files
captain5050acmel
authored andcommitted
perf callchain: Always populate the addr_location map when adding IP
Dropping symbols also meant the callchain maps wasn't populated, but the callchain map is needed to find the DSO. Plumb the symbols option better, falling back to thread__find_map() rather than thread__find_symbol() when symbols are disabled. Fixes: 02b2705 ("perf callchain: Allow symbols to be optional when resolving a callchain") Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ben Gainey <[email protected]> Cc: Chaitanya S Prakash <[email protected]> Cc: Charlie Jenkins <[email protected]> Cc: Chun-Tse Shao <[email protected]> Cc: Colin Ian King <[email protected]> Cc: Dmitriy Vyukov <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Cc: Graham Woodward <[email protected]> Cc: Howard Chu <[email protected]> Cc: Ilkka Koskinen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Krzysztof Łopatowski <[email protected]> Cc: Leo Yan <[email protected]> Cc: Levi Yun <[email protected]> Cc: Li Huafei <[email protected]> Cc: [email protected] Cc: Mark Rutland <[email protected]> Cc: Martin Liška <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Song Liu <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Stephen Brennan <[email protected]> Cc: Steve Clevenger <[email protected]> Cc: Thomas Falcon <[email protected]> Cc: Veronika Molnarova <[email protected]> Cc: Weilin Wang <[email protected]> Cc: Will Deacon <[email protected]> Cc: Yicong Yang <[email protected]> Cc: Yujie Liu <[email protected]> Cc: Zhongqiu Han <[email protected]> Cc: Zixian Cai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 0df14c1 commit a913ef6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

tools/perf/util/machine.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ static void ip__resolve_ams(struct thread *thread,
20112011
* Thus, we have to try consecutively until we find a match
20122012
* or else, the symbol is unknown
20132013
*/
2014-
thread__find_cpumode_addr_location(thread, ip, &al);
2014+
thread__find_cpumode_addr_location(thread, ip, /*symbols=*/true, &al);
20152015

20162016
ams->addr = ip;
20172017
ams->al_addr = al.addr;
@@ -2113,7 +2113,7 @@ static int add_callchain_ip(struct thread *thread,
21132113
al.sym = NULL;
21142114
al.srcline = NULL;
21152115
if (!cpumode) {
2116-
thread__find_cpumode_addr_location(thread, ip, &al);
2116+
thread__find_cpumode_addr_location(thread, ip, symbols, &al);
21172117
} else {
21182118
if (ip >= PERF_CONTEXT_MAX) {
21192119
switch (ip) {
@@ -2141,6 +2141,8 @@ static int add_callchain_ip(struct thread *thread,
21412141
}
21422142
if (symbols)
21432143
thread__find_symbol(thread, *cpumode, ip, &al);
2144+
else
2145+
thread__find_map(thread, *cpumode, ip, &al);
21442146
}
21452147

21462148
if (al.sym != NULL) {

tools/perf/util/thread.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bo
410410
}
411411

412412
void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
413-
struct addr_location *al)
413+
bool symbols, struct addr_location *al)
414414
{
415415
size_t i;
416416
const u8 cpumodes[] = {
@@ -421,7 +421,11 @@ void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
421421
};
422422

423423
for (i = 0; i < ARRAY_SIZE(cpumodes); i++) {
424-
thread__find_symbol(thread, cpumodes[i], addr, al);
424+
if (symbols)
425+
thread__find_symbol(thread, cpumodes[i], addr, al);
426+
else
427+
thread__find_map(thread, cpumodes[i], addr, al);
428+
425429
if (al->map)
426430
break;
427431
}

tools/perf/util/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode,
126126
u64 addr, struct addr_location *al);
127127

128128
void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
129-
struct addr_location *al);
129+
bool symbols, struct addr_location *al);
130130

131131
int thread__memcpy(struct thread *thread, struct machine *machine,
132132
void *buf, u64 ip, int len, bool *is64bit);

0 commit comments

Comments
 (0)