Loading tools/perf/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -234,8 +234,8 @@ endif export PERL_PATH FLEX = $(CROSS_COMPILE)flex BISON= $(CROSS_COMPILE)bison FLEX = flex BISON= bison $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c Loading tools/perf/builtin-report.c +12 −5 Original line number Diff line number Diff line Loading @@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep) (kernel_map->dso->hit && (kernel_kmap->ref_reloc_sym == NULL || kernel_kmap->ref_reloc_sym->addr == 0))) { const char *desc = "As no suitable kallsyms nor vmlinux was found, kernel samples\n" "can't be resolved."; if (kernel_map) { const struct dso *kdso = kernel_map->dso; if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) { desc = "If some relocation was applied (e.g. " "kexec) symbols may be misresolved."; } } ui__warning( "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" "Samples in kernel modules can't be resolved as well.\n\n", RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ? "As no suitable kallsyms nor vmlinux was found, kernel samples\n" "can't be resolved." : "If some relocation was applied (e.g. kexec) symbols may be misresolved."); desc); } if (dump_trace) { Loading tools/perf/builtin-test.c +30 −0 Original line number Diff line number Diff line Loading @@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) return test__checkevent_symbolic_name(evlist); } static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, struct perf_evsel, node); TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); return test__checkevent_symbolic_name(evlist); } static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, struct perf_evsel, node); TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); return test__checkevent_symbolic_name(evlist); } static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, Loading Loading @@ -1091,6 +1113,14 @@ static struct test__event_st { .name = "r1,syscalls:sys_enter_open:k,1:1:hp", .check = test__checkevent_list, }, { .name = "instructions:G", .check = test__checkevent_exclude_host_modifier, }, { .name = "instructions:H", .check = test__checkevent_exclude_guest_modifier, }, }; #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) Loading tools/perf/util/parse-events.l +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+ num_raw_hex [a-fA-F0-9]+ name [a-zA-Z_*?][a-zA-Z0-9_*?]* modifier_event [ukhp]{1,5} modifier_event [ukhpGH]{1,8} modifier_bp [rwx] %% Loading tools/perf/util/symbol.c +6 −7 Original line number Diff line number Diff line Loading @@ -977,7 +977,8 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, * And always look at the original dso, not at debuginfo packages, that * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). */ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, static int dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map, symbol_filter_t filter) { uint32_t nr_rel_entries, idx; Loading @@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, char sympltname[1024]; Elf *elf; int nr = 0, symidx, fd, err = 0; char name[PATH_MAX]; snprintf(name, sizeof(name), "%s%s", symbol_conf.symfs, dso->long_name); fd = open(name, O_RDONLY); if (fd < 0) goto out; Loading Loading @@ -1703,8 +1701,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) continue; if (ret > 0) { int nr_plt = dso__synthesize_plt_symbols(dso, map, filter); int nr_plt; nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter); if (nr_plt > 0) ret += nr_plt; break; Loading Loading
tools/perf/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -234,8 +234,8 @@ endif export PERL_PATH FLEX = $(CROSS_COMPILE)flex BISON= $(CROSS_COMPILE)bison FLEX = flex BISON= bison $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c Loading
tools/perf/builtin-report.c +12 −5 Original line number Diff line number Diff line Loading @@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep) (kernel_map->dso->hit && (kernel_kmap->ref_reloc_sym == NULL || kernel_kmap->ref_reloc_sym->addr == 0))) { const char *desc = "As no suitable kallsyms nor vmlinux was found, kernel samples\n" "can't be resolved."; if (kernel_map) { const struct dso *kdso = kernel_map->dso; if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) { desc = "If some relocation was applied (e.g. " "kexec) symbols may be misresolved."; } } ui__warning( "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" "Samples in kernel modules can't be resolved as well.\n\n", RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ? "As no suitable kallsyms nor vmlinux was found, kernel samples\n" "can't be resolved." : "If some relocation was applied (e.g. kexec) symbols may be misresolved."); desc); } if (dump_trace) { Loading
tools/perf/builtin-test.c +30 −0 Original line number Diff line number Diff line Loading @@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) return test__checkevent_symbolic_name(evlist); } static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, struct perf_evsel, node); TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); return test__checkevent_symbolic_name(evlist); } static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, struct perf_evsel, node); TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); return test__checkevent_symbolic_name(evlist); } static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) { struct perf_evsel *evsel = list_entry(evlist->entries.next, Loading Loading @@ -1091,6 +1113,14 @@ static struct test__event_st { .name = "r1,syscalls:sys_enter_open:k,1:1:hp", .check = test__checkevent_list, }, { .name = "instructions:G", .check = test__checkevent_exclude_host_modifier, }, { .name = "instructions:H", .check = test__checkevent_exclude_guest_modifier, }, }; #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) Loading
tools/perf/util/parse-events.l +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+ num_raw_hex [a-fA-F0-9]+ name [a-zA-Z_*?][a-zA-Z0-9_*?]* modifier_event [ukhp]{1,5} modifier_event [ukhpGH]{1,8} modifier_bp [rwx] %% Loading
tools/perf/util/symbol.c +6 −7 Original line number Diff line number Diff line Loading @@ -977,7 +977,8 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, * And always look at the original dso, not at debuginfo packages, that * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). */ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, static int dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map, symbol_filter_t filter) { uint32_t nr_rel_entries, idx; Loading @@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, char sympltname[1024]; Elf *elf; int nr = 0, symidx, fd, err = 0; char name[PATH_MAX]; snprintf(name, sizeof(name), "%s%s", symbol_conf.symfs, dso->long_name); fd = open(name, O_RDONLY); if (fd < 0) goto out; Loading Loading @@ -1703,8 +1701,9 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) continue; if (ret > 0) { int nr_plt = dso__synthesize_plt_symbols(dso, map, filter); int nr_plt; nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter); if (nr_plt > 0) ret += nr_plt; break; Loading