Pull perf fixes from Ingo Molnar. * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Fix perf_event_for_each() to use sibling perf symbols: Read plt symbols from proper symtab_type binary tracing: Fix stacktrace of latency tracers (irqsoff and friends) perf tools: Add 'G' and 'H' modifiers to event parsing tracing: Fix regression with tracing_on perf tools: Drop CROSS_COMPILE from flex and bison calls perf report: Fix crash showing warning related to kernel maps tracing: Fix build breakage without CONFIG_PERF_EVENTS (again)
Unified · Split
| @@ -3183,7 +3183,7 @@ static void perf_event_for_each(struct perf_event *event, · 3182 unmodified lines | |||
| 3183 | perf_event_for_each_child(event, func); | 3183 | perf_event_for_each_child(event, func); |
| 3184 | func(event); | 3184 | func(event); |
| 3185 | list_for_each_entry(sibling, &event->sibling_list, group_entry) | 3185 | list_for_each_entry(sibling, &event->sibling_list, group_entry) |
| 3186 | perf_event_for_each_child(event, func); | 3186 | perf_event_for_each_child(sibling, func); |
| 3187 | mutex_unlock(&ctx->mutex); | 3187 | mutex_unlock(&ctx->mutex); |
| 3188 | } | 3188 | } |
| 3189 | 3189 | ||
| @@ -4629,7 +4629,8 @@ static ssize_t · 4628 unmodified lines | |||
| 4629 | rb_simple_read(struct file *filp, char __user *ubuf, | 4629 | rb_simple_read(struct file *filp, char __user *ubuf, |
| 4630 | size_t cnt, loff_t *ppos) | 4630 | size_t cnt, loff_t *ppos) |
| 4631 | { | 4631 | { |
| 4632 | struct ring_buffer *buffer = filp->private_data; | 4632 | struct trace_array *tr = filp->private_data; |
| 4633 | struct ring_buffer *buffer = tr->buffer; | ||
| 4633 | char buf[64]; | 4634 | char buf[64]; |
| 4634 | int r; | 4635 | int r; |
| 4635 | 4636 | ||
| @@ -4647,7 +4648,8 @@ static ssize_t · 11 unmodified lines | |||
| 4647 | rb_simple_write(struct file *filp, const char __user *ubuf, | 4648 | rb_simple_write(struct file *filp, const char __user *ubuf, |
| 4648 | size_t cnt, loff_t *ppos) | 4649 | size_t cnt, loff_t *ppos) |
| 4649 | { | 4650 | { |
| 4650 | struct ring_buffer *buffer = filp->private_data; | 4651 | struct trace_array *tr = filp->private_data; |
| 4652 | struct ring_buffer *buffer = tr->buffer; | ||
| 4651 | unsigned long val; | 4653 | unsigned long val; |
| 4652 | int ret; | 4654 | int ret; |
| 4653 | 4655 | ||
| @@ -4734,7 +4736,7 @@ static __init int tracer_init_debugfs(void) · 80 unmodified lines | |||
| 4734 | &trace_clock_fops); | 4736 | &trace_clock_fops); |
| 4735 | 4737 | ||
| 4736 | trace_create_file("tracing_on", 0644, d_tracer, | 4738 | trace_create_file("tracing_on", 0644, d_tracer, |
| 4737 | global_trace.buffer, &rb_simple_fops); | 4739 | &global_trace, &rb_simple_fops); |
| 4738 | 4740 | ||
| 4739 | #ifdef CONFIG_DYNAMIC_FTRACE | 4741 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 4740 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, | 4742 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, |
| @@ -836,11 +836,11 @@ extern const char *__stop___trace_bprintk_fmt[]; · 835 unmodified lines | |||
| 836 | filter) | 836 | filter) |
| 837 | #include "trace_entries.h" | 837 | #include "trace_entries.h" |
| 838 | 838 | ||
| 839 | #ifdef CONFIG_FUNCTION_TRACER | 839 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_FUNCTION_TRACER) |
| 840 | int perf_ftrace_event_register(struct ftrace_event_call *call, | 840 | int perf_ftrace_event_register(struct ftrace_event_call *call, |
| 841 | enum trace_reg type, void *data); | 841 | enum trace_reg type, void *data); |
| 842 | #else | 842 | #else |
| 843 | #define perf_ftrace_event_register NULL | 843 | #define perf_ftrace_event_register NULL |
| 844 | #endif /* CONFIG_FUNCTION_TRACER */ | 844 | #endif |
| 845 | 845 | ||
| 846 | #endif /* _LINUX_KERNEL_TRACE_H */ | 846 | #endif /* _LINUX_KERNEL_TRACE_H */ |
| @@ -652,6 +652,8 @@ int trace_print_lat_context(struct trace_iterator *iter) · 651 unmodified lines | |||
| 652 | { | 652 | { |
| 653 | u64 next_ts; | 653 | u64 next_ts; |
| 654 | int ret; | 654 | int ret; |
| 655 | /* trace_find_next_entry will reset ent_size */ | ||
| 656 | int ent_size = iter->ent_size; | ||
| 655 | struct trace_seq *s = &iter->seq; | 657 | struct trace_seq *s = &iter->seq; |
| 656 | struct trace_entry *entry = iter->ent, | 658 | struct trace_entry *entry = iter->ent, |
| 657 | *next_entry = trace_find_next_entry(iter, NULL, | 659 | *next_entry = trace_find_next_entry(iter, NULL, |
| @@ -660,6 +662,9 @@ int trace_print_lat_context(struct trace_iterator *iter) · 2 unmodified lines | |||
| 660 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); | 662 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); |
| 661 | unsigned long rel_usecs; | 663 | unsigned long rel_usecs; |
| 662 | 664 | ||
| 665 | /* Restore the original ent_size */ | ||
| 666 | iter->ent_size = ent_size; | ||
| 667 | |||
| 663 | if (!next_entry) | 668 | if (!next_entry) |
| 664 | next_ts = iter->ts; | 669 | next_ts = iter->ts; |
| 665 | rel_usecs = ns2usecs(next_ts - iter->ts); | 670 | rel_usecs = ns2usecs(next_ts - iter->ts); |
| @@ -234,8 +234,8 @@ endif · 233 unmodified lines | |||
| 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 | $(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 |
| @@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep) · 373 unmodified lines | |||
| 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) { |
| @@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) · 850 unmodified lines | |||
| 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 { · 234 unmodified lines | |||
| 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)) |
| @@ -54,7 +54,7 @@ num_dec [0-9]+ · 53 unmodified lines | |||
| 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 | %% |
| @@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, · 976 unmodified lines | |||
| 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, · 8 unmodified lines | |||
| 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: · 700 unmodified lines | |||
| 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; |