diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-01 12:50:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-01 12:50:58 -0400 |
| commit | 2519d3b0f3381beca7b391b516c9c8f5dfd620a4 (patch) | |
| tree | 493654595b8b0b9260b96d3afcfc558bb0012403 | |
| parent | f4961366866ee34cf303b6951a5bad851be5b6fd (diff) | |
| parent | 399f0c220a0ee97a5a9ea1a699a58fe2aacf2983 (diff) | |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"Mostly tooling fixes, plus an Intel RAPL PMU driver fix"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf tests x86: Fix stack map lookup in dwarf unwind test
perf x86: Fix perf to use non-executable stack, again
perf tools: Remove extra '/' character in events file path
perf machine: Search for modules in %s/lib/modules/%s
perf tests: Add static build make test
perf tools: Fix bfd dependency libraries detection
perf tools: Use LDFLAGS instead of ALL_LDFLAGS
perf/x86: Fix RAPL rdmsrl_safe() usage
tools lib traceevent: Fix memory leak in pretty_print()
tools lib traceevent: Fix backward compatibility macros for pevent filter enums
perf tools: Disable libdw unwind for all but x86 arch
perf tests x86: Fix memory leak in sample_ustack()
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_rapl.c | 3 | ||||
| -rw-r--r-- | tools/lib/api/fs/debugfs.c | 4 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.c | 1 | ||||
| -rw-r--r-- | tools/lib/traceevent/event-parse.h | 4 | ||||
| -rw-r--r-- | tools/perf/Makefile.perf | 2 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/dwarf-unwind.c | 3 | ||||
| -rw-r--r-- | tools/perf/arch/x86/tests/regs_load.S | 8 | ||||
| -rw-r--r-- | tools/perf/config/Makefile | 46 | ||||
| -rw-r--r-- | tools/perf/tests/make | 2 | ||||
| -rw-r--r-- | tools/perf/util/machine.c | 16 |
10 files changed, 66 insertions, 23 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c index 7c87424d4140..619f7699487a 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c +++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c | |||
| @@ -543,7 +543,8 @@ static int rapl_cpu_prepare(int cpu) | |||
| 543 | if (phys_id < 0) | 543 | if (phys_id < 0) |
| 544 | return -1; | 544 | return -1; |
| 545 | 545 | ||
| 546 | if (!rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) | 546 | /* protect rdmsrl() to handle virtualization */ |
| 547 | if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &msr_rapl_power_unit_bits)) | ||
| 547 | return -1; | 548 | return -1; |
| 548 | 549 | ||
| 549 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); | 550 | pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu)); |
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c index 7c4347962353..a74fba6d7743 100644 --- a/tools/lib/api/fs/debugfs.c +++ b/tools/lib/api/fs/debugfs.c | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; | 12 | char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; |
| 13 | 13 | ||
| 14 | static const char * const debugfs_known_mountpoints[] = { | 14 | static const char * const debugfs_known_mountpoints[] = { |
| 15 | "/sys/kernel/debug/", | 15 | "/sys/kernel/debug", |
| 16 | "/debug/", | 16 | "/debug", |
| 17 | 0, | 17 | 0, |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index baec7d887da4..b83184f2d484 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
| @@ -4344,6 +4344,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
| 4344 | format, len_arg, arg); | 4344 | format, len_arg, arg); |
| 4345 | trace_seq_terminate(&p); | 4345 | trace_seq_terminate(&p); |
| 4346 | trace_seq_puts(s, p.buffer); | 4346 | trace_seq_puts(s, p.buffer); |
| 4347 | trace_seq_destroy(&p); | ||
| 4347 | arg = arg->next; | 4348 | arg = arg->next; |
| 4348 | break; | 4349 | break; |
| 4349 | default: | 4350 | default: |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 791c539374c7..feab94281634 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
| @@ -876,8 +876,8 @@ struct event_filter { | |||
| 876 | struct event_filter *pevent_filter_alloc(struct pevent *pevent); | 876 | struct event_filter *pevent_filter_alloc(struct pevent *pevent); |
| 877 | 877 | ||
| 878 | /* for backward compatibility */ | 878 | /* for backward compatibility */ |
| 879 | #define FILTER_NONE PEVENT_ERRNO__FILTER_NOT_FOUND | 879 | #define FILTER_NONE PEVENT_ERRNO__NO_FILTER |
| 880 | #define FILTER_NOEXIST PEVENT_ERRNO__NO_FILTER | 880 | #define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND |
| 881 | #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS | 881 | #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS |
| 882 | #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH | 882 | #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH |
| 883 | 883 | ||
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index e96923310d57..895edd32930c 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
| @@ -589,7 +589,7 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H) | |||
| 589 | $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< | 589 | $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< |
| 590 | 590 | ||
| 591 | $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) | 591 | $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS) |
| 592 | $(QUIET_LINK)$(CC) -o $@ -shared $(ALL_LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) | 592 | $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS) |
| 593 | 593 | ||
| 594 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS | 594 | $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS |
| 595 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ | 595 | $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ |
diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c index b602ad93ce63..83bc2385e6d3 100644 --- a/tools/perf/arch/x86/tests/dwarf-unwind.c +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c | |||
| @@ -23,9 +23,10 @@ static int sample_ustack(struct perf_sample *sample, | |||
| 23 | 23 | ||
| 24 | sp = (unsigned long) regs[PERF_REG_X86_SP]; | 24 | sp = (unsigned long) regs[PERF_REG_X86_SP]; |
| 25 | 25 | ||
| 26 | map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); | 26 | map = map_groups__find(&thread->mg, MAP__VARIABLE, (u64) sp); |
| 27 | if (!map) { | 27 | if (!map) { |
| 28 | pr_debug("failed to get stack map\n"); | 28 | pr_debug("failed to get stack map\n"); |
| 29 | free(buf); | ||
| 29 | return -1; | 30 | return -1; |
| 30 | } | 31 | } |
| 31 | 32 | ||
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S index 99167bf644ea..60875d5c556c 100644 --- a/tools/perf/arch/x86/tests/regs_load.S +++ b/tools/perf/arch/x86/tests/regs_load.S | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | #include <linux/linkage.h> | 1 | #include <linux/linkage.h> |
| 3 | 2 | ||
| 4 | #define AX 0 | 3 | #define AX 0 |
| @@ -90,3 +89,10 @@ ENTRY(perf_regs_load) | |||
| 90 | ret | 89 | ret |
| 91 | ENDPROC(perf_regs_load) | 90 | ENDPROC(perf_regs_load) |
| 92 | #endif | 91 | #endif |
| 92 | |||
| 93 | /* | ||
| 94 | * We need to provide note.GNU-stack section, saying that we want | ||
| 95 | * NOT executable stack. Otherwise the final linking will assume that | ||
| 96 | * the ELF stack should not be restricted at all and set it RWX. | ||
| 97 | */ | ||
| 98 | .section .note.GNU-stack,"",@progbits | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index ee21fa95ebcf..802cf544202b 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
| @@ -34,6 +34,14 @@ ifeq ($(ARCH),arm) | |||
| 34 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | 34 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
| 35 | endif | 35 | endif |
| 36 | 36 | ||
| 37 | # So far there's only x86 libdw unwind support merged in perf. | ||
| 38 | # Disable it on all other architectures in case libdw unwind | ||
| 39 | # support is detected in system. Add supported architectures | ||
| 40 | # to the check. | ||
| 41 | ifneq ($(ARCH),x86) | ||
| 42 | NO_LIBDW_DWARF_UNWIND := 1 | ||
| 43 | endif | ||
| 44 | |||
| 37 | ifeq ($(LIBUNWIND_LIBS),) | 45 | ifeq ($(LIBUNWIND_LIBS),) |
| 38 | NO_LIBUNWIND := 1 | 46 | NO_LIBUNWIND := 1 |
| 39 | else | 47 | else |
| @@ -109,6 +117,10 @@ CFLAGS += -Wall | |||
| 109 | CFLAGS += -Wextra | 117 | CFLAGS += -Wextra |
| 110 | CFLAGS += -std=gnu99 | 118 | CFLAGS += -std=gnu99 |
| 111 | 119 | ||
| 120 | # Enforce a non-executable stack, as we may regress (again) in the future by | ||
| 121 | # adding assembler files missing the .GNU-stack linker note. | ||
| 122 | LDFLAGS += -Wl,-z,noexecstack | ||
| 123 | |||
| 112 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl | 124 | EXTLIBS = -lelf -lpthread -lrt -lm -ldl |
| 113 | 125 | ||
| 114 | ifneq ($(OUTPUT),) | 126 | ifneq ($(OUTPUT),) |
| @@ -186,7 +198,10 @@ VF_FEATURE_TESTS = \ | |||
| 186 | stackprotector-all \ | 198 | stackprotector-all \ |
| 187 | timerfd \ | 199 | timerfd \ |
| 188 | libunwind-debug-frame \ | 200 | libunwind-debug-frame \ |
| 189 | bionic | 201 | bionic \ |
| 202 | liberty \ | ||
| 203 | liberty-z \ | ||
| 204 | cplus-demangle | ||
| 190 | 205 | ||
| 191 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. | 206 | # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. |
| 192 | # If in the future we need per-feature checks/flags for features not | 207 | # If in the future we need per-feature checks/flags for features not |
| @@ -504,7 +519,21 @@ else | |||
| 504 | endif | 519 | endif |
| 505 | 520 | ||
| 506 | ifeq ($(feature-libbfd), 1) | 521 | ifeq ($(feature-libbfd), 1) |
| 507 | EXTLIBS += -lbfd -lz -liberty | 522 | EXTLIBS += -lbfd |
| 523 | |||
| 524 | # call all detections now so we get correct | ||
| 525 | # status in VF output | ||
| 526 | $(call feature_check,liberty) | ||
| 527 | $(call feature_check,liberty-z) | ||
| 528 | $(call feature_check,cplus-demangle) | ||
| 529 | |||
| 530 | ifeq ($(feature-liberty), 1) | ||
| 531 | EXTLIBS += -liberty | ||
| 532 | else | ||
| 533 | ifeq ($(feature-liberty-z), 1) | ||
| 534 | EXTLIBS += -liberty -lz | ||
| 535 | endif | ||
| 536 | endif | ||
| 508 | endif | 537 | endif |
| 509 | 538 | ||
| 510 | ifdef NO_DEMANGLE | 539 | ifdef NO_DEMANGLE |
| @@ -515,15 +544,10 @@ else | |||
| 515 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT | 544 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
| 516 | else | 545 | else |
| 517 | ifneq ($(feature-libbfd), 1) | 546 | ifneq ($(feature-libbfd), 1) |
| 518 | $(call feature_check,liberty) | 547 | ifneq ($(feature-liberty), 1) |
| 519 | ifeq ($(feature-liberty), 1) | 548 | ifneq ($(feature-liberty-z), 1) |
| 520 | EXTLIBS += -lbfd -liberty | 549 | # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT |
| 521 | else | 550 | # or any of 'bfd iberty z' trinity |
| 522 | $(call feature_check,liberty-z) | ||
| 523 | ifeq ($(feature-liberty-z), 1) | ||
| 524 | EXTLIBS += -lbfd -liberty -lz | ||
| 525 | else | ||
| 526 | $(call feature_check,cplus-demangle) | ||
| 527 | ifeq ($(feature-cplus-demangle), 1) | 551 | ifeq ($(feature-cplus-demangle), 1) |
| 528 | EXTLIBS += -liberty | 552 | EXTLIBS += -liberty |
| 529 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT | 553 | CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT |
diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 5daeae1cb4c0..2f92d6e7ee00 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make | |||
| @@ -46,6 +46,7 @@ make_install_man := install-man | |||
| 46 | make_install_html := install-html | 46 | make_install_html := install-html |
| 47 | make_install_info := install-info | 47 | make_install_info := install-info |
| 48 | make_install_pdf := install-pdf | 48 | make_install_pdf := install-pdf |
| 49 | make_static := LDFLAGS=-static | ||
| 49 | 50 | ||
| 50 | # all the NO_* variable combined | 51 | # all the NO_* variable combined |
| 51 | make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 | 52 | make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 |
| @@ -87,6 +88,7 @@ run += make_install_bin | |||
| 87 | # run += make_install_info | 88 | # run += make_install_info |
| 88 | # run += make_install_pdf | 89 | # run += make_install_pdf |
| 89 | run += make_minimal | 90 | run += make_minimal |
| 91 | run += make_static | ||
| 90 | 92 | ||
| 91 | ifneq ($(call has,ctags),) | 93 | ifneq ($(call has,ctags),) |
| 92 | run += make_tags | 94 | run += make_tags |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index a53cd0b8c151..27c2a5efe450 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir) | |||
| 717 | } | 717 | } |
| 718 | 718 | ||
| 719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, | 719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, |
| 720 | const char *dir_name) | 720 | const char *dir_name, int depth) |
| 721 | { | 721 | { |
| 722 | struct dirent *dent; | 722 | struct dirent *dent; |
| 723 | DIR *dir = opendir(dir_name); | 723 | DIR *dir = opendir(dir_name); |
| @@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg, | |||
| 742 | !strcmp(dent->d_name, "..")) | 742 | !strcmp(dent->d_name, "..")) |
| 743 | continue; | 743 | continue; |
| 744 | 744 | ||
| 745 | ret = map_groups__set_modules_path_dir(mg, path); | 745 | /* Do not follow top-level source and build symlinks */ |
| 746 | if (depth == 0) { | ||
| 747 | if (!strcmp(dent->d_name, "source") || | ||
| 748 | !strcmp(dent->d_name, "build")) | ||
| 749 | continue; | ||
| 750 | } | ||
| 751 | |||
| 752 | ret = map_groups__set_modules_path_dir(mg, path, | ||
| 753 | depth + 1); | ||
| 746 | if (ret < 0) | 754 | if (ret < 0) |
| 747 | goto out; | 755 | goto out; |
| 748 | } else { | 756 | } else { |
| @@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine) | |||
| 786 | if (!version) | 794 | if (!version) |
| 787 | return -1; | 795 | return -1; |
| 788 | 796 | ||
| 789 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", | 797 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s", |
| 790 | machine->root_dir, version); | 798 | machine->root_dir, version); |
| 791 | free(version); | 799 | free(version); |
| 792 | 800 | ||
| 793 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); | 801 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); |
| 794 | } | 802 | } |
| 795 | 803 | ||
| 796 | static int machine__create_module(void *arg, const char *name, u64 start) | 804 | static int machine__create_module(void *arg, const char *name, u64 start) |
