perf fixes for 4.15
Subsystems (2)
Linus,
please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
This update contains:
- Plug a memory leak in the intel pmu init code
- clang fixes
- tooling fix to avoid including kernel headers
- A fix for jvmti to generate correct debug information for inlined code
- Replace backtick with a regular shell function
- Fix the build in hardened environments
Thanks,
tglx
------------------>
Arnaldo Carvalho de Melo (2):
tools arch s390: Do not include header files from the kernel sources x86/asm: Allow again using asm.h when building for the 'bpf' clang target
Ben Gainey (1):
perf jvmti: Generate correct debug information for inlined code
Jiri Olsa (2):
perf tools: Use shell function for perl cflags retrieval perf tools: Fix up build in hardened environments
Thomas Gleixner (1):
perf/x86/intel: Plug memory leak in intel_pmu_init()
arch/x86/events/intel/core.c | 5 +- arch/x86/include/asm/asm.h | 2 + tools/arch/s390/include/uapi/asm/perf_regs.h | 44 ++++++++ tools/perf/Makefile.config | 9 +- tools/perf/arch/s390/include/perf_regs.h | 2 +- tools/perf/check-headers.sh | 1 + tools/perf/jvmti/jvmti_agent.c | 16 +-- tools/perf/jvmti/jvmti_agent.h | 7 +- tools/perf/jvmti/libjvmti.c | 147 ++++++++++++++++++++++----- 9 files changed, 190 insertions(+), 43 deletions(-) create mode 100644 tools/arch/s390/include/uapi/asm/perf_regs.h
arch/x86/events/intel/core.c +4 -1
@@ -3847,6 +3847,8 @@ static struct attribute *intel_pmu_attrs[] = {__init int intel_pmu_init (void ) { +struct attribute **extra_attr =NULL ; +struct attribute **to_free =NULL ;union cpuid10_edx edx;union cpuid10_eax eax;union cpuid10_ebx ebx;
@@ -3854,7 +3856,6 @@ __init int intel_pmu_init(void)unsigned int unused;struct extra_reg *er;int version, i; -struct attribute **extra_attr =NULL ;char *name;if (!cpu_has (&boot_cpu_data,X86_FEATURE_ARCH_PERFMON )) {
@@ -4294,6 +4295,7 @@ __init int intel_pmu_init(void) extra_attr =boot_cpu_has (X86_FEATURE_RTM ) ? hsw_format_attr : nhm_format_attr; extra_attr =merge_attr (extra_attr, skl_format_attr); + to_free = extra_attr; x86_pmu.cpu_events =get_hsw_events_attrs ();intel_pmu_pebs_data_source_skl ( boot_cpu_data.x86_model ==INTEL_FAM6_SKYLAKE_X );
@@ -4401,6 +4403,7 @@ __init int intel_pmu_init(void)pr_cont ("full-width counters, " ); } +kfree (to_free);return 0 ; }
arch/x86/include/asm/asm.h +2 -0
@@ -136,6 +136,7 @@#endif #ifndef __ASSEMBLY__ +#ifndef __BPF__/* * This output constraint should be used for any inline asm which has a "call" * instruction. Otherwise the asm may be inserted before the frame pointer
@@ -145,5 +146,6 @@ registerunsigned long current_stack_pointer asm (_ASM_SP );#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)#endif +#endif #endif /* _ASM_X86_ASM_H */
tools/arch/s390/include/uapi/asm/perf_regs.h new file +44 -0
44 lines not on this page · raw message
tools/perf/Makefile.config +4 -5
@@ -188,9 +188,7 @@ ifdef PYTHON_CONFIG PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) - ifeq ($(CC_NO_CLANG), 1) - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) - endif + PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) endif
@@ -576,14 +574,15 @@ ifndef NO_GTK2 endif endif - ifdef NO_LIBPERL CFLAGS += -DNO_LIBPERL else PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) - PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` + PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null) + PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS)) + PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS)) FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) ifneq ($(feature-libperl), 1)
tools/perf/arch/s390/include/perf_regs.h +1 -1
@@ -3,7 +3,7 @@#include <stdlib.h> #include <linux/types.h> -#include <../../../../arch/s390/include/uapi/asm/perf_regs.h> +#include <asm/perf_regs.h> void perf_regs_load (u64 *regs);
tools/perf/check-headers.sh +1 -0
@@ -21,6 +21,7 @@ arch/x86/include/asm/cpufeatures.h arch/arm/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h arch/powerpc/include/uapi/asm/perf_regs.h +arch/s390/include/uapi/asm/perf_regs.h arch/x86/include/uapi/asm/perf_regs.h arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm_perf.h
tools/perf/jvmti/jvmti_agent.c +9 -7
@@ -384,13 +384,13 @@ jvmti_write_code(void *agent, char const *sym, }int -jvmti_write_debug_info (void *agent,uint64_t code,const char *file, -jvmti_line_info_t *li,int nr_lines) +jvmti_write_debug_info (void *agent,uint64_t code, +int nr_lines,jvmti_line_info_t *li, +const char *const * file_names) {struct jr_code_debug_info rec; -size_t sret, len, size, flen; +size_t sret, len, size, flen =0 ;uint64_t addr; -const char *fn = file;FILE *fp = agent;int i;
@@ -405,7 +405,9 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,return -1 ; } - flen =strlen (file) +1 ; +for (i =0 ; i < nr_lines; ++i) { + flen +=strlen (file_names[i]) +1 ; + } rec.p.id =JIT_CODE_DEBUG_INFO ; size =sizeof (rec);
@@ -421,7 +423,7 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,* file[] : source file name */ size += nr_lines *sizeof (struct debug_entry ); - size += flen * nr_lines; + size += flen; rec.p.total_size = size;/*
@@ -452,7 +454,7 @@ jvmti_write_debug_info(void *agent, uint64_t code, const char *file,if (sret !=1 ) goto error; - sret =fwrite_unlocked (fn, flen,1 , fp); + sret =fwrite_unlocked (file_names[i],strlen (file_names[i]) +1 ,1 , fp);if (sret !=1 ) goto error; }
tools/perf/jvmti/jvmti_agent.h +3 -4
@@ -14,6 +14,7 @@ typedef struct {unsigned long pc;int line_number;int discrim;/* discriminator -- 0 for now */ +jmethodID methodID; } jvmti_line_info_t;void *jvmti_open (void );
@@ -22,11 +23,9 @@ int jvmti_write_code(void *agent, char const *symbol_name, uint64_t vma, void const *code, const unsigned int code_size); -int jvmti_write_debug_info (void *agent, -uint64_t code, -const char *file, +int jvmti_write_debug_info (void *agent,uint64_t code,int nr_lines,jvmti_line_info_t *li, -int nr_lines); +const char *const * file_names);#if defined(__cplusplus) }
tools/perf/jvmti/libjvmti.c +122 -25
195 lines not on this page · raw message