aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Makefile4
-rw-r--r--tools/perf/builtin-report.c17
-rw-r--r--tools/perf/builtin-test.c30
-rw-r--r--tools/perf/util/parse-events.l2
-rw-r--r--tools/perf/util/symbol.c13
5 files changed, 51 insertions, 15 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 03059e75665..9bf3fc75934 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -234,8 +234,8 @@ endif
234 234
235export PERL_PATH 235export PERL_PATH
236 236
237FLEX = $(CROSS_COMPILE)flex 237FLEX = flex
238BISON= $(CROSS_COMPILE)bison 238BISON= bison
239 239
240$(OUTPUT)util/parse-events-flex.c: util/parse-events.l 240$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
241 $(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
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2e317438980..cdae9b2db1c 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 1c5b9801ac6..223ffdcc0fd 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
854static 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
865static 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
854static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) 876static 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/util/parse-events.l b/tools/perf/util/parse-events.l
index 05d766e3ecb..1fcf1bbc545 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -54,7 +54,7 @@ num_dec [0-9]+
54num_hex 0x[a-fA-F0-9]+ 54num_hex 0x[a-fA-F0-9]+
55num_raw_hex [a-fA-F0-9]+ 55num_raw_hex [a-fA-F0-9]+
56name [a-zA-Z_*?][a-zA-Z0-9_*?]* 56name [a-zA-Z_*?][a-zA-Z0-9_*?]*
57modifier_event [ukhp]{1,5} 57modifier_event [ukhpGH]{1,8}
58modifier_bp [rwx] 58modifier_bp [rwx]
59 59
60%% 60%%
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c0a028c3eba..ab9867b2b43 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 */
980static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, 980static int
981 symbol_filter_t filter) 981dso__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;