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-sched.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-test.c | 30 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 36 | ||||
-rw-r--r-- | tools/perf/perf-archive.sh | 3 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 16 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 12 | ||||
-rw-r--r-- | tools/perf/util/map.c | 1 | ||||
-rw-r--r-- | tools/perf/util/map.h | 1 | ||||
-rw-r--r-- | tools/perf/util/parse-events.l | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 16 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 13 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 3 |
15 files changed, 135 insertions, 43 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-sched.c b/tools/perf/builtin-sched.c index fb8b5f83b4a0..1cad3af4bf4c 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "util/debug.h" | 17 | #include "util/debug.h" |
18 | 18 | ||
19 | #include <sys/prctl.h> | 19 | #include <sys/prctl.h> |
20 | #include <sys/resource.h> | ||
20 | 21 | ||
21 | #include <semaphore.h> | 22 | #include <semaphore.h> |
22 | #include <pthread.h> | 23 | #include <pthread.h> |
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/builtin-top.c b/tools/perf/builtin-top.c index e3c63aef8efc..8ef59f8262bb 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "util/debug.h" | 42 | #include "util/debug.h" |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | #include <elf.h> | ||
45 | #include <fcntl.h> | 46 | #include <fcntl.h> |
46 | 47 | ||
47 | #include <stdio.h> | 48 | #include <stdio.h> |
@@ -59,6 +60,7 @@ | |||
59 | #include <sys/prctl.h> | 60 | #include <sys/prctl.h> |
60 | #include <sys/wait.h> | 61 | #include <sys/wait.h> |
61 | #include <sys/uio.h> | 62 | #include <sys/uio.h> |
63 | #include <sys/utsname.h> | ||
62 | #include <sys/mman.h> | 64 | #include <sys/mman.h> |
63 | 65 | ||
64 | #include <linux/unistd.h> | 66 | #include <linux/unistd.h> |
@@ -162,12 +164,40 @@ static void __zero_source_counters(struct hist_entry *he) | |||
162 | symbol__annotate_zero_histograms(sym); | 164 | symbol__annotate_zero_histograms(sym); |
163 | } | 165 | } |
164 | 166 | ||
167 | static void ui__warn_map_erange(struct map *map, struct symbol *sym, u64 ip) | ||
168 | { | ||
169 | struct utsname uts; | ||
170 | int err = uname(&uts); | ||
171 | |||
172 | ui__warning("Out of bounds address found:\n\n" | ||
173 | "Addr: %" PRIx64 "\n" | ||
174 | "DSO: %s %c\n" | ||
175 | "Map: %" PRIx64 "-%" PRIx64 "\n" | ||
176 | "Symbol: %" PRIx64 "-%" PRIx64 " %c %s\n" | ||
177 | "Arch: %s\n" | ||
178 | "Kernel: %s\n" | ||
179 | "Tools: %s\n\n" | ||
180 | "Not all samples will be on the annotation output.\n\n" | ||
181 | "Please report to linux-kernel@vger.kernel.org\n", | ||
182 | ip, map->dso->long_name, dso__symtab_origin(map->dso), | ||
183 | map->start, map->end, sym->start, sym->end, | ||
184 | sym->binding == STB_GLOBAL ? 'g' : | ||
185 | sym->binding == STB_LOCAL ? 'l' : 'w', sym->name, | ||
186 | err ? "[unknown]" : uts.machine, | ||
187 | err ? "[unknown]" : uts.release, perf_version_string); | ||
188 | if (use_browser <= 0) | ||
189 | sleep(5); | ||
190 | |||
191 | map->erange_warned = true; | ||
192 | } | ||
193 | |||
165 | static void perf_top__record_precise_ip(struct perf_top *top, | 194 | static void perf_top__record_precise_ip(struct perf_top *top, |
166 | struct hist_entry *he, | 195 | struct hist_entry *he, |
167 | int counter, u64 ip) | 196 | int counter, u64 ip) |
168 | { | 197 | { |
169 | struct annotation *notes; | 198 | struct annotation *notes; |
170 | struct symbol *sym; | 199 | struct symbol *sym; |
200 | int err; | ||
171 | 201 | ||
172 | if (he == NULL || he->ms.sym == NULL || | 202 | if (he == NULL || he->ms.sym == NULL || |
173 | ((top->sym_filter_entry == NULL || | 203 | ((top->sym_filter_entry == NULL || |
@@ -189,9 +219,12 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
189 | } | 219 | } |
190 | 220 | ||
191 | ip = he->ms.map->map_ip(he->ms.map, ip); | 221 | ip = he->ms.map->map_ip(he->ms.map, ip); |
192 | symbol__inc_addr_samples(sym, he->ms.map, counter, ip); | 222 | err = symbol__inc_addr_samples(sym, he->ms.map, counter, ip); |
193 | 223 | ||
194 | pthread_mutex_unlock(¬es->lock); | 224 | pthread_mutex_unlock(¬es->lock); |
225 | |||
226 | if (err == -ERANGE && !he->ms.map->erange_warned) | ||
227 | ui__warn_map_erange(he->ms.map, sym, ip); | ||
195 | } | 228 | } |
196 | 229 | ||
197 | static void perf_top__show_details(struct perf_top *top) | 230 | static void perf_top__show_details(struct perf_top *top) |
@@ -615,6 +648,7 @@ process_hotkey: | |||
615 | 648 | ||
616 | /* Tag samples to be skipped. */ | 649 | /* Tag samples to be skipped. */ |
617 | static const char *skip_symbols[] = { | 650 | static const char *skip_symbols[] = { |
651 | "intel_idle", | ||
618 | "default_idle", | 652 | "default_idle", |
619 | "native_safe_halt", | 653 | "native_safe_halt", |
620 | "cpu_idle", | 654 | "cpu_idle", |
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/annotate.c b/tools/perf/util/annotate.c index 199f69ec656f..08c6d138a655 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -64,8 +64,8 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
64 | 64 | ||
65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); | 65 | pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr)); |
66 | 66 | ||
67 | if (addr > sym->end) | 67 | if (addr < sym->start || addr > sym->end) |
68 | return 0; | 68 | return -ERANGE; |
69 | 69 | ||
70 | offset = addr - sym->start; | 70 | offset = addr - sym->start; |
71 | h = annotation__histogram(notes, evidx); | 71 | h = annotation__histogram(notes, evidx); |
@@ -561,16 +561,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx) | |||
561 | { | 561 | { |
562 | struct annotation *notes = symbol__annotation(sym); | 562 | struct annotation *notes = symbol__annotation(sym); |
563 | struct sym_hist *h = annotation__histogram(notes, evidx); | 563 | struct sym_hist *h = annotation__histogram(notes, evidx); |
564 | struct objdump_line *pos; | 564 | int len = sym->end - sym->start, offset; |
565 | int len = sym->end - sym->start; | ||
566 | 565 | ||
567 | h->sum = 0; | 566 | h->sum = 0; |
568 | 567 | for (offset = 0; offset < len; ++offset) { | |
569 | list_for_each_entry(pos, ¬es->src->source, node) { | 568 | h->addr[offset] = h->addr[offset] * 7 / 8; |
570 | if (pos->offset != -1 && pos->offset < len) { | 569 | h->sum += h->addr[offset]; |
571 | h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8; | ||
572 | h->sum += h->addr[pos->offset]; | ||
573 | } | ||
574 | } | 570 | } |
575 | } | 571 | } |
576 | 572 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2ec4b60aff6c..9f6d630d5316 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -256,6 +256,18 @@ static struct hist_entry *add_hist_entry(struct hists *hists, | |||
256 | if (!cmp) { | 256 | if (!cmp) { |
257 | he->period += period; | 257 | he->period += period; |
258 | ++he->nr_events; | 258 | ++he->nr_events; |
259 | |||
260 | /* If the map of an existing hist_entry has | ||
261 | * become out-of-date due to an exec() or | ||
262 | * similar, update it. Otherwise we will | ||
263 | * mis-adjust symbol addresses when computing | ||
264 | * the history counter to increment. | ||
265 | */ | ||
266 | if (he->ms.map != entry->ms.map) { | ||
267 | he->ms.map = entry->ms.map; | ||
268 | if (he->ms.map) | ||
269 | he->ms.map->referenced = true; | ||
270 | } | ||
259 | goto out; | 271 | goto out; |
260 | } | 272 | } |
261 | 273 | ||
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index dea6d1c1a954..35ae56864e4f 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -38,6 +38,7 @@ void map__init(struct map *self, enum map_type type, | |||
38 | RB_CLEAR_NODE(&self->rb_node); | 38 | RB_CLEAR_NODE(&self->rb_node); |
39 | self->groups = NULL; | 39 | self->groups = NULL; |
40 | self->referenced = false; | 40 | self->referenced = false; |
41 | self->erange_warned = false; | ||
41 | } | 42 | } |
42 | 43 | ||
43 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, | 44 | struct map *map__new(struct list_head *dsos__list, u64 start, u64 len, |
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index b100c20b7f94..81371bad4ef0 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -33,6 +33,7 @@ struct map { | |||
33 | u64 end; | 33 | u64 end; |
34 | u8 /* enum map_type */ type; | 34 | u8 /* enum map_type */ type; |
35 | bool referenced; | 35 | bool referenced; |
36 | bool erange_warned; | ||
36 | u32 priv; | 37 | u32 priv; |
37 | u64 pgoff; | 38 | u64 pgoff; |
38 | 39 | ||
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 9412e3b05f68..1efd3bee6336 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -826,8 +826,16 @@ static struct machine * | |||
826 | { | 826 | { |
827 | const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 827 | const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
828 | 828 | ||
829 | if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) | 829 | if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) { |
830 | return perf_session__find_machine(session, event->ip.pid); | 830 | u32 pid; |
831 | |||
832 | if (event->header.type == PERF_RECORD_MMAP) | ||
833 | pid = event->mmap.pid; | ||
834 | else | ||
835 | pid = event->ip.pid; | ||
836 | |||
837 | return perf_session__find_machine(session, pid); | ||
838 | } | ||
831 | 839 | ||
832 | return perf_session__find_host_machine(session); | 840 | return perf_session__find_host_machine(session); |
833 | } | 841 | } |
@@ -868,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
868 | dump_sample(session, event, sample); | 876 | dump_sample(session, event, sample); |
869 | if (evsel == NULL) { | 877 | if (evsel == NULL) { |
870 | ++session->hists.stats.nr_unknown_id; | 878 | ++session->hists.stats.nr_unknown_id; |
871 | return -1; | 879 | return 0; |
872 | } | 880 | } |
873 | if (machine == NULL) { | 881 | if (machine == NULL) { |
874 | ++session->hists.stats.nr_unprocessable_samples; | 882 | ++session->hists.stats.nr_unprocessable_samples; |
875 | return -1; | 883 | return 0; |
876 | } | 884 | } |
877 | return tool->sample(tool, event, sample, evsel, machine); | 885 | return tool->sample(tool, event, sample, evsel, machine); |
878 | 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/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index d7a1c4afe28b..2f83e5dc9967 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -125,6 +125,9 @@ static int callchain__count_rows(struct rb_root *chain) | |||
125 | 125 | ||
126 | static bool map_symbol__toggle_fold(struct map_symbol *self) | 126 | static bool map_symbol__toggle_fold(struct map_symbol *self) |
127 | { | 127 | { |
128 | if (!self) | ||
129 | return false; | ||
130 | |||
128 | if (!self->has_children) | 131 | if (!self->has_children) |
129 | return false; | 132 | return false; |
130 | 133 | ||