Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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()

+66 -23
+2 -1
arch/x86/kernel/cpu/perf_event_intel_rapl.c
··· 543 543 if (phys_id < 0) 544 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 548 return -1; 548 549 549 550 pmu = kzalloc_node(sizeof(*pmu), GFP_KERNEL, cpu_to_node(cpu));
+2 -2
tools/lib/api/fs/debugfs.c
··· 12 12 char debugfs_mountpoint[PATH_MAX + 1] = "/sys/kernel/debug"; 13 13 14 14 static const char * const debugfs_known_mountpoints[] = { 15 - "/sys/kernel/debug/", 16 - "/debug/", 15 + "/sys/kernel/debug", 16 + "/debug", 17 17 0, 18 18 }; 19 19
+1
tools/lib/traceevent/event-parse.c
··· 4344 4344 format, len_arg, arg); 4345 4345 trace_seq_terminate(&p); 4346 4346 trace_seq_puts(s, p.buffer); 4347 + trace_seq_destroy(&p); 4347 4348 arg = arg->next; 4348 4349 break; 4349 4350 default:
+2 -2
tools/lib/traceevent/event-parse.h
··· 876 876 struct event_filter *pevent_filter_alloc(struct pevent *pevent); 877 877 878 878 /* for backward compatibility */ 879 - #define FILTER_NONE PEVENT_ERRNO__FILTER_NOT_FOUND 880 - #define FILTER_NOEXIST PEVENT_ERRNO__NO_FILTER 879 + #define FILTER_NONE PEVENT_ERRNO__NO_FILTER 880 + #define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND 881 881 #define FILTER_MISS PEVENT_ERRNO__FILTER_MISS 882 882 #define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH 883 883
+1 -1
tools/perf/Makefile.perf
··· 589 589 $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $< 590 590 591 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 594 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS 595 595 $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
+2 -1
tools/perf/arch/x86/tests/dwarf-unwind.c
··· 23 23 24 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 27 if (!map) { 28 28 pr_debug("failed to get stack map\n"); 29 + free(buf); 29 30 return -1; 30 31 } 31 32
+7 -1
tools/perf/arch/x86/tests/regs_load.S
··· 1 - 2 1 #include <linux/linkage.h> 3 2 4 3 #define AX 0 ··· 89 90 ret 90 91 ENDPROC(perf_regs_load) 91 92 #endif 93 + 94 + /* 95 + * We need to provide note.GNU-stack section, saying that we want 96 + * NOT executable stack. Otherwise the final linking will assume that 97 + * the ELF stack should not be restricted at all and set it RWX. 98 + */ 99 + .section .note.GNU-stack,"",@progbits
+35 -11
tools/perf/config/Makefile
··· 34 34 LIBUNWIND_LIBS = -lunwind -lunwind-arm 35 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 45 ifeq ($(LIBUNWIND_LIBS),) 38 46 NO_LIBUNWIND := 1 39 47 else ··· 116 108 CFLAGS += -Wall 117 109 CFLAGS += -Wextra 118 110 CFLAGS += -std=gnu99 111 + 112 + # Enforce a non-executable stack, as we may regress (again) in the future by 113 + # adding assembler files missing the .GNU-stack linker note. 114 + LDFLAGS += -Wl,-z,noexecstack 119 115 120 116 EXTLIBS = -lelf -lpthread -lrt -lm -ldl 121 117 ··· 198 186 stackprotector-all \ 199 187 timerfd \ 200 188 libunwind-debug-frame \ 201 - bionic 189 + bionic \ 190 + liberty \ 191 + liberty-z \ 192 + cplus-demangle 202 193 203 194 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. 204 195 # If in the future we need per-feature checks/flags for features not ··· 519 504 endif 520 505 521 506 ifeq ($(feature-libbfd), 1) 522 - EXTLIBS += -lbfd -lz -liberty 507 + EXTLIBS += -lbfd 508 + 509 + # call all detections now so we get correct 510 + # status in VF output 511 + $(call feature_check,liberty) 512 + $(call feature_check,liberty-z) 513 + $(call feature_check,cplus-demangle) 514 + 515 + ifeq ($(feature-liberty), 1) 516 + EXTLIBS += -liberty 517 + else 518 + ifeq ($(feature-liberty-z), 1) 519 + EXTLIBS += -liberty -lz 520 + endif 521 + endif 523 522 endif 524 523 525 524 ifdef NO_DEMANGLE ··· 544 515 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT 545 516 else 546 517 ifneq ($(feature-libbfd), 1) 547 - $(call feature_check,liberty) 548 - ifeq ($(feature-liberty), 1) 549 - EXTLIBS += -lbfd -liberty 550 - else 551 - $(call feature_check,liberty-z) 552 - ifeq ($(feature-liberty-z), 1) 553 - EXTLIBS += -lbfd -liberty -lz 554 - else 555 - $(call feature_check,cplus-demangle) 518 + ifneq ($(feature-liberty), 1) 519 + ifneq ($(feature-liberty-z), 1) 520 + # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT 521 + # or any of 'bfd iberty z' trinity 556 522 ifeq ($(feature-cplus-demangle), 1) 557 523 EXTLIBS += -liberty 558 524 CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+2
tools/perf/tests/make
··· 46 46 make_install_html := install-html 47 47 make_install_info := install-info 48 48 make_install_pdf := install-pdf 49 + make_static := LDFLAGS=-static 49 50 50 51 # all the NO_* variable combined 51 52 make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 ··· 88 87 # run += make_install_info 89 88 # run += make_install_pdf 90 89 run += make_minimal 90 + run += make_static 91 91 92 92 ifneq ($(call has,ctags),) 93 93 run += make_tags
+12 -4
tools/perf/util/machine.c
··· 717 717 } 718 718 719 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 722 struct dirent *dent; 723 723 DIR *dir = opendir(dir_name); ··· 742 742 !strcmp(dent->d_name, "..")) 743 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 754 if (ret < 0) 747 755 goto out; 748 756 } else { ··· 794 786 if (!version) 795 787 return -1; 796 788 797 - snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", 789 + snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s", 798 790 machine->root_dir, version); 799 791 free(version); 800 792 801 - return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); 793 + return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); 802 794 } 803 795 804 796 static int machine__create_module(void *arg, const char *name, u64 start)