perf fixes
Subsystems (3)
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
# HEAD: 52e92f409dede388b7dc3ee13491fbf7a80db935 perf/x86/cstate: Add Tiger Lake CPU support
Mostly tooling fixes, but also a couple of updates for new Intel models (which are technically hw-enablement, but to users it's a fix to perf behavior on those new CPUs - hope this is fine), an AUX inheritance fix, event time-sharing fix, and a fix for lost non-perf NMI events on AMD systems.
Thanks,
Ingo
------------------>
Alexander Shishkin (1):
perf/core: Fix inheritance of aux_output groups
Andi Kleen (2):
perf script brstackinsn: Fix recovery from LBR/binary mismatch perf jevents: Fix period for Intel fixed counters
Arnaldo Carvalho de Melo (13):
tools headers uapi: Sync drm/i915_drm.h with the kernel sources tools headers uapi: Sync asm-generic/mman-common.h with the kernel tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources tools headers uapi: Sync linux/fs.h with the kernel sources tools headers kvm: Sync kvm headers with the kernel sources perf tools: Propagate get_cpuid() error
perf evsel: Fall back to global 'perf_env' in perf_evsel__env() perf annotate: Propagate perf_env__arch() error
perf annotate: Fix the signedness of failure returns
perf annotate: Propagate the symbol__annotate() error return perf annotate: Fix arch specific ->init() failure errors perf annotate: Return appropriate error code for allocation failures perf annotate: Don't return -1 for error when doing BPF disassembly
Ian Rogers (4):
libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature perf tests: Avoid raising SEGV using an obvious NULL dereference perf docs: Allow man page date to be specified
perf llvm: Don't access out-of-scope array
Kan Liang (8):
perf/x86/intel: Add Comet Lake CPU support perf/x86/msr: Add Comet Lake CPU support perf/x86/cstate: Add Comet Lake CPU support perf/x86/msr: Add new CPU model numbers for Ice Lake perf/x86/cstate: Update C-state counters for Ice Lake perf/x86/intel: Add Tiger Lake CPU support perf/x86/msr: Add Tiger Lake CPU support perf/x86/cstate: Add Tiger Lake CPU support
Song Liu (2):
perf/core: Rework memory accounting in perf_mmap() perf/core: Fix corner case in perf_rotate_context()
Steve MacLean (3):
perf map: Fix overlapped map handling
perf inject jit: Fix JIT_CODE_MOVE filename
perf docs: Correct and clarify jitdump spec
Thomas Richter (2):
perf vendor events s390: Add JSON transaction for machine type 8561 perf vendor events s390: Use s390 machine name instead of type 8561
Tom Lendacky (1):
perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp
arch/x86/events/amd/core.c | 30 ++--
arch/x86/events/intel/core.c | 4 +
arch/x86/events/intel/cstate.c | 44 +++--
arch/x86/events/msr.c | 7 +
kernel/events/core.c | 43 ++++-
tools/arch/arm/include/uapi/asm/kvm.h | 4 +-
tools/arch/arm64/include/uapi/asm/kvm.h | 4 +-
tools/arch/s390/include/uapi/asm/kvm.h | 6 +
tools/arch/x86/include/uapi/asm/vmx.h | 2 +
tools/include/uapi/asm-generic/mman-common.h | 3 +
tools/include/uapi/drm/i915_drm.h | 1 +
tools/include/uapi/linux/fs.h | 55 +------
tools/include/uapi/linux/fscrypt.h | 181 +++++++++++++++++++++
tools/include/uapi/linux/kvm.h | 3 +
tools/include/uapi/linux/usbdevice_fs.h | 4 +
tools/lib/subcmd/Makefile | 8 +-
tools/perf/Documentation/asciidoc.conf | 3 +
tools/perf/Documentation/jitdump-specification.txt | 4 +-
tools/perf/arch/arm/annotate/instructions.c | 4 +-
tools/perf/arch/arm64/annotate/instructions.c | 4 +-
tools/perf/arch/powerpc/util/header.c | 3 +-
tools/perf/arch/s390/annotate/instructions.c | 6 +-
tools/perf/arch/s390/util/header.c | 9 +-
tools/perf/arch/x86/annotate/instructions.c | 6 +-
tools/perf/arch/x86/util/header.c | 3 +-
tools/perf/builtin-kvm.c | 7 +-
tools/perf/builtin-script.c | 6 +-
tools/perf/check-headers.sh | 1 +
.../arch/s390/{cf_m8561 => cf_z15}/basic.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/crypto.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/crypto6.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/extended.json | 0
.../pmu-events/arch/s390/cf_z15/transaction.json | 7 +
tools/perf/pmu-events/arch/s390/mapfile.csv | 2 +-
tools/perf/pmu-events/jevents.c | 12 +-
tools/perf/tests/perf-hooks.c | 3 +-
tools/perf/util/annotate.c | 35 +++-
tools/perf/util/annotate.h | 4 +
tools/perf/util/evsel.c | 3 +-
tools/perf/util/jitdump.c | 6 +-
tools/perf/util/llvm-utils.c | 6 +-
tools/perf/util/map.c | 3 +
tools/perf/util/python.c | 6 +
43 files changed, 411 insertions(+), 131 deletions(-)
create mode 100644 tools/include/uapi/linux/fscrypt.h
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/basic.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto6.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/extended.json (100%)
create mode 100644 tools/perf/pmu-events/arch/s390/cf_z15/transaction.jsonarch/x86/events/amd/core.c +17 -13
@@ -5,12 +5,14 @@#include <linux/init.h> #include <linux/slab.h> #include <linux/delay.h> +#include <linux/jiffies.h> #include <asm/apicdef.h> #include <asm/nmi.h> #include "../perf_event.h" -static DEFINE_PER_CPU(unsigned int, perf_nmi_counter); +static DEFINE_PER_CPU(unsigned long, perf_nmi_tstamp); +static unsigned long perf_nmi_window;static __initconst const u64 amd_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ]
@@ -641,11 +643,12 @@ static void amd_pmu_disable_event(struct perf_event *event)* handler when multiple PMCs are active or PMC overflow while handling some * other source of an NMI. * -* Attempt to mitigate this by using the number of active PMCs to determine -* whether to return NMI_HANDLED if the perf NMI handler did not handle/reset -* any PMCs. The per-CPU perf_nmi_counter variable is set to a minimum of the -* number of active PMCs or 2. The value of 2 is used in case an NMI does not -* arrive at the LAPIC in time to be collapsed into an already pending NMI. +* Attempt to mitigate this by creating an NMI window in which un-handled NMIs +* received during this window will be claimed. This prevents extending the +* window past when it is possible that latent NMIs should be received. The +* per-CPU perf_nmi_tstamp will be set to the window end time whenever perf has +* handled a counter. When an un-handled NMI is received, it will be claimed +* only if arriving within that window. */ static int amd_pmu_handle_irq (struct pt_regs *regs) {
@@ -663,21 +666,19 @@ static int amd_pmu_handle_irq(struct pt_regs *regs) handled =x86_pmu_handle_irq (regs);/* -* If a counter was handled, record the number of possible remaining -* NMIs that can occur. +* If a counter was handled, record a timestamp such that un-handled +* NMIs will be claimed if arriving within that window. */ if (handled) { -this_cpu_write (perf_nmi_counter, - min_t(unsigned int, 2, active)); +this_cpu_write (perf_nmi_tstamp, + jiffies + perf_nmi_window);return handled; } -if (!this_cpu_read (perf_nmi_counter)) +if (time_after (jiffies,this_cpu_read (perf_nmi_tstamp)))return NMI_DONE ; -this_cpu_dec (perf_nmi_counter); -return NMI_HANDLED ; }
@@ -909,6 +910,9 @@ static int __init amd_core_pmu_init(void)if (!boot_cpu_has (X86_FEATURE_PERFCTR_CORE ))return 0 ; +/* Avoid calulating the value each time in the NMI handler */ + perf_nmi_window =msecs_to_jiffies (100 ); +switch (boot_cpu_data.x86) {case 0x15 :pr_cont ("Fam15h " );
arch/x86/events/intel/core.c +4 -0
@@ -4983,6 +4983,8 @@ __init int intel_pmu_init(void)case INTEL_FAM6_SKYLAKE :case INTEL_FAM6_KABYLAKE_L :case INTEL_FAM6_KABYLAKE : +case INTEL_FAM6_COMETLAKE_L : +case INTEL_FAM6_COMETLAKE :x86_add_quirk (intel_pebs_isolation_quirk); x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids));
@@ -5031,6 +5033,8 @@ __init int intel_pmu_init(void)/* fall through */ case INTEL_FAM6_ICELAKE_L :case INTEL_FAM6_ICELAKE : +case INTEL_FAM6_TIGERLAKE_L : +case INTEL_FAM6_TIGERLAKE : x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids));memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));
arch/x86/events/intel/cstate.c +32 -12
98 lines not on this page · raw message
arch/x86/events/msr.c +7 -0
@@ -89,7 +89,14 @@ static bool test_intel(int idx, void *data)case INTEL_FAM6_SKYLAKE_X :case INTEL_FAM6_KABYLAKE_L :case INTEL_FAM6_KABYLAKE : +case INTEL_FAM6_COMETLAKE_L : +case INTEL_FAM6_COMETLAKE :case INTEL_FAM6_ICELAKE_L : +case INTEL_FAM6_ICELAKE : +case INTEL_FAM6_ICELAKE_X : +case INTEL_FAM6_ICELAKE_D : +case INTEL_FAM6_TIGERLAKE_L : +case INTEL_FAM6_TIGERLAKE :if (idx ==PERF_MSR_SMI || idx ==PERF_MSR_PPERF )return true;break ;
kernel/events/core.c +36 -7
77 lines not on this page · raw message
tools/arch/arm/include/uapi/asm/kvm.h +3 -1
@@ -266,8 +266,10 @@ struct kvm_vcpu_events {#define KVM_DEV_ARM_ITS_CTRL_RESET 4/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_VCPU2_SHIFT 28 +#define KVM_ARM_IRQ_VCPU2_MASK 0xf#define KVM_ARM_IRQ_TYPE_SHIFT 24 -#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_TYPE_MASK 0xf#define KVM_ARM_IRQ_VCPU_SHIFT 16#define KVM_ARM_IRQ_VCPU_MASK 0xff#define KVM_ARM_IRQ_NUM_SHIFT 0
tools/arch/arm64/include/uapi/asm/kvm.h +3 -1
@@ -325,8 +325,10 @@ struct kvm_vcpu_events {#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_VCPU2_SHIFT 28 +#define KVM_ARM_IRQ_VCPU2_MASK 0xf#define KVM_ARM_IRQ_TYPE_SHIFT 24 -#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_TYPE_MASK 0xf#define KVM_ARM_IRQ_VCPU_SHIFT 16#define KVM_ARM_IRQ_VCPU_MASK 0xff#define KVM_ARM_IRQ_NUM_SHIFT 0
tools/arch/s390/include/uapi/asm/kvm.h +6 -0
@@ -231,6 +231,12 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_GSCB (1UL << 9)#define KVM_SYNC_BPBC (1UL << 10)#define KVM_SYNC_ETOKEN (1UL << 11) + +#define KVM_SYNC_S390_VALID_FIELDS \ + (KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \ + KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \ + KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN) +/* length and alignment of the sdnx as a power of two */ #define SDNXC 8#define SDNXL (1UL << SDNXC)
tools/arch/x86/include/uapi/asm/vmx.h +2 -0
@@ -31,6 +31,7 @@#define EXIT_REASON_EXCEPTION_NMI 0#define EXIT_REASON_EXTERNAL_INTERRUPT 1#define EXIT_REASON_TRIPLE_FAULT 2 +#define EXIT_REASON_INIT_SIGNAL 3#define EXIT_REASON_PENDING_INTERRUPT 7#define EXIT_REASON_NMI_WINDOW 8
@@ -90,6 +91,7 @@ { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ + { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, \ { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, \ { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \
tools/include/uapi/asm-generic/mman-common.h +3 -0
@@ -67,6 +67,9 @@#define MADV_WIPEONFORK 18/* Zero memory on fork, child only */ #define MADV_KEEPONFORK 19/* Undo MADV_WIPEONFORK */ +#define MADV_COLD 20/* deactivate these pages */ +#define MADV_PAGEOUT 21/* reclaim these pages */ +/* compatibility flags */ #define MAP_FILE 0
tools/include/uapi/drm/i915_drm.h +1 -0
@@ -521,6 +521,7 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3) +#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)#define I915_PARAM_HUC_STATUS 42
tools/include/uapi/linux/fs.h +4 -51
73 lines not on this page · raw message
tools/include/uapi/linux/fscrypt.h new file +181 -0
181 lines not on this page · raw message
tools/include/uapi/linux/kvm.h +3 -0
@@ -243,6 +243,8 @@ struct kvm_hyperv_exit {#define KVM_INTERNAL_ERROR_SIMUL_EX 2/* Encounter unexpected vm-exit due to delivery event. */ #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 +/* Encounter unexpected vm-exit reason */ +#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ struct kvm_run {
@@ -996,6 +998,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171#define KVM_CAP_ARM_PTRAUTH_GENERIC 172#define KVM_CAP_PMU_EVENT_FILTER 173 +#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174#ifdef KVM_CAP_IRQ_ROUTING
tools/include/uapi/linux/usbdevice_fs.h +4 -0
@@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo {#define USBDEVFS_CAP_MMAP 0x20#define USBDEVFS_CAP_DROP_PRIVILEGES 0x40#define USBDEVFS_CAP_CONNINFO_EX 0x80 +#define USBDEVFS_CAP_SUSPEND 0x100/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
@@ -223,5 +224,8 @@ struct usbdevfs_streams {* extending size of the data returned. */ #define USBDEVFS_CONNINFO_EX (len) _IOC(_IOC_READ, 'U', 32, len) +#define USBDEVFS_FORBID_SUSPEND _IO('U', 33) +#define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) +#define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35)#endif /* _UAPI_LINUX_USBDEVICE_FS_H */
tools/lib/subcmd/Makefile +7 -1
@@ -20,7 +20,13 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libsubcmd.a CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -fPIC + +ifeq ($(DEBUG),0) + ifeq ($(feature-fortify-source), 1) + CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 + endif +endif ifeq ($(CC_NO_CLANG), 0) CFLAGS += -O3
tools/perf/Documentation/asciidoc.conf +3 -0
@@ -71,6 +71,9 @@ ifdef::backend-docbook[] [header] template::[header-declarations] <refentry> +ifdef::perf_date[] +<refentryinfo><date>{perf_date}</date></refentryinfo> +endif::perf_date[] <refmeta> <refentrytitle>{mantitle}</refentrytitle> <manvolnum>{manvolnum}</manvolnum>
tools/perf/Documentation/jitdump-specification.txt +2 -2
@@ -36,8 +36,8 @@ III/ Jitdump file header format Each jitdump file starts with a fixed size header containing the following fields in order: -* uint32_t magic : a magic number tagging the file type. The value is 4-byte long and represents the string "JiTD" in ASCII form. It is 0x4A695444 or 0x4454694a depending on the endianness. The field can be used to detect the endianness of the file -* uint32_t version : a 4-byte value representing the format version. It is currently set to 2 +* uint32_t magic : a magic number tagging the file type. The value is 4-byte long and represents the string "JiTD" in ASCII form. It written is as 0x4A695444. The reader will detect an endian mismatch when it reads 0x4454694a. +* uint32_t version : a 4-byte value representing the format version. It is currently set to 1 * uint32_t total_size: size in bytes of file header * uint32_t elf_mach : ELF architecture encoding (ELF e_machine value as specified in /usr/include/elf.h) * uint32_t pad1 : padding. Reserved for future use
tools/perf/arch/arm/annotate/instructions.c +2 -2
@@ -37,7 +37,7 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm =zalloc (sizeof (*arm));if (!arm) -return -1 ; +return ENOMEM ;#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" err =regcomp (&arm->call_insn,"^blx?" ARM_CONDS "?$" ,REG_EXTENDED );
@@ -59,5 +59,5 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)regfree (&arm->call_insn); out_free_arm:free (arm); -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP ; }
tools/perf/arch/arm64/annotate/instructions.c +2 -2
@@ -95,7 +95,7 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm =zalloc (sizeof (*arm));if (!arm) -return -1 ; +return ENOMEM ;/* bl, blr */ err =regcomp (&arm->call_insn,"^blr?$" ,REG_EXTENDED );
@@ -118,5 +118,5 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)regfree (&arm->call_insn); out_free_arm:free (arm); -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP ; }
tools/perf/arch/powerpc/util/header.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>
@@ -30,7 +31,7 @@ get_cpuid(char *buffer, size_t sz) buffer[nb-1 ] ='\0' ;return 0 ; } -return -1 ; +return ENOBUFS ; } char *
tools/perf/arch/s390/annotate/instructions.c +4 -2
@@ -164,8 +164,10 @@ static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)if (!arch->initialized) { arch->initialized = true; arch->associate_instruction_ops = s390__associate_ins_ops; -if (cpuid) - err =s390__cpuid_parse (arch, cpuid); +if (cpuid) { +if (s390__cpuid_parse (arch, cpuid)) + err =SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING ; + } }return err;
tools/perf/arch/s390/util/header.c +5 -4
@@ -8,6 +8,7 @@*/ #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <string.h>
@@ -54,7 +55,7 @@ int get_cpuid(char *buffer, size_t sz) sysinfo =fopen (SYSINFO ,"r" );if (sysinfo ==NULL ) -return -1 ; +return errno;while ((read =getline (&line, &line_sz, sysinfo)) !=-1 ) {if (!strncmp (line,SYSINFO_MANU ,strlen (SYSINFO_MANU ))) {
@@ -89,7 +90,7 @@ int get_cpuid(char *buffer, size_t sz)/* Missing manufacturer, type or model information should not happen */ if (!manufacturer[0 ] || !type[0 ] || !model[0 ]) -return -1 ; +return EINVAL ;/* * Scan /proc/service_levels and return the CPU-MF counter facility
@@ -133,14 +134,14 @@ int get_cpuid(char *buffer, size_t sz)else nbytes =snprintf (buffer, sz,"%s,%s,%s" , manufacturer, type, model); -return (nbytes >= sz) ?-1 :0 ; +return (nbytes >= sz) ?ENOBUFS :0 ; }char *get_cpuid_str (struct perf_pmu *pmu__maybe_unused ) {char *buf =malloc (128 ); -if (buf &&get_cpuid (buf,128 ) <0 ) +if (buf &&get_cpuid (buf,128 ))zfree (&buf);return buf; }
tools/perf/arch/x86/annotate/instructions.c +4 -2
@@ -196,8 +196,10 @@ static int x86__annotate_init(struct arch *arch, char *cpuid)if (arch->initialized)return 0 ; -if (cpuid) - err =x86__cpuid_parse (arch, cpuid); +if (cpuid) { +if (x86__cpuid_parse (arch, cpuid)) + err =SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING ; + } arch->initialized = true;return err;
tools/perf/arch/x86/util/header.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>
@@ -58,7 +59,7 @@ __get_cpuid(char *buffer, size_t sz, const char *fmt) buffer[nb-1 ] ='\0' ;return 0 ; } -return -1 ; +return ENOBUFS ; }int
tools/perf/builtin-kvm.c +4 -3
@@ -705,14 +705,15 @@ static int process_sample_event(struct perf_tool *tool,static int cpu_isa_config (struct perf_kvm_stat *kvm) { -char buf[64 ], *cpuid; +char buf[128 ], *cpuid;int err;if (kvm->live) { err =get_cpuid (buf,sizeof (buf));if (err !=0 ) { -pr_err ("Failed to look up CPU type\n" ); -return err; +pr_err ("Failed to look up CPU type: %s\n" , +str_error_r (err, buf,sizeof (buf))); +return -err; } cpuid = buf; }else
tools/perf/builtin-script.c +5 -1
@@ -1063,7 +1063,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,continue ; insn =0 ; -for (off =0 ;; off += ilen) { +for (off =0 ; off < (unsigned )len; off += ilen) {uint64_t ip = start + off; printed +=ip__fprintf_sym (ip, thread, x.cpumode, x.cpu, &lastsym, attr, fp);
@@ -1074,6 +1074,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, printed +=print_srccode (thread, x.cpumode, ip);break ; }else { + ilen =0 ; printed +=fprintf (fp,"\t%016" PRIx64"\t%s\n" , ip,dump_insn (&x, ip, buffer + off, len - off, &ilen));if (ilen ==0 )
@@ -1083,6 +1084,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, insn++; } } +if (off != (unsigned )len) + printed +=fprintf (fp,"\tmismatch of LBR data and executable\n" ); }/*
@@ -1123,6 +1126,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, goto out; }for (off =0 ; off <= end - start; off += ilen) { + ilen =0 ; printed +=fprintf (fp,"\t%016" PRIx64"\t%s\n" , start + off,dump_insn (&x, start + off, buffer + off, len - off, &ilen));if (ilen ==0 )
tools/perf/check-headers.sh +1 -0
@@ -8,6 +8,7 @@ include/uapi/drm/i915_drm.h include/uapi/linux/fadvise.h include/uapi/linux/fcntl.h include/uapi/linux/fs.h +include/uapi/linux/fscrypt.h include/uapi/linux/kcmp.h include/uapi/linux/kvm.h include/uapi/linux/in.h
tools/perf/pmu-events/arch/s390/cf_z15/basic.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/basic.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/crypto.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/crypto.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/crypto6.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/crypto6.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/extended.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/extended.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/transaction.json new file +7 -0
@@ -0,0 +1,7 @@ +[ + { + "BriefDescription": "Transaction count", + "MetricName": "transaction", + "MetricExpr": "TX_C_TEND + TX_NC_TEND + TX_NC_TABORT + TX_C_TABORT_SPECIAL + TX_C_TABORT_NO_SPECIAL" + } +]
tools/perf/pmu-events/arch/s390/mapfile.csv +1 -1
@@ -4,4 +4,4 @@ Family-model,Version,Filename,EventType ^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core -^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_m8561,core +^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15,core
tools/perf/pmu-events/jevents.c +6 -6
@@ -450,12 +450,12 @@ static struct fixed {const char *name;const char *event; } fixed[] = { - { "inst_retired.any", "event=0xc0" }, - { "inst_retired.any_p", "event=0xc0" }, - { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" }, - { "cpu_clk_unhalted.thread", "event=0x3c" }, - { "cpu_clk_unhalted.core", "event=0x3c" }, - { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" }, + { "inst_retired.any", "event=0xc0,period=2000003" }, + { "inst_retired.any_p", "event=0xc0,period=2000003" }, + { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03,period=2000003" }, + { "cpu_clk_unhalted.thread", "event=0x3c,period=2000003" }, + { "cpu_clk_unhalted.core", "event=0x3c,period=2000003" }, + { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1,period=2000003" }, { NULL, NULL}, };
tools/perf/tests/perf-hooks.c +1 -2
@@ -19,12 +19,11 @@ static void sigsegv_handler(int sig __maybe_unused)static void the_hook (void *_hook_flags) {int *hook_flags = _hook_flags; -int *p =NULL ; *hook_flags =1234 ;/* Generate a segfault, test perf_hooks__recover */ - *p =0 ; +raise (SIGSEGV ); }int test__perf_hooks (struct test *test__maybe_unused ,int subtest__maybe_unused )
tools/perf/util/annotate.c +26 -9
@@ -1631,6 +1631,19 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *case SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF :scnprintf (buf, buflen,"Please link with binutils's libopcode to enable BPF annotation" );break ; +case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP : +scnprintf (buf, buflen,"Problems with arch specific instruction name regular expressions." ); +break ; +case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING : +scnprintf (buf, buflen,"Problems while parsing the CPUID in the arch specific initialization." ); +break ; +case SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE : +scnprintf (buf, buflen,"Invalid BPF file: %s." , dso->long_name); +break ; +case SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF : +scnprintf (buf, buflen,"The %s BPF file has no BTF section, compile with -g or use pahole -J." , + dso->long_name); +break ;default :scnprintf (buf, buflen,"Internal error: Invalid %d error code\n" , errnum);break ;
@@ -1662,7 +1675,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil build_id_path =strdup (filename);if (!build_id_path) -return -1 ; +return ENOMEM ;/* * old style build-id cache has name of XX/XXXXXXX.. while
@@ -1713,13 +1726,13 @@ static int symbol__disassemble_bpf(struct symbol *sym,char tpath[PATH_MAX ];size_t buf_size;int nr_skip =0 ; -int ret =-1 ;char *buf;bfd *bfdf; +int ret;FILE *s;if (dso->binary_type !=DSO_BINARY_TYPE__BPF_PROG_INFO ) -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE ;pr_debug ("%s: handling sym %s addr %" PRIx64" len %" PRIx64"\n" , __func__, sym->name, sym->start, sym->end - sym->start);
@@ -1732,8 +1745,10 @@ static int symbol__disassemble_bpf(struct symbol *sym,assert (bfd_check_format (bfdf, bfd_object)); s =open_memstream (&buf, &buf_size); -if (!s) +if (!s) { + ret = errno; goto out; + }init_disassemble_info (&info, s, (fprintf_ftype ) fprintf);
@@ -1742,8 +1757,10 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id); -if (!info_node) +if (!info_node) { +return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out; + } info_linear = info_node->info_linear; sub_id = dso->bpf_prog.sub_id;
@@ -2071,11 +2088,11 @@ int symbol__annotate(struct symbol *sym, struct map *map,int err;if (!arch_name) -return -1 ; +return errno; args.arch = arch =arch__find (arch_name);if (arch ==NULL ) -return -ENOTSUP ; +return ENOTSUP ;if (parch) *parch = arch;
@@ -2971,7 +2988,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel, notes->offsets =zalloc (size *sizeof (struct annotation_line *));if (notes->offsets ==NULL ) -return -1 ; +return ENOMEM ;if (perf_evsel__is_group_event (evsel)) nr_pcnt = evsel->core.nr_members;
@@ -2997,7 +3014,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel, out_free_offsets:zfree (¬es->offsets); -return -1 ; +return err; }#define ANNOTATION__CFG (n) \
tools/perf/util/annotate.h +4 -0
@@ -370,6 +370,10 @@ enum symbol_disassemble_errno {SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX = __SYMBOL_ANNOTATE_ERRNO__START,SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF , +SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING , +SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP , +SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE , +SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF , __SYMBOL_ANNOTATE_ERRNO__END, };
tools/perf/util/evsel.c +2 -1
@@ -30,6 +30,7 @@#include "counts.h" #include "event.h" #include "evsel.h" +#include "util/env.h" #include "util/evsel_config.h" #include "util/evsel_fprintf.h" #include "evlist.h"
@@ -2512,7 +2513,7 @@ struct perf_env *perf_evsel__env(struct evsel *evsel) {if (evsel && evsel->evlist)return evsel->evlist->env; -return NULL ; +return &perf_env; }static int store_evsel_ids (struct evsel *evsel,struct evlist *evlist)
tools/perf/util/jitdump.c +3 -3
@@ -395,7 +395,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)size_t size;u16 idr_size;const char *sym; -uint32_t count; +uint64_t count;int ret, csize, usize;pid_t pid, tid;struct {
@@ -418,7 +418,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)return -1 ; filename = event->mmap2.filename; - size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%u.so" , + size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64".so" , jd->dir, pid, count);
@@ -529,7 +529,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)return -1 ; filename = event->mmap2.filename; - size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64, + size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64".so" , jd->dir, pid, jr->move.code_index);
tools/perf/util/llvm-utils.c +3 -3
@@ -233,14 +233,14 @@ static int detect_kbuild_dir(char **kbuild_dir)const char *prefix_dir ="" ;const char *suffix_dir ="" ; +/* _UTSNAME_LENGTH is 65 */ +char release[128 ]; +char *autoconf_path;int err;if (!test_dir) { -/* _UTSNAME_LENGTH is 65 */ -char release[128 ]; - err =fetch_kernel_version (NULL , release,sizeof (release));if (err)
tools/perf/util/map.c +3 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include "symbol.h" +#include <assert.h> #include <errno.h> #include <inttypes.h> #include <limits.h>
@@ -850,6 +851,8 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp } after->start = map->end; + after->pgoff += map->end - pos->start; +assert (pos->map_ip (pos, map->end) == after->map_ip (after, map->end));__map_groups__insert (pos->groups, after);if (verbose >=2 && !use_browser)map__fprintf (after, fp);
tools/perf/util/python.c +6 -0
@@ -14,6 +14,7 @@#include "thread_map.h" #include "trace-event.h" #include "mmap.h" +#include "util/env.h" #include <internal/lib.h> #include "../perf-sys.h"
@@ -53,6 +54,11 @@ int parse_callchain_record(const char *arg __maybe_unused,return 0 ; } +/* +* Add this one here not to drag util/env.c +*/ +struct perf_env perf_env; +/* * Support debug printing even though util/debug.c is not linked. That means * implementing 'verbose' and 'eprintf'.
The pull request you sent on Sat, 12 Oct 2019 15:31:34 +0200:
The pull request you sent on Sat, 12 Oct 2019 15:31:34 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitperf-urgent-for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/465a7e291fd4f056d81baf5d5ed557bdb44c5457
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker