diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/.gitignore | 2 | ||||
-rw-r--r-- | tools/perf/Makefile | 25 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 17 | ||||
-rw-r--r-- | tools/perf/builtin-test.c | 30 | ||||
-rw-r--r-- | tools/perf/perf-archive.sh | 3 | ||||
-rw-r--r-- | tools/perf/util/parse-events.l | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 13 | ||||
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 12 |
9 files changed, 75 insertions, 33 deletions
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index 416684be0ad3..26b823b61aa1 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore | |||
@@ -19,3 +19,5 @@ TAGS | |||
19 | cscope* | 19 | cscope* |
20 | config.mak | 20 | config.mak |
21 | config.mak.autogen | 21 | config.mak.autogen |
22 | *-bison.* | ||
23 | *-flex.* | ||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 820371f10d1b..9bf3fc759344 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -234,24 +234,23 @@ endif | |||
234 | 234 | ||
235 | export PERL_PATH | 235 | export PERL_PATH |
236 | 236 | ||
237 | FLEX = $(CROSS_COMPILE)flex | 237 | FLEX = flex |
238 | BISON= $(CROSS_COMPILE)bison | 238 | BISON= bison |
239 | 239 | ||
240 | event-parser: | 240 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l |
241 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | ||
242 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 241 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c |
243 | 242 | ||
244 | $(OUTPUT)util/parse-events-flex.c: event-parser | 243 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
245 | $(OUTPUT)util/parse-events-bison.c: event-parser | 244 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c |
246 | 245 | ||
247 | pmu-parser: | 246 | $(OUTPUT)util/pmu-flex.c: util/pmu.l |
248 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c | ||
249 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 247 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c |
250 | 248 | ||
251 | $(OUTPUT)util/pmu-flex.c: pmu-parser | 249 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
252 | $(OUTPUT)util/pmu-bison.c: pmu-parser | 250 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c |
253 | 251 | ||
254 | $(OUTPUT)util/parse-events.o: event-parser pmu-parser | 252 | $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c |
253 | $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c | ||
255 | 254 | ||
256 | LIB_FILE=$(OUTPUT)libperf.a | 255 | LIB_FILE=$(OUTPUT)libperf.a |
257 | 256 | ||
@@ -527,7 +526,7 @@ else | |||
527 | endif | 526 | endif |
528 | 527 | ||
529 | ifdef NO_GTK2 | 528 | ifdef NO_GTK2 |
530 | BASIC_CFLAGS += -DNO_GTK2 | 529 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT |
531 | else | 530 | else |
532 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) | 531 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) |
533 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) | 532 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) |
@@ -852,8 +851,6 @@ help: | |||
852 | @echo ' html - make html documentation' | 851 | @echo ' html - make html documentation' |
853 | @echo ' info - make GNU info documentation (access with info <foo>)' | 852 | @echo ' info - make GNU info documentation (access with info <foo>)' |
854 | @echo ' pdf - make pdf documentation' | 853 | @echo ' pdf - make pdf documentation' |
855 | @echo ' event-parser - make event parser code' | ||
856 | @echo ' pmu-parser - make pmu format parser code' | ||
857 | @echo ' TAGS - use etags to make tag information for source browsing' | 854 | @echo ' TAGS - use etags to make tag information for source browsing' |
858 | @echo ' tags - use ctags to make tag information for source browsing' | 855 | @echo ' tags - use ctags to make tag information for source browsing' |
859 | @echo ' cscope - use cscope to make interactive browsing database' | 856 | @echo ' cscope - use cscope to make interactive browsing database' |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 2e317438980b..cdae9b2db1cc 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep) | |||
374 | (kernel_map->dso->hit && | 374 | (kernel_map->dso->hit && |
375 | (kernel_kmap->ref_reloc_sym == NULL || | 375 | (kernel_kmap->ref_reloc_sym == NULL || |
376 | kernel_kmap->ref_reloc_sym->addr == 0))) { | 376 | kernel_kmap->ref_reloc_sym->addr == 0))) { |
377 | const struct dso *kdso = kernel_map->dso; | 377 | const char *desc = |
378 | "As no suitable kallsyms nor vmlinux was found, kernel samples\n" | ||
379 | "can't be resolved."; | ||
380 | |||
381 | if (kernel_map) { | ||
382 | const struct dso *kdso = kernel_map->dso; | ||
383 | if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) { | ||
384 | desc = "If some relocation was applied (e.g. " | ||
385 | "kexec) symbols may be misresolved."; | ||
386 | } | ||
387 | } | ||
378 | 388 | ||
379 | ui__warning( | 389 | ui__warning( |
380 | "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" | 390 | "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" |
381 | "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" | 391 | "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" |
382 | "Samples in kernel modules can't be resolved as well.\n\n", | 392 | "Samples in kernel modules can't be resolved as well.\n\n", |
383 | RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ? | 393 | desc); |
384 | "As no suitable kallsyms nor vmlinux was found, kernel samples\n" | ||
385 | "can't be resolved." : | ||
386 | "If some relocation was applied (e.g. kexec) symbols may be misresolved."); | ||
387 | } | 394 | } |
388 | 395 | ||
389 | if (dump_trace) { | 396 | if (dump_trace) { |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 1c5b9801ac61..223ffdcc0fd8 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) | |||
851 | return test__checkevent_symbolic_name(evlist); | 851 | return test__checkevent_symbolic_name(evlist); |
852 | } | 852 | } |
853 | 853 | ||
854 | static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) | ||
855 | { | ||
856 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
857 | struct perf_evsel, node); | ||
858 | |||
859 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
860 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | ||
861 | |||
862 | return test__checkevent_symbolic_name(evlist); | ||
863 | } | ||
864 | |||
865 | static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) | ||
866 | { | ||
867 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
868 | struct perf_evsel, node); | ||
869 | |||
870 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
871 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
872 | |||
873 | return test__checkevent_symbolic_name(evlist); | ||
874 | } | ||
875 | |||
854 | static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) | 876 | static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) |
855 | { | 877 | { |
856 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | 878 | struct perf_evsel *evsel = list_entry(evlist->entries.next, |
@@ -1091,6 +1113,14 @@ static struct test__event_st { | |||
1091 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", | 1113 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", |
1092 | .check = test__checkevent_list, | 1114 | .check = test__checkevent_list, |
1093 | }, | 1115 | }, |
1116 | { | ||
1117 | .name = "instructions:G", | ||
1118 | .check = test__checkevent_exclude_host_modifier, | ||
1119 | }, | ||
1120 | { | ||
1121 | .name = "instructions:H", | ||
1122 | .check = test__checkevent_exclude_guest_modifier, | ||
1123 | }, | ||
1094 | }; | 1124 | }; |
1095 | 1125 | ||
1096 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) | 1126 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) |
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh index 677e59d62a8d..95b6f8b6177a 100644 --- a/tools/perf/perf-archive.sh +++ b/tools/perf/perf-archive.sh | |||
@@ -29,13 +29,14 @@ if [ ! -s $BUILDIDS ] ; then | |||
29 | fi | 29 | fi |
30 | 30 | ||
31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) | 31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) |
32 | PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/ | ||
32 | 33 | ||
33 | cut -d ' ' -f 1 $BUILDIDS | \ | 34 | cut -d ' ' -f 1 $BUILDIDS | \ |
34 | while read build_id ; do | 35 | while read build_id ; do |
35 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} | 36 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} |
36 | filename=$(readlink -f $linkname) | 37 | filename=$(readlink -f $linkname) |
37 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST | 38 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST |
38 | echo ${filename#$PERF_BUILDID_DIR} >> $MANIFEST | 39 | echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST |
39 | done | 40 | done |
40 | 41 | ||
41 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST | 42 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 05d766e3ecb5..1fcf1bbc5458 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -54,7 +54,7 @@ num_dec [0-9]+ | |||
54 | num_hex 0x[a-fA-F0-9]+ | 54 | num_hex 0x[a-fA-F0-9]+ |
55 | num_raw_hex [a-fA-F0-9]+ | 55 | num_raw_hex [a-fA-F0-9]+ |
56 | name [a-zA-Z_*?][a-zA-Z0-9_*?]* | 56 | name [a-zA-Z_*?][a-zA-Z0-9_*?]* |
57 | modifier_event [ukhp]{1,5} | 57 | modifier_event [ukhpGH]{1,8} |
58 | modifier_bp [rwx] | 58 | modifier_bp [rwx] |
59 | 59 | ||
60 | %% | 60 | %% |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 00923cda4d9c..1efd3bee6336 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -876,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
876 | dump_sample(session, event, sample); | 876 | dump_sample(session, event, sample); |
877 | if (evsel == NULL) { | 877 | if (evsel == NULL) { |
878 | ++session->hists.stats.nr_unknown_id; | 878 | ++session->hists.stats.nr_unknown_id; |
879 | return -1; | 879 | return 0; |
880 | } | 880 | } |
881 | if (machine == NULL) { | 881 | if (machine == NULL) { |
882 | ++session->hists.stats.nr_unprocessable_samples; | 882 | ++session->hists.stats.nr_unprocessable_samples; |
883 | return -1; | 883 | return 0; |
884 | } | 884 | } |
885 | return tool->sample(tool, event, sample, evsel, machine); | 885 | return tool->sample(tool, event, sample, evsel, machine); |
886 | case PERF_RECORD_MMAP: | 886 | case PERF_RECORD_MMAP: |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index c0a028c3ebaf..ab9867b2b433 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, | |||
977 | * And always look at the original dso, not at debuginfo packages, that | 977 | * And always look at the original dso, not at debuginfo packages, that |
978 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). | 978 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). |
979 | */ | 979 | */ |
980 | static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, | 980 | static int |
981 | symbol_filter_t filter) | 981 | dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map, |
982 | symbol_filter_t filter) | ||
982 | { | 983 | { |
983 | uint32_t nr_rel_entries, idx; | 984 | uint32_t nr_rel_entries, idx; |
984 | GElf_Sym sym; | 985 | GElf_Sym sym; |
@@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, | |||
993 | char sympltname[1024]; | 994 | char sympltname[1024]; |
994 | Elf *elf; | 995 | Elf *elf; |
995 | int nr = 0, symidx, fd, err = 0; | 996 | int nr = 0, symidx, fd, err = 0; |
996 | char name[PATH_MAX]; | ||
997 | 997 | ||
998 | snprintf(name, sizeof(name), "%s%s", | ||
999 | symbol_conf.symfs, dso->long_name); | ||
1000 | fd = open(name, O_RDONLY); | 998 | fd = open(name, O_RDONLY); |
1001 | if (fd < 0) | 999 | if (fd < 0) |
1002 | goto out; | 1000 | goto out; |
@@ -1703,8 +1701,9 @@ restart: | |||
1703 | continue; | 1701 | continue; |
1704 | 1702 | ||
1705 | if (ret > 0) { | 1703 | if (ret > 0) { |
1706 | int nr_plt = dso__synthesize_plt_symbols(dso, map, | 1704 | int nr_plt; |
1707 | filter); | 1705 | |
1706 | nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter); | ||
1708 | if (nr_plt > 0) | 1707 | if (nr_plt > 0) |
1709 | ret += nr_plt; | 1708 | ret += nr_plt; |
1710 | break; | 1709 | break; |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 95d6a6f7c33a..4915408f6a98 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -183,6 +183,9 @@ my %force_config; | |||
183 | # do not force reboots on config problems | 183 | # do not force reboots on config problems |
184 | my $no_reboot = 1; | 184 | my $no_reboot = 1; |
185 | 185 | ||
186 | # reboot on success | ||
187 | my $reboot_success = 0; | ||
188 | |||
186 | my %option_map = ( | 189 | my %option_map = ( |
187 | "MACHINE" => \$machine, | 190 | "MACHINE" => \$machine, |
188 | "SSH_USER" => \$ssh_user, | 191 | "SSH_USER" => \$ssh_user, |
@@ -2192,7 +2195,7 @@ sub run_bisect { | |||
2192 | } | 2195 | } |
2193 | 2196 | ||
2194 | # Are we looking for where it worked, not failed? | 2197 | # Are we looking for where it worked, not failed? |
2195 | if ($reverse_bisect) { | 2198 | if ($reverse_bisect && $ret >= 0) { |
2196 | $ret = !$ret; | 2199 | $ret = !$ret; |
2197 | } | 2200 | } |
2198 | 2201 | ||
@@ -3469,6 +3472,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3469 | 3472 | ||
3470 | # Do not reboot on failing test options | 3473 | # Do not reboot on failing test options |
3471 | $no_reboot = 1; | 3474 | $no_reboot = 1; |
3475 | $reboot_success = 0; | ||
3472 | 3476 | ||
3473 | $iteration = $i; | 3477 | $iteration = $i; |
3474 | 3478 | ||
@@ -3554,9 +3558,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3554 | die "failed to checkout $checkout"; | 3558 | die "failed to checkout $checkout"; |
3555 | } | 3559 | } |
3556 | 3560 | ||
3561 | $no_reboot = 0; | ||
3562 | |||
3557 | # A test may opt to not reboot the box | 3563 | # A test may opt to not reboot the box |
3558 | if ($reboot_on_success) { | 3564 | if ($reboot_on_success) { |
3559 | $no_reboot = 0; | 3565 | $reboot_success = 1; |
3560 | } | 3566 | } |
3561 | 3567 | ||
3562 | if ($test_type eq "bisect") { | 3568 | if ($test_type eq "bisect") { |
@@ -3600,7 +3606,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3600 | 3606 | ||
3601 | if ($opt{"POWEROFF_ON_SUCCESS"}) { | 3607 | if ($opt{"POWEROFF_ON_SUCCESS"}) { |
3602 | halt; | 3608 | halt; |
3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3609 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) { |
3604 | reboot_to_good; | 3610 | reboot_to_good; |
3605 | } elsif (defined($switch_to_good)) { | 3611 | } elsif (defined($switch_to_good)) { |
3606 | # still need to get to the good kernel | 3612 | # still need to get to the good kernel |