diff options
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-bench.txt | 22 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 1 | ||||
-rw-r--r-- | tools/perf/Makefile.perf | 6 | ||||
-rw-r--r-- | tools/perf/arch/x86/tests/dwarf-unwind.c | 3 | ||||
-rw-r--r-- | tools/perf/arch/x86/tests/regs_load.S | 8 | ||||
-rw-r--r-- | tools/perf/bench/numa.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-kvm.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 11 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 53 | ||||
-rw-r--r-- | tools/perf/tests/code-reading.c | 1 | ||||
-rw-r--r-- | tools/perf/tests/make | 2 | ||||
-rw-r--r-- | tools/perf/util/data.c | 9 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 16 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 15 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 2 |
16 files changed, 122 insertions, 34 deletions
diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt index 7065cd6fbdfc..4464ad770d51 100644 --- a/tools/perf/Documentation/perf-bench.txt +++ b/tools/perf/Documentation/perf-bench.txt | |||
@@ -48,6 +48,12 @@ SUBSYSTEM | |||
48 | 'mem':: | 48 | 'mem':: |
49 | Memory access performance. | 49 | Memory access performance. |
50 | 50 | ||
51 | 'numa':: | ||
52 | NUMA scheduling and MM benchmarks. | ||
53 | |||
54 | 'futex':: | ||
55 | Futex stressing benchmarks. | ||
56 | |||
51 | 'all':: | 57 | 'all':: |
52 | All benchmark subsystems. | 58 | All benchmark subsystems. |
53 | 59 | ||
@@ -187,6 +193,22 @@ Show only the result with page faults before memset. | |||
187 | --no-prefault:: | 193 | --no-prefault:: |
188 | Show only the result without page faults before memset. | 194 | Show only the result without page faults before memset. |
189 | 195 | ||
196 | SUITES FOR 'numa' | ||
197 | ~~~~~~~~~~~~~~~~~ | ||
198 | *mem*:: | ||
199 | Suite for evaluating NUMA workloads. | ||
200 | |||
201 | SUITES FOR 'futex' | ||
202 | ~~~~~~~~~~~~~~~~~~ | ||
203 | *hash*:: | ||
204 | Suite for evaluating hash tables. | ||
205 | |||
206 | *wake*:: | ||
207 | Suite for evaluating wake calls. | ||
208 | |||
209 | *requeue*:: | ||
210 | Suite for evaluating requeue calls. | ||
211 | |||
190 | SEE ALSO | 212 | SEE ALSO |
191 | -------- | 213 | -------- |
192 | linkperf:perf[1] | 214 | linkperf:perf[1] |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index cdd8d4946dba..976b00c6cdb1 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -87,7 +87,6 @@ Default is to monitor all CPUS. | |||
87 | --realtime=<priority>:: | 87 | --realtime=<priority>:: |
88 | Collect data with this RT SCHED_FIFO priority. | 88 | Collect data with this RT SCHED_FIFO priority. |
89 | 89 | ||
90 | -s <symbol>:: | ||
91 | --sym-annotate=<symbol>:: | 90 | --sym-annotate=<symbol>:: |
92 | Annotate this symbol. | 91 | Annotate this symbol. |
93 | 92 | ||
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 50d875d970c4..895edd32930c 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -192,13 +192,13 @@ endif | |||
192 | export PERL_PATH | 192 | export PERL_PATH |
193 | 193 | ||
194 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c | 194 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c |
195 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 195 | $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l |
196 | 196 | ||
197 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y | 197 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
198 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ | 198 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ |
199 | 199 | ||
200 | $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c | 200 | $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c |
201 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 201 | $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l |
202 | 202 | ||
203 | $(OUTPUT)util/pmu-bison.c: util/pmu.y | 203 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
204 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ | 204 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_ |
@@ -589,7 +589,7 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H) | |||
589 | $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< | 589 | $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< |
590 | 590 | ||
591 | $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) | 591 | $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) |
592 | $(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) | 592 | $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) |
593 | 593 | ||
594 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS | 594 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
595 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ | 595 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ |
diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c index b602ad93ce63..83bc2385e6d3 100644 --- a/tools/perf/arch/x86/tests/dwarf-unwind.c +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c | |||
@@ -23,9 +23,10 @@ static int sample_ustack(struct perf_sample *sample, | |||
23 | 23 | ||
24 | sp = (unsigned long) regs[PERF_REG_X86_SP]; | 24 | sp = (unsigned long) regs[PERF_REG_X86_SP]; |
25 | 25 | ||
26 | map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); | 26 | map = map_groups__find(&thread->mg, MAP__VARIABLE, (u64) sp); |
27 | if (!map) { | 27 | if (!map) { |
28 | pr_debug("failed to get stack map\n"); | 28 | pr_debug("failed to get stack map\n"); |
29 | free(buf); | ||
29 | return -1; | 30 | return -1; |
30 | } | 31 | } |
31 | 32 | ||
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S index 99167bf644ea..60875d5c556c 100644 --- a/tools/perf/arch/x86/tests/regs_load.S +++ b/tools/perf/arch/x86/tests/regs_load.S | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | #include <linux/linkage.h> | 1 | #include <linux/linkage.h> |
3 | 2 | ||
4 | #define AX 0 | 3 | #define AX 0 |
@@ -90,3 +89,10 @@ ENTRY(perf_regs_load) | |||
90 | ret | 89 | ret |
91 | ENDPROC(perf_regs_load) | 90 | ENDPROC(perf_regs_load) |
92 | #endif | 91 | #endif |
92 | |||
93 | /* | ||
94 | * We need to provide note.GNU-stack section, saying that we want | ||
95 | * NOT executable stack. Otherwise the final linking will assume that | ||
96 | * the ELF stack should not be restricted at all and set it RWX. | ||
97 | */ | ||
98 | .section .note.GNU-stack,"",@progbits | ||
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 97d86d828190..ebfa163b80b5 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c | |||
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char | |||
1593 | p->data_rand_walk = true; | 1593 | p->data_rand_walk = true; |
1594 | p->nr_loops = -1; | 1594 | p->nr_loops = -1; |
1595 | p->init_random = true; | 1595 | p->init_random = true; |
1596 | p->mb_global_str = "1"; | ||
1597 | p->nr_proc = 1; | ||
1598 | p->nr_threads = 1; | ||
1599 | p->nr_secs = 5; | ||
1596 | p->run_all = argc == 1; | 1600 | p->run_all = argc == 1; |
1597 | } | 1601 | } |
1598 | 1602 | ||
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 21c164b8f9db..0f1e5a2f6ad7 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -404,6 +404,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key) | |||
404 | } | 404 | } |
405 | 405 | ||
406 | event->key = *key; | 406 | event->key = *key; |
407 | init_stats(&event->total.stats); | ||
407 | return event; | 408 | return event; |
408 | } | 409 | } |
409 | 410 | ||
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index eb524f91bffe..8ce62ef7f6c3 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -374,7 +374,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
374 | 374 | ||
375 | session = perf_session__new(file, false, NULL); | 375 | session = perf_session__new(file, false, NULL); |
376 | if (session == NULL) { | 376 | if (session == NULL) { |
377 | pr_err("Not enough memory for reading perf file header\n"); | 377 | pr_err("Perf session creation failed.\n"); |
378 | return -1; | 378 | return -1; |
379 | } | 379 | } |
380 | 380 | ||
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8b0e1c9234d9..65a151e36067 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel) | |||
174 | 174 | ||
175 | static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) | 175 | static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel) |
176 | { | 176 | { |
177 | memset(evsel->priv, 0, sizeof(struct perf_stat)); | 177 | int i; |
178 | struct perf_stat *ps = evsel->priv; | ||
179 | |||
180 | for (i = 0; i < 3; i++) | ||
181 | init_stats(&ps->res_stats[i]); | ||
178 | } | 182 | } |
179 | 183 | ||
180 | static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) | 184 | static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel) |
181 | { | 185 | { |
182 | evsel->priv = zalloc(sizeof(struct perf_stat)); | 186 | evsel->priv = zalloc(sizeof(struct perf_stat)); |
183 | return evsel->priv == NULL ? -ENOMEM : 0; | 187 | if (evsel == NULL) |
188 | return -ENOMEM; | ||
189 | perf_evsel__reset_stat_priv(evsel); | ||
190 | return 0; | ||
184 | } | 191 | } |
185 | 192 | ||
186 | static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) | 193 | static void perf_evsel__free_stat_priv(struct perf_evsel *evsel) |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index c23418225c2c..802cf544202b 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -34,6 +34,14 @@ ifeq ($(ARCH),arm) | |||
34 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | 34 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
35 | endif | 35 | endif |
36 | 36 | ||
37 | # So far there's only x86 libdw unwind support merged in perf. | ||
38 | # Disable it on all other architectures in case libdw unwind | ||
39 | # support is detected in system. Add supported architectures | ||
40 | # to the check. | ||
41 | ifneq ($(ARCH),x86) | ||
42 | NO_LIBDW_DWARF_UNWIND := 1 | ||
43 | endif | ||
44 | |||
37 | ifeq ($(LIBUNWIND_LIBS),) | 45 | ifeq ($(LIBUNWIND_LIBS),) |
38 | NO_LIBUNWIND := 1 | 46 | NO_LIBUNWIND := 1 |
39 | else | 47 | else |
@@ -65,10 +73,9 @@ ifndef NO_LIBELF | |||
65 | ifdef LIBDW_DIR | 73 | ifdef LIBDW_DIR |
66 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include | 74 | LIBDW_CFLAGS := -I$(LIBDW_DIR)/include |
67 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib | 75 | LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib |
68 | |||
69 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) | ||
70 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw | ||
71 | endif | 76 | endif |
77 | FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS) | ||
78 | FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw | ||
72 | endif | 79 | endif |
73 | 80 | ||
74 | # include ARCH specific config | 81 | # include ARCH specific config |
@@ -110,6 +117,10 @@ CFLAGS += -Wall | |||
110 | CFLAGS += -Wextra | 117 | CFLAGS += -Wextra |
111 | CFLAGS += -std=gnu99 | 118 | CFLAGS += -std=gnu99 |
112 | 119 | ||
120 | # Enforce a non-executable stack, as we may regress (again) in the future by | ||
121 | # adding assembler files missing the .GNU-stack linker note. | ||
122 | LDFLAGS += -Wl,-z,noexecstack | ||
123 | |||
113 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl | 124 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl |
114 | 125 | ||
115 | ifneq ($(OUTPUT),) | 126 | ifneq ($(OUTPUT),) |
@@ -187,7 +198,10 @@ VF_FEATURE_TESTS = \ | |||
187 | stackprotector-all \ | 198 | stackprotector-all \ |
188 | timerfd \ | 199 | timerfd \ |
189 | libunwind-debug-frame \ | 200 | libunwind-debug-frame \ |
190 | bionic | 201 | bionic \ |
202 | liberty \ | ||
203 | liberty-z \ | ||
204 | cplus-demangle | ||
191 | 205 | ||
192 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. | 206 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. |
193 | # If in the future we need per-feature checks/flags for features not | 207 | # If in the future we need per-feature checks/flags for features not |
@@ -278,6 +292,8 @@ else | |||
278 | NO_LIBELF := 1 | 292 | NO_LIBELF := 1 |
279 | NO_DWARF := 1 | 293 | NO_DWARF := 1 |
280 | NO_DEMANGLE := 1 | 294 | NO_DEMANGLE := 1 |
295 | NO_LIBUNWIND := 1 | ||
296 | NO_LIBDW_DWARF_UNWIND := 1 | ||
281 | else | 297 | else |
282 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 298 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); |
283 | endif | 299 | endif |
@@ -503,7 +519,21 @@ else | |||
503 | endif | 519 | endif |
504 | 520 | ||
505 | ifeq ($(feature-libbfd), 1) | 521 | ifeq ($(feature-libbfd), 1) |
506 | EXTLIBS += -lbfd -lz -liberty | 522 | EXTLIBS += -lbfd |
523 | |||
524 | # call all detections now so we get correct | ||
525 | # status in VF output | ||
526 | $(call feature_check,liberty) | ||
527 | $(call feature_check,liberty-z) | ||
528 | $(call feature_check,cplus-demangle) | ||
529 | |||
530 | ifeq ($(feature-liberty), 1) | ||
531 | EXTLIBS += -liberty | ||
532 | else | ||
533 | ifeq ($(feature-liberty-z), 1) | ||
534 | EXTLIBS += -liberty -lz | ||
535 | endif | ||
536 | endif | ||
507 | endif | 537 | endif |
508 | 538 | ||
509 | ifdef NO_DEMANGLE | 539 | ifdef NO_DEMANGLE |
@@ -514,15 +544,10 @@ else | |||
514 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT | 544 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
515 | else | 545 | else |
516 | ifneq ($(feature-libbfd), 1) | 546 | ifneq ($(feature-libbfd), 1) |
517 | $(call feature_check,liberty) | 547 | ifneq ($(feature-liberty), 1) |
518 | ifeq ($(feature-liberty), 1) | 548 | ifneq ($(feature-liberty-z), 1) |
519 | EXTLIBS += -lbfd -liberty | 549 | # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
520 | else | 550 | # or any of 'bfd iberty z' trinity |
521 | $(call feature_check,liberty-z) | ||
522 | ifeq ($(feature-liberty-z), 1) | ||
523 | EXTLIBS += -lbfd -liberty -lz | ||
524 | else | ||
525 | $(call feature_check,cplus-demangle) | ||
526 | ifeq ($(feature-cplus-demangle), 1) | 551 | ifeq ($(feature-cplus-demangle), 1) |
527 | EXTLIBS += -liberty | 552 | EXTLIBS += -liberty |
528 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT | 553 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 653a8fe2db95..bfb186900ac0 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore) | |||
504 | if (ret < 0) { | 504 | if (ret < 0) { |
505 | if (!excl_kernel) { | 505 | if (!excl_kernel) { |
506 | excl_kernel = true; | 506 | excl_kernel = true; |
507 | perf_evlist__set_maps(evlist, NULL, NULL); | ||
507 | perf_evlist__delete(evlist); | 508 | perf_evlist__delete(evlist); |
508 | evlist = NULL; | 509 | evlist = NULL; |
509 | continue; | 510 | continue; |
diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 5daeae1cb4c0..2f92d6e7ee00 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make | |||
@@ -46,6 +46,7 @@ make_install_man := install-man | |||
46 | make_install_html := install-html | 46 | make_install_html := install-html |
47 | make_install_info := install-info | 47 | make_install_info := install-info |
48 | make_install_pdf := install-pdf | 48 | make_install_pdf := install-pdf |
49 | make_static := LDFLAGS=-static | ||
49 | 50 | ||
50 | # all the NO_* variable combined | 51 | # all the NO_* variable combined |
51 | make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 | 52 | make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 |
@@ -87,6 +88,7 @@ run += make_install_bin | |||
87 | # run += make_install_info | 88 | # run += make_install_info |
88 | # run += make_install_pdf | 89 | # run += make_install_pdf |
89 | run += make_minimal | 90 | run += make_minimal |
91 | run += make_static | ||
90 | 92 | ||
91 | ifneq ($(call has,ctags),) | 93 | ifneq ($(call has,ctags),) |
92 | run += make_tags | 94 | run += make_tags |
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 1fbcd8bdc11b..55de44ecebef 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c | |||
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file) | |||
86 | 86 | ||
87 | static int open_file_write(struct perf_data_file *file) | 87 | static int open_file_write(struct perf_data_file *file) |
88 | { | 88 | { |
89 | int fd; | ||
90 | |||
89 | if (check_backup(file)) | 91 | if (check_backup(file)) |
90 | return -1; | 92 | return -1; |
91 | 93 | ||
92 | return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); | 94 | fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); |
95 | |||
96 | if (fd < 0) | ||
97 | pr_err("failed to open %s : %s\n", file->path, strerror(errno)); | ||
98 | |||
99 | return fd; | ||
93 | } | 100 | } |
94 | 101 | ||
95 | static int open_file(struct perf_data_file *file) | 102 | static int open_file(struct perf_data_file *file) |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index a53cd0b8c151..27c2a5efe450 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir) | |||
717 | } | 717 | } |
718 | 718 | ||
719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, | 719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, |
720 | const char *dir_name) | 720 | const char *dir_name, int depth) |
721 | { | 721 | { |
722 | struct dirent *dent; | 722 | struct dirent *dent; |
723 | DIR *dir = opendir(dir_name); | 723 | DIR *dir = opendir(dir_name); |
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg, | |||
742 | !strcmp(dent->d_name, "..")) | 742 | !strcmp(dent->d_name, "..")) |
743 | continue; | 743 | continue; |
744 | 744 | ||
745 | ret = map_groups__set_modules_path_dir(mg, path); | 745 | /* Do not follow top-level source and build symlinks */ |
746 | if (depth == 0) { | ||
747 | if (!strcmp(dent->d_name, "source") || | ||
748 | !strcmp(dent->d_name, "build")) | ||
749 | continue; | ||
750 | } | ||
751 | |||
752 | ret = map_groups__set_modules_path_dir(mg, path, | ||
753 | depth + 1); | ||
746 | if (ret < 0) | 754 | if (ret < 0) |
747 | goto out; | 755 | goto out; |
748 | } else { | 756 | } else { |
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine) | |||
786 | if (!version) | 794 | if (!version) |
787 | return -1; | 795 | return -1; |
788 | 796 | ||
789 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", | 797 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s", |
790 | machine->root_dir, version); | 798 | machine->root_dir, version); |
791 | free(version); | 799 | free(version); |
792 | 800 | ||
793 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); | 801 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); |
794 | } | 802 | } |
795 | 803 | ||
796 | static int machine__create_module(void *arg, const char *name, u64 start) | 804 | static int machine__create_module(void *arg, const char *name, u64 start) |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index df0238654698..562762117639 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg, | |||
985 | 985 | ||
986 | #if _ELFUTILS_PREREQ(0, 142) | 986 | #if _ELFUTILS_PREREQ(0, 142) |
987 | /* Get the call frame information from this dwarf */ | 987 | /* Get the call frame information from this dwarf */ |
988 | pf->cfi = dwarf_getcfi(dbg->dbg); | 988 | pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg)); |
989 | #endif | 989 | #endif |
990 | 990 | ||
991 | off = 0; | 991 | off = 0; |
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno, | |||
1441 | void *data) | 1441 | void *data) |
1442 | { | 1442 | { |
1443 | struct line_finder *lf = data; | 1443 | struct line_finder *lf = data; |
1444 | int err; | ||
1444 | 1445 | ||
1445 | if ((strtailcmp(fname, lf->fname) != 0) || | 1446 | if ((strtailcmp(fname, lf->fname) != 0) || |
1446 | (lf->lno_s > lineno || lf->lno_e < lineno)) | 1447 | (lf->lno_s > lineno || lf->lno_e < lineno)) |
1447 | return 0; | 1448 | return 0; |
1448 | 1449 | ||
1449 | if (line_range_add_line(fname, lineno, lf->lr) < 0) | 1450 | err = line_range_add_line(fname, lineno, lf->lr); |
1450 | return -EINVAL; | 1451 | if (err < 0 && err != -EEXIST) |
1452 | return err; | ||
1451 | 1453 | ||
1452 | return 0; | 1454 | return 0; |
1453 | } | 1455 | } |
@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) | |||
1473 | 1475 | ||
1474 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) | 1476 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) |
1475 | { | 1477 | { |
1476 | find_line_range_by_line(in_die, data); | 1478 | int ret = find_line_range_by_line(in_die, data); |
1477 | 1479 | ||
1478 | /* | 1480 | /* |
1479 | * We have to check all instances of inlined function, because | 1481 | * We have to check all instances of inlined function, because |
1480 | * some execution paths can be optimized out depends on the | 1482 | * some execution paths can be optimized out depends on the |
1481 | * function argument of instances | 1483 | * function argument of instances. However, if an error occurs, |
1484 | * it should be handled by the caller. | ||
1482 | */ | 1485 | */ |
1483 | return 0; | 1486 | return ret < 0 ? ret : 0; |
1484 | } | 1487 | } |
1485 | 1488 | ||
1486 | /* Search function definition from function name */ | 1489 | /* Search function definition from function name */ |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 3b7dbf51d4a9..6864661a79dd 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <inttypes.h> | 6 | #include <inttypes.h> |
7 | 7 | ||
8 | #include "symbol.h" | 8 | #include "symbol.h" |
9 | #include "vdso.h" | ||
9 | #include <symbol/kallsyms.h> | 10 | #include <symbol/kallsyms.h> |
10 | #include "debug.h" | 11 | #include "debug.h" |
11 | 12 | ||
@@ -618,6 +619,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
618 | GElf_Shdr shdr; | 619 | GElf_Shdr shdr; |
619 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || | 620 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || |
620 | ehdr.e_type == ET_REL || | 621 | ehdr.e_type == ET_REL || |
622 | is_vdso_map(dso->short_name) || | ||
621 | elf_section_by_name(elf, &ehdr, &shdr, | 623 | elf_section_by_name(elf, &ehdr, &shdr, |
622 | ".gnu.prelink_undo", | 624 | ".gnu.prelink_undo", |
623 | NULL) != NULL); | 625 | NULL) != NULL); |