diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-23 11:50:25 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-29 08:32:46 -0400 |
| commit | bb871a9c8d68692ed2513b3f0e1c010c2ac12f44 (patch) | |
| tree | a340eab65e580e5d1c41e7ef868bee3a0890e975 /tools | |
| parent | 11246c708acdfa9512d7b69c18938810c20fd6ab (diff) | |
perf tools: A thread's machine can be found via thread->mg->machine
So stop passing both machine and thread to several thread methods,
reducing function signature length.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ckcy19dcp1jfkmdihdjcqdn1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/arch/powerpc/util/skip-callchain-idx.c | 5 | ||||
| -rw-r--r-- | tools/perf/builtin-inject.c | 3 | ||||
| -rw-r--r-- | tools/perf/builtin-script.c | 7 | ||||
| -rw-r--r-- | tools/perf/builtin-timechart.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-trace.c | 6 | ||||
| -rw-r--r-- | tools/perf/tests/code-reading.c | 3 | ||||
| -rw-r--r-- | tools/perf/tests/mmap-thread-lookup.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/build-id.c | 3 | ||||
| -rw-r--r-- | tools/perf/util/callchain.h | 6 | ||||
| -rw-r--r-- | tools/perf/util/event.c | 19 | ||||
| -rw-r--r-- | tools/perf/util/event.h | 1 | ||||
| -rw-r--r-- | tools/perf/util/machine.c | 35 | ||||
| -rw-r--r-- | tools/perf/util/thread.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/thread.h | 5 | ||||
| -rw-r--r-- | tools/perf/util/unwind-libdw.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/unwind-libunwind.c | 13 |
16 files changed, 48 insertions, 70 deletions
diff --git a/tools/perf/arch/powerpc/util/skip-callchain-idx.c b/tools/perf/arch/powerpc/util/skip-callchain-idx.c index 9892b0f0bec4..3bb50eac5542 100644 --- a/tools/perf/arch/powerpc/util/skip-callchain-idx.c +++ b/tools/perf/arch/powerpc/util/skip-callchain-idx.c | |||
| @@ -232,8 +232,7 @@ out: | |||
| 232 | * index: of callchain entry that needs to be ignored (if any) | 232 | * index: of callchain entry that needs to be ignored (if any) |
| 233 | * -1 if no entry needs to be ignored or in case of errors | 233 | * -1 if no entry needs to be ignored or in case of errors |
| 234 | */ | 234 | */ |
| 235 | int arch_skip_callchain_idx(struct machine *machine, struct thread *thread, | 235 | int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain) |
| 236 | struct ip_callchain *chain) | ||
| 237 | { | 236 | { |
| 238 | struct addr_location al; | 237 | struct addr_location al; |
| 239 | struct dso *dso = NULL; | 238 | struct dso *dso = NULL; |
| @@ -246,7 +245,7 @@ int arch_skip_callchain_idx(struct machine *machine, struct thread *thread, | |||
| 246 | 245 | ||
| 247 | ip = chain->ips[2]; | 246 | ip = chain->ips[2]; |
| 248 | 247 | ||
| 249 | thread__find_addr_location(thread, machine, PERF_RECORD_MISC_USER, | 248 | thread__find_addr_location(thread, PERF_RECORD_MISC_USER, |
| 250 | MAP__FUNCTION, ip, &al); | 249 | MAP__FUNCTION, ip, &al); |
| 251 | 250 | ||
| 252 | if (al.map) | 251 | if (al.map) |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index de99ca1bb942..06f1758951f1 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
| @@ -217,8 +217,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, | |||
| 217 | goto repipe; | 217 | goto repipe; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, | 220 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, &al); |
| 221 | sample->ip, &al); | ||
| 222 | 221 | ||
| 223 | if (al.map != NULL) { | 222 | if (al.map != NULL) { |
| 224 | if (!al.map->dso->hit) { | 223 | if (!al.map->dso->hit) { |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 9708a1290571..b35517f2ceb5 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
| @@ -379,7 +379,6 @@ static void print_sample_start(struct perf_sample *sample, | |||
| 379 | 379 | ||
| 380 | static void print_sample_addr(union perf_event *event, | 380 | static void print_sample_addr(union perf_event *event, |
| 381 | struct perf_sample *sample, | 381 | struct perf_sample *sample, |
| 382 | struct machine *machine, | ||
| 383 | struct thread *thread, | 382 | struct thread *thread, |
| 384 | struct perf_event_attr *attr) | 383 | struct perf_event_attr *attr) |
| 385 | { | 384 | { |
| @@ -390,7 +389,7 @@ static void print_sample_addr(union perf_event *event, | |||
| 390 | if (!sample_addr_correlates_sym(attr)) | 389 | if (!sample_addr_correlates_sym(attr)) |
| 391 | return; | 390 | return; |
| 392 | 391 | ||
| 393 | perf_event__preprocess_sample_addr(event, sample, machine, thread, &al); | 392 | perf_event__preprocess_sample_addr(event, sample, thread, &al); |
| 394 | 393 | ||
| 395 | if (PRINT_FIELD(SYM)) { | 394 | if (PRINT_FIELD(SYM)) { |
| 396 | printf(" "); | 395 | printf(" "); |
| @@ -438,7 +437,7 @@ static void print_sample_bts(union perf_event *event, | |||
| 438 | ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) && | 437 | ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) && |
| 439 | !output[attr->type].user_set)) { | 438 | !output[attr->type].user_set)) { |
| 440 | printf(" => "); | 439 | printf(" => "); |
| 441 | print_sample_addr(event, sample, al->machine, thread, attr); | 440 | print_sample_addr(event, sample, thread, attr); |
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | if (print_srcline_last) | 443 | if (print_srcline_last) |
| @@ -475,7 +474,7 @@ static void process_event(union perf_event *event, struct perf_sample *sample, | |||
| 475 | event_format__print(evsel->tp_format, sample->cpu, | 474 | event_format__print(evsel->tp_format, sample->cpu, |
| 476 | sample->raw_data, sample->raw_size); | 475 | sample->raw_data, sample->raw_size); |
| 477 | if (PRINT_FIELD(ADDR)) | 476 | if (PRINT_FIELD(ADDR)) |
| 478 | print_sample_addr(event, sample, al->machine, thread, attr); | 477 | print_sample_addr(event, sample, thread, attr); |
| 479 | 478 | ||
| 480 | if (PRINT_FIELD(IP)) { | 479 | if (PRINT_FIELD(IP)) { |
| 481 | if (!symbol_conf.use_callchain) | 480 | if (!symbol_conf.use_callchain) |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 35b425b6293f..f5fb256d90d5 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
| @@ -528,7 +528,7 @@ static const char *cat_backtrace(union perf_event *event, | |||
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | tal.filtered = 0; | 530 | tal.filtered = 0; |
| 531 | thread__find_addr_location(al.thread, machine, cpumode, | 531 | thread__find_addr_location(al.thread, cpumode, |
| 532 | MAP__FUNCTION, ip, &tal); | 532 | MAP__FUNCTION, ip, &tal); |
| 533 | 533 | ||
| 534 | if (tal.sym) | 534 | if (tal.sym) |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index fb126459b134..83a4835c8118 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -1846,7 +1846,7 @@ static int trace__pgfault(struct trace *trace, | |||
| 1846 | if (trace->summary_only) | 1846 | if (trace->summary_only) |
| 1847 | return 0; | 1847 | return 0; |
| 1848 | 1848 | ||
| 1849 | thread__find_addr_location(thread, trace->host, cpumode, MAP__FUNCTION, | 1849 | thread__find_addr_location(thread, cpumode, MAP__FUNCTION, |
| 1850 | sample->ip, &al); | 1850 | sample->ip, &al); |
| 1851 | 1851 | ||
| 1852 | trace__fprintf_entry_head(trace, thread, 0, sample->time, trace->output); | 1852 | trace__fprintf_entry_head(trace, thread, 0, sample->time, trace->output); |
| @@ -1859,11 +1859,11 @@ static int trace__pgfault(struct trace *trace, | |||
| 1859 | 1859 | ||
| 1860 | fprintf(trace->output, "] => "); | 1860 | fprintf(trace->output, "] => "); |
| 1861 | 1861 | ||
| 1862 | thread__find_addr_location(thread, trace->host, cpumode, MAP__VARIABLE, | 1862 | thread__find_addr_location(thread, cpumode, MAP__VARIABLE, |
| 1863 | sample->addr, &al); | 1863 | sample->addr, &al); |
| 1864 | 1864 | ||
| 1865 | if (!al.map) { | 1865 | if (!al.map) { |
| 1866 | thread__find_addr_location(thread, trace->host, cpumode, | 1866 | thread__find_addr_location(thread, cpumode, |
| 1867 | MAP__FUNCTION, sample->addr, &al); | 1867 | MAP__FUNCTION, sample->addr, &al); |
| 1868 | 1868 | ||
| 1869 | if (al.map) | 1869 | if (al.map) |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 67f2d6323558..144a41236456 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
| @@ -145,8 +145,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
| 145 | 145 | ||
| 146 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); | 146 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); |
| 147 | 147 | ||
| 148 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, addr, | 148 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al); |
| 149 | &al); | ||
| 150 | if (!al.map || !al.map->dso) { | 149 | if (!al.map || !al.map->dso) { |
| 151 | pr_debug("thread__find_addr_map failed\n"); | 150 | pr_debug("thread__find_addr_map failed\n"); |
| 152 | return -1; | 151 | return -1; |
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c index 4a456fef66ca..2113f1c8611f 100644 --- a/tools/perf/tests/mmap-thread-lookup.c +++ b/tools/perf/tests/mmap-thread-lookup.c | |||
| @@ -187,7 +187,7 @@ static int mmap_events(synth_cb synth) | |||
| 187 | 187 | ||
| 188 | pr_debug("looking for map %p\n", td->map); | 188 | pr_debug("looking for map %p\n", td->map); |
| 189 | 189 | ||
| 190 | thread__find_addr_map(thread, machine, | 190 | thread__find_addr_map(thread, |
| 191 | PERF_RECORD_MISC_USER, MAP__FUNCTION, | 191 | PERF_RECORD_MISC_USER, MAP__FUNCTION, |
| 192 | (unsigned long) (td->map + 1), &al); | 192 | (unsigned long) (td->map + 1), &al); |
| 193 | 193 | ||
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index a904a4cfe7d3..2e7c68e39330 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c | |||
| @@ -33,8 +33,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, | |||
| 33 | return -1; | 33 | return -1; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, | 36 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, &al); |
| 37 | sample->ip, &al); | ||
| 38 | 37 | ||
| 39 | if (al.map != NULL) | 38 | if (al.map != NULL) |
| 40 | al.map->dso->hit = 1; | 39 | al.map->dso->hit = 1; |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 94cfefddf4db..3caccc2c173c 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
| @@ -184,11 +184,9 @@ static inline void callchain_cursor_snapshot(struct callchain_cursor *dest, | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | #ifdef HAVE_SKIP_CALLCHAIN_IDX | 186 | #ifdef HAVE_SKIP_CALLCHAIN_IDX |
| 187 | extern int arch_skip_callchain_idx(struct machine *machine, | 187 | extern int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain); |
| 188 | struct thread *thread, struct ip_callchain *chain); | ||
| 189 | #else | 188 | #else |
| 190 | static inline int arch_skip_callchain_idx(struct machine *machine __maybe_unused, | 189 | static inline int arch_skip_callchain_idx(struct thread *thread __maybe_unused, |
| 191 | struct thread *thread __maybe_unused, | ||
| 192 | struct ip_callchain *chain __maybe_unused) | 190 | struct ip_callchain *chain __maybe_unused) |
| 193 | { | 191 | { |
| 194 | return -1; | 192 | return -1; |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 4af6b279e34a..e00a29fb099f 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
| @@ -730,12 +730,12 @@ int perf_event__process(struct perf_tool *tool __maybe_unused, | |||
| 730 | return machine__process_event(machine, event, sample); | 730 | return machine__process_event(machine, event, sample); |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | void thread__find_addr_map(struct thread *thread, | 733 | void thread__find_addr_map(struct thread *thread, u8 cpumode, |
| 734 | struct machine *machine, u8 cpumode, | ||
| 735 | enum map_type type, u64 addr, | 734 | enum map_type type, u64 addr, |
| 736 | struct addr_location *al) | 735 | struct addr_location *al) |
| 737 | { | 736 | { |
| 738 | struct map_groups *mg = thread->mg; | 737 | struct map_groups *mg = thread->mg; |
| 738 | struct machine *machine = mg->machine; | ||
| 739 | bool load_map = false; | 739 | bool load_map = false; |
| 740 | 740 | ||
| 741 | al->machine = machine; | 741 | al->machine = machine; |
| @@ -806,14 +806,14 @@ try_again: | |||
| 806 | } | 806 | } |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | void thread__find_addr_location(struct thread *thread, struct machine *machine, | 809 | void thread__find_addr_location(struct thread *thread, |
| 810 | u8 cpumode, enum map_type type, u64 addr, | 810 | u8 cpumode, enum map_type type, u64 addr, |
| 811 | struct addr_location *al) | 811 | struct addr_location *al) |
| 812 | { | 812 | { |
| 813 | thread__find_addr_map(thread, machine, cpumode, type, addr, al); | 813 | thread__find_addr_map(thread, cpumode, type, addr, al); |
| 814 | if (al->map != NULL) | 814 | if (al->map != NULL) |
| 815 | al->sym = map__find_symbol(al->map, al->addr, | 815 | al->sym = map__find_symbol(al->map, al->addr, |
| 816 | machine->symbol_filter); | 816 | thread->mg->machine->symbol_filter); |
| 817 | else | 817 | else |
| 818 | al->sym = NULL; | 818 | al->sym = NULL; |
| 819 | } | 819 | } |
| @@ -842,8 +842,7 @@ int perf_event__preprocess_sample(const union perf_event *event, | |||
| 842 | machine->vmlinux_maps[MAP__FUNCTION] == NULL) | 842 | machine->vmlinux_maps[MAP__FUNCTION] == NULL) |
| 843 | machine__create_kernel_maps(machine); | 843 | machine__create_kernel_maps(machine); |
| 844 | 844 | ||
| 845 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, | 845 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->ip, al); |
| 846 | sample->ip, al); | ||
| 847 | dump_printf(" ...... dso: %s\n", | 846 | dump_printf(" ...... dso: %s\n", |
| 848 | al->map ? al->map->dso->long_name : | 847 | al->map ? al->map->dso->long_name : |
| 849 | al->level == 'H' ? "[hypervisor]" : "<not found>"); | 848 | al->level == 'H' ? "[hypervisor]" : "<not found>"); |
| @@ -902,16 +901,14 @@ bool sample_addr_correlates_sym(struct perf_event_attr *attr) | |||
| 902 | 901 | ||
| 903 | void perf_event__preprocess_sample_addr(union perf_event *event, | 902 | void perf_event__preprocess_sample_addr(union perf_event *event, |
| 904 | struct perf_sample *sample, | 903 | struct perf_sample *sample, |
| 905 | struct machine *machine, | ||
| 906 | struct thread *thread, | 904 | struct thread *thread, |
| 907 | struct addr_location *al) | 905 | struct addr_location *al) |
| 908 | { | 906 | { |
| 909 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 907 | u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
| 910 | 908 | ||
| 911 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, | 909 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, sample->addr, al); |
| 912 | sample->addr, al); | ||
| 913 | if (!al->map) | 910 | if (!al->map) |
| 914 | thread__find_addr_map(thread, machine, cpumode, MAP__VARIABLE, | 911 | thread__find_addr_map(thread, cpumode, MAP__VARIABLE, |
| 915 | sample->addr, al); | 912 | sample->addr, al); |
| 916 | 913 | ||
| 917 | al->cpu = sample->cpu; | 914 | al->cpu = sample->cpu; |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 5699e7e2a790..5f0e0b89e130 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
| @@ -322,7 +322,6 @@ bool is_bts_event(struct perf_event_attr *attr); | |||
| 322 | bool sample_addr_correlates_sym(struct perf_event_attr *attr); | 322 | bool sample_addr_correlates_sym(struct perf_event_attr *attr); |
| 323 | void perf_event__preprocess_sample_addr(union perf_event *event, | 323 | void perf_event__preprocess_sample_addr(union perf_event *event, |
| 324 | struct perf_sample *sample, | 324 | struct perf_sample *sample, |
| 325 | struct machine *machine, | ||
| 326 | struct thread *thread, | 325 | struct thread *thread, |
| 327 | struct addr_location *al); | 326 | struct addr_location *al); |
| 328 | 327 | ||
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index c70b3ff7b289..08e63fdbd14f 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -1289,7 +1289,7 @@ static bool symbol__match_regex(struct symbol *sym, regex_t *regex) | |||
| 1289 | return 0; | 1289 | return 0; |
| 1290 | } | 1290 | } |
| 1291 | 1291 | ||
| 1292 | static void ip__resolve_ams(struct machine *machine, struct thread *thread, | 1292 | static void ip__resolve_ams(struct thread *thread, |
| 1293 | struct addr_map_symbol *ams, | 1293 | struct addr_map_symbol *ams, |
| 1294 | u64 ip) | 1294 | u64 ip) |
| 1295 | { | 1295 | { |
| @@ -1303,7 +1303,7 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread, | |||
| 1303 | * Thus, we have to try consecutively until we find a match | 1303 | * Thus, we have to try consecutively until we find a match |
| 1304 | * or else, the symbol is unknown | 1304 | * or else, the symbol is unknown |
| 1305 | */ | 1305 | */ |
| 1306 | thread__find_cpumode_addr_location(thread, machine, MAP__FUNCTION, ip, &al); | 1306 | thread__find_cpumode_addr_location(thread, MAP__FUNCTION, ip, &al); |
| 1307 | 1307 | ||
| 1308 | ams->addr = ip; | 1308 | ams->addr = ip; |
| 1309 | ams->al_addr = al.addr; | 1309 | ams->al_addr = al.addr; |
| @@ -1311,23 +1311,21 @@ static void ip__resolve_ams(struct machine *machine, struct thread *thread, | |||
| 1311 | ams->map = al.map; | 1311 | ams->map = al.map; |
| 1312 | } | 1312 | } |
| 1313 | 1313 | ||
| 1314 | static void ip__resolve_data(struct machine *machine, struct thread *thread, | 1314 | static void ip__resolve_data(struct thread *thread, |
| 1315 | u8 m, struct addr_map_symbol *ams, u64 addr) | 1315 | u8 m, struct addr_map_symbol *ams, u64 addr) |
| 1316 | { | 1316 | { |
| 1317 | struct addr_location al; | 1317 | struct addr_location al; |
| 1318 | 1318 | ||
| 1319 | memset(&al, 0, sizeof(al)); | 1319 | memset(&al, 0, sizeof(al)); |
| 1320 | 1320 | ||
| 1321 | thread__find_addr_location(thread, machine, m, MAP__VARIABLE, addr, | 1321 | thread__find_addr_location(thread, m, MAP__VARIABLE, addr, &al); |
| 1322 | &al); | ||
| 1323 | if (al.map == NULL) { | 1322 | if (al.map == NULL) { |
| 1324 | /* | 1323 | /* |
| 1325 | * some shared data regions have execute bit set which puts | 1324 | * some shared data regions have execute bit set which puts |
| 1326 | * their mapping in the MAP__FUNCTION type array. | 1325 | * their mapping in the MAP__FUNCTION type array. |
| 1327 | * Check there as a fallback option before dropping the sample. | 1326 | * Check there as a fallback option before dropping the sample. |
| 1328 | */ | 1327 | */ |
| 1329 | thread__find_addr_location(thread, machine, m, MAP__FUNCTION, addr, | 1328 | thread__find_addr_location(thread, m, MAP__FUNCTION, addr, &al); |
| 1330 | &al); | ||
| 1331 | } | 1329 | } |
| 1332 | 1330 | ||
| 1333 | ams->addr = addr; | 1331 | ams->addr = addr; |
| @@ -1344,9 +1342,8 @@ struct mem_info *sample__resolve_mem(struct perf_sample *sample, | |||
| 1344 | if (!mi) | 1342 | if (!mi) |
| 1345 | return NULL; | 1343 | return NULL; |
| 1346 | 1344 | ||
| 1347 | ip__resolve_ams(al->machine, al->thread, &mi->iaddr, sample->ip); | 1345 | ip__resolve_ams(al->thread, &mi->iaddr, sample->ip); |
| 1348 | ip__resolve_data(al->machine, al->thread, al->cpumode, | 1346 | ip__resolve_data(al->thread, al->cpumode, &mi->daddr, sample->addr); |
| 1349 | &mi->daddr, sample->addr); | ||
| 1350 | mi->data_src.val = sample->data_src; | 1347 | mi->data_src.val = sample->data_src; |
| 1351 | 1348 | ||
| 1352 | return mi; | 1349 | return mi; |
| @@ -1363,15 +1360,14 @@ struct branch_info *sample__resolve_bstack(struct perf_sample *sample, | |||
| 1363 | return NULL; | 1360 | return NULL; |
| 1364 | 1361 | ||
| 1365 | for (i = 0; i < bs->nr; i++) { | 1362 | for (i = 0; i < bs->nr; i++) { |
| 1366 | ip__resolve_ams(al->machine, al->thread, &bi[i].to, bs->entries[i].to); | 1363 | ip__resolve_ams(al->thread, &bi[i].to, bs->entries[i].to); |
| 1367 | ip__resolve_ams(al->machine, al->thread, &bi[i].from, bs->entries[i].from); | 1364 | ip__resolve_ams(al->thread, &bi[i].from, bs->entries[i].from); |
| 1368 | bi[i].flags = bs->entries[i].flags; | 1365 | bi[i].flags = bs->entries[i].flags; |
| 1369 | } | 1366 | } |
| 1370 | return bi; | 1367 | return bi; |
| 1371 | } | 1368 | } |
| 1372 | 1369 | ||
| 1373 | static int machine__resolve_callchain_sample(struct machine *machine, | 1370 | static int thread__resolve_callchain_sample(struct thread *thread, |
| 1374 | struct thread *thread, | ||
| 1375 | struct ip_callchain *chain, | 1371 | struct ip_callchain *chain, |
| 1376 | struct symbol **parent, | 1372 | struct symbol **parent, |
| 1377 | struct addr_location *root_al, | 1373 | struct addr_location *root_al, |
| @@ -1395,7 +1391,7 @@ static int machine__resolve_callchain_sample(struct machine *machine, | |||
| 1395 | * Based on DWARF debug information, some architectures skip | 1391 | * Based on DWARF debug information, some architectures skip |
| 1396 | * a callchain entry saved by the kernel. | 1392 | * a callchain entry saved by the kernel. |
| 1397 | */ | 1393 | */ |
| 1398 | skip_idx = arch_skip_callchain_idx(machine, thread, chain); | 1394 | skip_idx = arch_skip_callchain_idx(thread, chain); |
| 1399 | 1395 | ||
| 1400 | for (i = 0; i < chain_nr; i++) { | 1396 | for (i = 0; i < chain_nr; i++) { |
| 1401 | u64 ip; | 1397 | u64 ip; |
| @@ -1437,7 +1433,7 @@ static int machine__resolve_callchain_sample(struct machine *machine, | |||
| 1437 | } | 1433 | } |
| 1438 | 1434 | ||
| 1439 | al.filtered = 0; | 1435 | al.filtered = 0; |
| 1440 | thread__find_addr_location(thread, machine, cpumode, | 1436 | thread__find_addr_location(thread, cpumode, |
| 1441 | MAP__FUNCTION, ip, &al); | 1437 | MAP__FUNCTION, ip, &al); |
| 1442 | if (al.sym != NULL) { | 1438 | if (al.sym != NULL) { |
| 1443 | if (sort__has_parent && !*parent && | 1439 | if (sort__has_parent && !*parent && |
| @@ -1476,11 +1472,8 @@ int machine__resolve_callchain(struct machine *machine, | |||
| 1476 | struct addr_location *root_al, | 1472 | struct addr_location *root_al, |
| 1477 | int max_stack) | 1473 | int max_stack) |
| 1478 | { | 1474 | { |
| 1479 | int ret; | 1475 | int ret = thread__resolve_callchain_sample(thread, sample->callchain, |
| 1480 | 1476 | parent, root_al, max_stack); | |
| 1481 | ret = machine__resolve_callchain_sample(machine, thread, | ||
| 1482 | sample->callchain, parent, | ||
| 1483 | root_al, max_stack); | ||
| 1484 | if (ret) | 1477 | if (ret) |
| 1485 | return ret; | 1478 | return ret; |
| 1486 | 1479 | ||
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 8db9626f6835..bf5bf858b7f6 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
| @@ -198,7 +198,6 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp) | |||
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | void thread__find_cpumode_addr_location(struct thread *thread, | 200 | void thread__find_cpumode_addr_location(struct thread *thread, |
| 201 | struct machine *machine, | ||
| 202 | enum map_type type, u64 addr, | 201 | enum map_type type, u64 addr, |
| 203 | struct addr_location *al) | 202 | struct addr_location *al) |
| 204 | { | 203 | { |
| @@ -211,8 +210,7 @@ void thread__find_cpumode_addr_location(struct thread *thread, | |||
| 211 | }; | 210 | }; |
| 212 | 211 | ||
| 213 | for (i = 0; i < ARRAY_SIZE(cpumodes); i++) { | 212 | for (i = 0; i < ARRAY_SIZE(cpumodes); i++) { |
| 214 | thread__find_addr_location(thread, machine, cpumodes[i], type, | 213 | thread__find_addr_location(thread, cpumodes[i], type, addr, al); |
| 215 | addr, al); | ||
| 216 | if (al->map) | 214 | if (al->map) |
| 217 | break; | 215 | break; |
| 218 | } | 216 | } |
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 8c75fa774706..6ef9fe6ff8da 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h | |||
| @@ -54,16 +54,15 @@ void thread__insert_map(struct thread *thread, struct map *map); | |||
| 54 | int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp); | 54 | int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp); |
| 55 | size_t thread__fprintf(struct thread *thread, FILE *fp); | 55 | size_t thread__fprintf(struct thread *thread, FILE *fp); |
| 56 | 56 | ||
| 57 | void thread__find_addr_map(struct thread *thread, struct machine *machine, | 57 | void thread__find_addr_map(struct thread *thread, |
| 58 | u8 cpumode, enum map_type type, u64 addr, | 58 | u8 cpumode, enum map_type type, u64 addr, |
| 59 | struct addr_location *al); | 59 | struct addr_location *al); |
| 60 | 60 | ||
| 61 | void thread__find_addr_location(struct thread *thread, struct machine *machine, | 61 | void thread__find_addr_location(struct thread *thread, |
| 62 | u8 cpumode, enum map_type type, u64 addr, | 62 | u8 cpumode, enum map_type type, u64 addr, |
| 63 | struct addr_location *al); | 63 | struct addr_location *al); |
| 64 | 64 | ||
| 65 | void thread__find_cpumode_addr_location(struct thread *thread, | 65 | void thread__find_cpumode_addr_location(struct thread *thread, |
| 66 | struct machine *machine, | ||
| 67 | enum map_type type, u64 addr, | 66 | enum map_type type, u64 addr, |
| 68 | struct addr_location *al); | 67 | struct addr_location *al); |
| 69 | 68 | ||
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index 7419768c38b1..f24b350ab192 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c | |||
| @@ -26,7 +26,7 @@ static int __report_module(struct addr_location *al, u64 ip, | |||
| 26 | Dwfl_Module *mod; | 26 | Dwfl_Module *mod; |
| 27 | struct dso *dso = NULL; | 27 | struct dso *dso = NULL; |
| 28 | 28 | ||
| 29 | thread__find_addr_location(ui->thread, ui->machine, | 29 | thread__find_addr_location(ui->thread, |
| 30 | PERF_RECORD_MISC_USER, | 30 | PERF_RECORD_MISC_USER, |
| 31 | MAP__FUNCTION, ip, al); | 31 | MAP__FUNCTION, ip, al); |
| 32 | 32 | ||
| @@ -89,7 +89,7 @@ static int access_dso_mem(struct unwind_info *ui, Dwarf_Addr addr, | |||
| 89 | struct addr_location al; | 89 | struct addr_location al; |
| 90 | ssize_t size; | 90 | ssize_t size; |
| 91 | 91 | ||
| 92 | thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER, | 92 | thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER, |
| 93 | MAP__FUNCTION, addr, &al); | 93 | MAP__FUNCTION, addr, &al); |
| 94 | if (!al.map) { | 94 | if (!al.map) { |
| 95 | pr_debug("unwind: no map for %lx\n", (unsigned long)addr); | 95 | pr_debug("unwind: no map for %lx\n", (unsigned long)addr); |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 4d45c0dfe343..29acc8cccb56 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
| @@ -284,7 +284,7 @@ static struct map *find_map(unw_word_t ip, struct unwind_info *ui) | |||
| 284 | { | 284 | { |
| 285 | struct addr_location al; | 285 | struct addr_location al; |
| 286 | 286 | ||
| 287 | thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER, | 287 | thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER, |
| 288 | MAP__FUNCTION, ip, &al); | 288 | MAP__FUNCTION, ip, &al); |
| 289 | return al.map; | 289 | return al.map; |
| 290 | } | 290 | } |
| @@ -374,7 +374,7 @@ static int access_dso_mem(struct unwind_info *ui, unw_word_t addr, | |||
| 374 | struct addr_location al; | 374 | struct addr_location al; |
| 375 | ssize_t size; | 375 | ssize_t size; |
| 376 | 376 | ||
| 377 | thread__find_addr_map(ui->thread, ui->machine, PERF_RECORD_MISC_USER, | 377 | thread__find_addr_map(ui->thread, PERF_RECORD_MISC_USER, |
| 378 | MAP__FUNCTION, addr, &al); | 378 | MAP__FUNCTION, addr, &al); |
| 379 | if (!al.map) { | 379 | if (!al.map) { |
| 380 | pr_debug("unwind: no map for %lx\n", (unsigned long)addr); | 380 | pr_debug("unwind: no map for %lx\n", (unsigned long)addr); |
| @@ -476,14 +476,13 @@ static void put_unwind_info(unw_addr_space_t __maybe_unused as, | |||
| 476 | pr_debug("unwind: put_unwind_info called\n"); | 476 | pr_debug("unwind: put_unwind_info called\n"); |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | static int entry(u64 ip, struct thread *thread, struct machine *machine, | 479 | static int entry(u64 ip, struct thread *thread, |
| 480 | unwind_entry_cb_t cb, void *arg) | 480 | unwind_entry_cb_t cb, void *arg) |
| 481 | { | 481 | { |
| 482 | struct unwind_entry e; | 482 | struct unwind_entry e; |
| 483 | struct addr_location al; | 483 | struct addr_location al; |
| 484 | 484 | ||
| 485 | thread__find_addr_location(thread, machine, | 485 | thread__find_addr_location(thread, PERF_RECORD_MISC_USER, |
| 486 | PERF_RECORD_MISC_USER, | ||
| 487 | MAP__FUNCTION, ip, &al); | 486 | MAP__FUNCTION, ip, &al); |
| 488 | 487 | ||
| 489 | e.ip = ip; | 488 | e.ip = ip; |
| @@ -586,7 +585,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, | |||
| 586 | unw_word_t ip; | 585 | unw_word_t ip; |
| 587 | 586 | ||
| 588 | unw_get_reg(&c, UNW_REG_IP, &ip); | 587 | unw_get_reg(&c, UNW_REG_IP, &ip); |
| 589 | ret = ip ? entry(ip, ui->thread, ui->machine, cb, arg) : 0; | 588 | ret = ip ? entry(ip, ui->thread, cb, arg) : 0; |
| 590 | } | 589 | } |
| 591 | 590 | ||
| 592 | return ret; | 591 | return ret; |
| @@ -611,7 +610,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
| 611 | if (ret) | 610 | if (ret) |
| 612 | return ret; | 611 | return ret; |
| 613 | 612 | ||
| 614 | ret = entry(ip, thread, machine, cb, arg); | 613 | ret = entry(ip, thread, cb, arg); |
| 615 | if (ret) | 614 | if (ret) |
| 616 | return -ENOMEM; | 615 | return -ENOMEM; |
| 617 | 616 | ||
