diff options
Diffstat (limited to 'tools/perf/util/machine.c')
-rw-r--r-- | tools/perf/util/machine.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 813e94e7cf29..a6799538069c 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1184,39 +1184,22 @@ static bool symbol__match_regex(struct symbol *sym, regex_t *regex) | |||
1184 | return 0; | 1184 | return 0; |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static const u8 cpumodes[] = { | ||
1188 | PERF_RECORD_MISC_USER, | ||
1189 | PERF_RECORD_MISC_KERNEL, | ||
1190 | PERF_RECORD_MISC_GUEST_USER, | ||
1191 | PERF_RECORD_MISC_GUEST_KERNEL | ||
1192 | }; | ||
1193 | #define NCPUMODES (sizeof(cpumodes)/sizeof(u8)) | ||
1194 | |||
1195 | static void ip__resolve_ams(struct machine *machine, struct thread *thread, | 1187 | static void ip__resolve_ams(struct machine *machine, struct thread *thread, |
1196 | struct addr_map_symbol *ams, | 1188 | struct addr_map_symbol *ams, |
1197 | u64 ip) | 1189 | u64 ip) |
1198 | { | 1190 | { |
1199 | struct addr_location al; | 1191 | struct addr_location al; |
1200 | size_t i; | ||
1201 | u8 m; | ||
1202 | 1192 | ||
1203 | memset(&al, 0, sizeof(al)); | 1193 | memset(&al, 0, sizeof(al)); |
1194 | /* | ||
1195 | * We cannot use the header.misc hint to determine whether a | ||
1196 | * branch stack address is user, kernel, guest, hypervisor. | ||
1197 | * Branches may straddle the kernel/user/hypervisor boundaries. | ||
1198 | * Thus, we have to try consecutively until we find a match | ||
1199 | * or else, the symbol is unknown | ||
1200 | */ | ||
1201 | thread__find_cpumode_addr_location(thread, machine, MAP__FUNCTION, ip, &al); | ||
1204 | 1202 | ||
1205 | for (i = 0; i < NCPUMODES; i++) { | ||
1206 | m = cpumodes[i]; | ||
1207 | /* | ||
1208 | * We cannot use the header.misc hint to determine whether a | ||
1209 | * branch stack address is user, kernel, guest, hypervisor. | ||
1210 | * Branches may straddle the kernel/user/hypervisor boundaries. | ||
1211 | * Thus, we have to try consecutively until we find a match | ||
1212 | * or else, the symbol is unknown | ||
1213 | */ | ||
1214 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, | ||
1215 | ip, &al); | ||
1216 | if (al.map) | ||
1217 | goto found; | ||
1218 | } | ||
1219 | found: | ||
1220 | ams->addr = ip; | 1203 | ams->addr = ip; |
1221 | ams->al_addr = al.addr; | 1204 | ams->al_addr = al.addr; |
1222 | ams->sym = al.sym; | 1205 | ams->sym = al.sym; |