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

Configure Feed

Select the types of activity you want to include in your feed.

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, 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"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
perf/x86/cstate: Add Tiger Lake CPU support
perf/x86/msr: Add Tiger Lake CPU support
perf/x86/intel: Add Tiger Lake CPU support
perf/x86/cstate: Update C-state counters for Ice Lake
perf/x86/msr: Add new CPU model numbers for Ice Lake
perf/x86/cstate: Add Comet Lake CPU support
perf/x86/msr: Add Comet Lake CPU support
perf/x86/intel: Add Comet Lake CPU support
perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp
perf/core: Fix corner case in perf_rotate_context()
perf/core: Rework memory accounting in perf_mmap()
perf/core: Fix inheritance of aux_output groups
perf annotate: Don't return -1 for error when doing BPF disassembly
perf annotate: Return appropriate error code for allocation failures
perf annotate: Fix arch specific ->init() failure errors
perf annotate: Propagate the symbol__annotate() error return
perf annotate: Fix the signedness of failure returns
perf annotate: Propagate perf_env__arch() error
perf evsel: Fall back to global 'perf_env' in perf_evsel__env()
perf tools: Propagate get_cpuid() error
...

+411 -131
+17 -13
arch/x86/events/amd/core.c
··· 5 5 #include <linux/init.h> 6 6 #include <linux/slab.h> 7 7 #include <linux/delay.h> 8 + #include <linux/jiffies.h> 8 9 #include <asm/apicdef.h> 9 10 #include <asm/nmi.h> 10 11 11 12 #include "../perf_event.h" 12 13 13 - static DEFINE_PER_CPU(unsigned int, perf_nmi_counter); 14 + static DEFINE_PER_CPU(unsigned long, perf_nmi_tstamp); 15 + static unsigned long perf_nmi_window; 14 16 15 17 static __initconst const u64 amd_hw_cache_event_ids 16 18 [PERF_COUNT_HW_CACHE_MAX] ··· 643 641 * handler when multiple PMCs are active or PMC overflow while handling some 644 642 * other source of an NMI. 645 643 * 646 - * Attempt to mitigate this by using the number of active PMCs to determine 647 - * whether to return NMI_HANDLED if the perf NMI handler did not handle/reset 648 - * any PMCs. The per-CPU perf_nmi_counter variable is set to a minimum of the 649 - * number of active PMCs or 2. The value of 2 is used in case an NMI does not 650 - * arrive at the LAPIC in time to be collapsed into an already pending NMI. 644 + * Attempt to mitigate this by creating an NMI window in which un-handled NMIs 645 + * received during this window will be claimed. This prevents extending the 646 + * window past when it is possible that latent NMIs should be received. The 647 + * per-CPU perf_nmi_tstamp will be set to the window end time whenever perf has 648 + * handled a counter. When an un-handled NMI is received, it will be claimed 649 + * only if arriving within that window. 651 650 */ 652 651 static int amd_pmu_handle_irq(struct pt_regs *regs) 653 652 { ··· 666 663 handled = x86_pmu_handle_irq(regs); 667 664 668 665 /* 669 - * If a counter was handled, record the number of possible remaining 670 - * NMIs that can occur. 666 + * If a counter was handled, record a timestamp such that un-handled 667 + * NMIs will be claimed if arriving within that window. 671 668 */ 672 669 if (handled) { 673 - this_cpu_write(perf_nmi_counter, 674 - min_t(unsigned int, 2, active)); 670 + this_cpu_write(perf_nmi_tstamp, 671 + jiffies + perf_nmi_window); 675 672 676 673 return handled; 677 674 } 678 675 679 - if (!this_cpu_read(perf_nmi_counter)) 676 + if (time_after(jiffies, this_cpu_read(perf_nmi_tstamp))) 680 677 return NMI_DONE; 681 - 682 - this_cpu_dec(perf_nmi_counter); 683 678 684 679 return NMI_HANDLED; 685 680 } ··· 909 908 { 910 909 if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) 911 910 return 0; 911 + 912 + /* Avoid calulating the value each time in the NMI handler */ 913 + perf_nmi_window = msecs_to_jiffies(100); 912 914 913 915 switch (boot_cpu_data.x86) { 914 916 case 0x15:
+4
arch/x86/events/intel/core.c
··· 4983 4983 case INTEL_FAM6_SKYLAKE: 4984 4984 case INTEL_FAM6_KABYLAKE_L: 4985 4985 case INTEL_FAM6_KABYLAKE: 4986 + case INTEL_FAM6_COMETLAKE_L: 4987 + case INTEL_FAM6_COMETLAKE: 4986 4988 x86_add_quirk(intel_pebs_isolation_quirk); 4987 4989 x86_pmu.late_ack = true; 4988 4990 memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids)); ··· 5033 5031 /* fall through */ 5034 5032 case INTEL_FAM6_ICELAKE_L: 5035 5033 case INTEL_FAM6_ICELAKE: 5034 + case INTEL_FAM6_TIGERLAKE_L: 5035 + case INTEL_FAM6_TIGERLAKE: 5036 5036 x86_pmu.late_ack = true; 5037 5037 memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids)); 5038 5038 memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
+32 -12
arch/x86/events/intel/cstate.c
··· 45 45 * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter 46 46 * perf code: 0x01 47 47 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM, 48 - CNL 48 + * CNL,KBL,CML 49 49 * Scope: Core 50 50 * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter 51 51 * perf code: 0x02 52 52 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, 53 - * SKL,KNL,GLM,CNL 53 + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL 54 54 * Scope: Core 55 55 * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter 56 56 * perf code: 0x03 57 - * Available model: SNB,IVB,HSW,BDW,SKL,CNL 57 + * Available model: SNB,IVB,HSW,BDW,SKL,CNL,KBL,CML, 58 + * ICL,TGL 58 59 * Scope: Core 59 60 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. 60 61 * perf code: 0x00 61 - * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL 62 + * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, 63 + * KBL,CML,ICL,TGL 62 64 * Scope: Package (physical package) 63 65 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. 64 66 * perf code: 0x01 65 67 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, 66 - * GLM,CNL 68 + * GLM,CNL,KBL,CML,ICL,TGL 67 69 * Scope: Package (physical package) 68 70 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. 69 71 * perf code: 0x02 70 72 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 71 - * SKL,KNL,GLM,CNL 73 + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL 72 74 * Scope: Package (physical package) 73 75 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. 74 76 * perf code: 0x03 75 - * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL 77 + * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,CNL, 78 + * KBL,CML,ICL,TGL 76 79 * Scope: Package (physical package) 77 80 * MSR_PKG_C8_RESIDENCY: Package C8 Residency Counter. 78 81 * perf code: 0x04 79 - * Available model: HSW ULT,KBL,CNL 82 + * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL 80 83 * Scope: Package (physical package) 81 84 * MSR_PKG_C9_RESIDENCY: Package C9 Residency Counter. 82 85 * perf code: 0x05 83 - * Available model: HSW ULT,KBL,CNL 86 + * Available model: HSW ULT,KBL,CNL,CML,ICL,TGL 84 87 * Scope: Package (physical package) 85 88 * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. 86 89 * perf code: 0x06 87 - * Available model: HSW ULT,KBL,GLM,CNL 90 + * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL 88 91 * Scope: Package (physical package) 89 92 * 90 93 */ ··· 547 544 BIT(PERF_CSTATE_PKG_C10_RES), 548 545 }; 549 546 547 + static const struct cstate_model icl_cstates __initconst = { 548 + .core_events = BIT(PERF_CSTATE_CORE_C6_RES) | 549 + BIT(PERF_CSTATE_CORE_C7_RES), 550 + 551 + .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) | 552 + BIT(PERF_CSTATE_PKG_C3_RES) | 553 + BIT(PERF_CSTATE_PKG_C6_RES) | 554 + BIT(PERF_CSTATE_PKG_C7_RES) | 555 + BIT(PERF_CSTATE_PKG_C8_RES) | 556 + BIT(PERF_CSTATE_PKG_C9_RES) | 557 + BIT(PERF_CSTATE_PKG_C10_RES), 558 + }; 559 + 550 560 static const struct cstate_model slm_cstates __initconst = { 551 561 .core_events = BIT(PERF_CSTATE_CORE_C1_RES) | 552 562 BIT(PERF_CSTATE_CORE_C6_RES), ··· 630 614 631 615 X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE_L, hswult_cstates), 632 616 X86_CSTATES_MODEL(INTEL_FAM6_KABYLAKE, hswult_cstates), 617 + X86_CSTATES_MODEL(INTEL_FAM6_COMETLAKE_L, hswult_cstates), 618 + X86_CSTATES_MODEL(INTEL_FAM6_COMETLAKE, hswult_cstates), 633 619 634 620 X86_CSTATES_MODEL(INTEL_FAM6_CANNONLAKE_L, cnl_cstates), 635 621 ··· 643 625 644 626 X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), 645 627 646 - X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, snb_cstates), 647 - X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, snb_cstates), 628 + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates), 629 + X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates), 630 + X86_CSTATES_MODEL(INTEL_FAM6_TIGERLAKE_L, icl_cstates), 631 + X86_CSTATES_MODEL(INTEL_FAM6_TIGERLAKE, icl_cstates), 648 632 { }, 649 633 }; 650 634 MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match);
+7
arch/x86/events/msr.c
··· 89 89 case INTEL_FAM6_SKYLAKE_X: 90 90 case INTEL_FAM6_KABYLAKE_L: 91 91 case INTEL_FAM6_KABYLAKE: 92 + case INTEL_FAM6_COMETLAKE_L: 93 + case INTEL_FAM6_COMETLAKE: 92 94 case INTEL_FAM6_ICELAKE_L: 95 + case INTEL_FAM6_ICELAKE: 96 + case INTEL_FAM6_ICELAKE_X: 97 + case INTEL_FAM6_ICELAKE_D: 98 + case INTEL_FAM6_TIGERLAKE_L: 99 + case INTEL_FAM6_TIGERLAKE: 93 100 if (idx == PERF_MSR_SMI || idx == PERF_MSR_PPERF) 94 101 return true; 95 102 break;
+36 -7
kernel/events/core.c
··· 3779 3779 perf_event_groups_insert(&ctx->flexible_groups, event); 3780 3780 } 3781 3781 3782 + /* pick an event from the flexible_groups to rotate */ 3782 3783 static inline struct perf_event * 3783 - ctx_first_active(struct perf_event_context *ctx) 3784 + ctx_event_to_rotate(struct perf_event_context *ctx) 3784 3785 { 3785 - return list_first_entry_or_null(&ctx->flexible_active, 3786 - struct perf_event, active_list); 3786 + struct perf_event *event; 3787 + 3788 + /* pick the first active flexible event */ 3789 + event = list_first_entry_or_null(&ctx->flexible_active, 3790 + struct perf_event, active_list); 3791 + 3792 + /* if no active flexible event, pick the first event */ 3793 + if (!event) { 3794 + event = rb_entry_safe(rb_first(&ctx->flexible_groups.tree), 3795 + typeof(*event), group_node); 3796 + } 3797 + 3798 + return event; 3787 3799 } 3788 3800 3789 3801 static bool perf_rotate_context(struct perf_cpu_context *cpuctx) ··· 3820 3808 perf_pmu_disable(cpuctx->ctx.pmu); 3821 3809 3822 3810 if (task_rotate) 3823 - task_event = ctx_first_active(task_ctx); 3811 + task_event = ctx_event_to_rotate(task_ctx); 3824 3812 if (cpu_rotate) 3825 - cpu_event = ctx_first_active(&cpuctx->ctx); 3813 + cpu_event = ctx_event_to_rotate(&cpuctx->ctx); 3826 3814 3827 3815 /* 3828 3816 * As per the order given at ctx_resched() first 'pop' task flexible ··· 5680 5668 * undo the VM accounting. 5681 5669 */ 5682 5670 5683 - atomic_long_sub((size >> PAGE_SHIFT) + 1, &mmap_user->locked_vm); 5671 + atomic_long_sub((size >> PAGE_SHIFT) + 1 - mmap_locked, 5672 + &mmap_user->locked_vm); 5684 5673 atomic64_sub(mmap_locked, &vma->vm_mm->pinned_vm); 5685 5674 free_uid(mmap_user); 5686 5675 ··· 5825 5812 5826 5813 user_locked = atomic_long_read(&user->locked_vm) + user_extra; 5827 5814 5828 - if (user_locked > user_lock_limit) 5815 + if (user_locked <= user_lock_limit) { 5816 + /* charge all to locked_vm */ 5817 + } else if (atomic_long_read(&user->locked_vm) >= user_lock_limit) { 5818 + /* charge all to pinned_vm */ 5819 + extra = user_extra; 5820 + user_extra = 0; 5821 + } else { 5822 + /* 5823 + * charge locked_vm until it hits user_lock_limit; 5824 + * charge the rest from pinned_vm 5825 + */ 5829 5826 extra = user_locked - user_lock_limit; 5827 + user_extra -= extra; 5828 + } 5830 5829 5831 5830 lock_limit = rlimit(RLIMIT_MEMLOCK); 5832 5831 lock_limit >>= PAGE_SHIFT; ··· 11887 11862 child, leader, child_ctx); 11888 11863 if (IS_ERR(child_ctr)) 11889 11864 return PTR_ERR(child_ctr); 11865 + 11866 + if (sub->aux_event == parent_event && 11867 + !perf_get_aux_event(child_ctr, leader)) 11868 + return -EINVAL; 11890 11869 } 11891 11870 return 0; 11892 11871 }
+3 -1
tools/arch/arm/include/uapi/asm/kvm.h
··· 266 266 #define KVM_DEV_ARM_ITS_CTRL_RESET 4 267 267 268 268 /* KVM_IRQ_LINE irq field index values */ 269 + #define KVM_ARM_IRQ_VCPU2_SHIFT 28 270 + #define KVM_ARM_IRQ_VCPU2_MASK 0xf 269 271 #define KVM_ARM_IRQ_TYPE_SHIFT 24 270 - #define KVM_ARM_IRQ_TYPE_MASK 0xff 272 + #define KVM_ARM_IRQ_TYPE_MASK 0xf 271 273 #define KVM_ARM_IRQ_VCPU_SHIFT 16 272 274 #define KVM_ARM_IRQ_VCPU_MASK 0xff 273 275 #define KVM_ARM_IRQ_NUM_SHIFT 0
+3 -1
tools/arch/arm64/include/uapi/asm/kvm.h
··· 325 325 #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1 326 326 327 327 /* KVM_IRQ_LINE irq field index values */ 328 + #define KVM_ARM_IRQ_VCPU2_SHIFT 28 329 + #define KVM_ARM_IRQ_VCPU2_MASK 0xf 328 330 #define KVM_ARM_IRQ_TYPE_SHIFT 24 329 - #define KVM_ARM_IRQ_TYPE_MASK 0xff 331 + #define KVM_ARM_IRQ_TYPE_MASK 0xf 330 332 #define KVM_ARM_IRQ_VCPU_SHIFT 16 331 333 #define KVM_ARM_IRQ_VCPU_MASK 0xff 332 334 #define KVM_ARM_IRQ_NUM_SHIFT 0
+6
tools/arch/s390/include/uapi/asm/kvm.h
··· 231 231 #define KVM_SYNC_GSCB (1UL << 9) 232 232 #define KVM_SYNC_BPBC (1UL << 10) 233 233 #define KVM_SYNC_ETOKEN (1UL << 11) 234 + 235 + #define KVM_SYNC_S390_VALID_FIELDS \ 236 + (KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \ 237 + KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \ 238 + KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN) 239 + 234 240 /* length and alignment of the sdnx as a power of two */ 235 241 #define SDNXC 8 236 242 #define SDNXL (1UL << SDNXC)
+2
tools/arch/x86/include/uapi/asm/vmx.h
··· 31 31 #define EXIT_REASON_EXCEPTION_NMI 0 32 32 #define EXIT_REASON_EXTERNAL_INTERRUPT 1 33 33 #define EXIT_REASON_TRIPLE_FAULT 2 34 + #define EXIT_REASON_INIT_SIGNAL 3 34 35 35 36 #define EXIT_REASON_PENDING_INTERRUPT 7 36 37 #define EXIT_REASON_NMI_WINDOW 8 ··· 91 90 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ 92 91 { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ 93 92 { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ 93 + { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, \ 94 94 { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, \ 95 95 { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ 96 96 { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \
+3
tools/include/uapi/asm-generic/mman-common.h
··· 67 67 #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ 68 68 #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */ 69 69 70 + #define MADV_COLD 20 /* deactivate these pages */ 71 + #define MADV_PAGEOUT 21 /* reclaim these pages */ 72 + 70 73 /* compatibility flags */ 71 74 #define MAP_FILE 0 72 75
+1
tools/include/uapi/drm/i915_drm.h
··· 521 521 #define I915_SCHEDULER_CAP_PRIORITY (1ul << 1) 522 522 #define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) 523 523 #define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3) 524 + #define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4) 524 525 525 526 #define I915_PARAM_HUC_STATUS 42 526 527
+4 -51
tools/include/uapi/linux/fs.h
··· 13 13 #include <linux/limits.h> 14 14 #include <linux/ioctl.h> 15 15 #include <linux/types.h> 16 + #ifndef __KERNEL__ 17 + #include <linux/fscrypt.h> 18 + #endif 16 19 17 20 /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ 18 21 #if !defined(__KERNEL__) ··· 216 213 #define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) 217 214 218 215 /* 219 - * File system encryption support 220 - */ 221 - /* Policy provided via an ioctl on the topmost directory */ 222 - #define FS_KEY_DESCRIPTOR_SIZE 8 223 - 224 - #define FS_POLICY_FLAGS_PAD_4 0x00 225 - #define FS_POLICY_FLAGS_PAD_8 0x01 226 - #define FS_POLICY_FLAGS_PAD_16 0x02 227 - #define FS_POLICY_FLAGS_PAD_32 0x03 228 - #define FS_POLICY_FLAGS_PAD_MASK 0x03 229 - #define FS_POLICY_FLAG_DIRECT_KEY 0x04 /* use master key directly */ 230 - #define FS_POLICY_FLAGS_VALID 0x07 231 - 232 - /* Encryption algorithms */ 233 - #define FS_ENCRYPTION_MODE_INVALID 0 234 - #define FS_ENCRYPTION_MODE_AES_256_XTS 1 235 - #define FS_ENCRYPTION_MODE_AES_256_GCM 2 236 - #define FS_ENCRYPTION_MODE_AES_256_CBC 3 237 - #define FS_ENCRYPTION_MODE_AES_256_CTS 4 238 - #define FS_ENCRYPTION_MODE_AES_128_CBC 5 239 - #define FS_ENCRYPTION_MODE_AES_128_CTS 6 240 - #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 /* Removed, do not use. */ 241 - #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 /* Removed, do not use. */ 242 - #define FS_ENCRYPTION_MODE_ADIANTUM 9 243 - 244 - struct fscrypt_policy { 245 - __u8 version; 246 - __u8 contents_encryption_mode; 247 - __u8 filenames_encryption_mode; 248 - __u8 flags; 249 - __u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; 250 - }; 251 - 252 - #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) 253 - #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) 254 - #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) 255 - 256 - /* Parameters for passing an encryption key into the kernel keyring */ 257 - #define FS_KEY_DESC_PREFIX "fscrypt:" 258 - #define FS_KEY_DESC_PREFIX_SIZE 8 259 - 260 - /* Structure that userspace passes to the kernel keyring */ 261 - #define FS_MAX_KEY_SIZE 64 262 - 263 - struct fscrypt_key { 264 - __u32 mode; 265 - __u8 raw[FS_MAX_KEY_SIZE]; 266 - __u32 size; 267 - }; 268 - 269 - /* 270 216 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) 271 217 * 272 218 * Note: for historical reasons, these flags were originally used and ··· 258 306 #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 259 307 #define FS_HUGE_FILE_FL 0x00040000 /* Reserved for ext4 */ 260 308 #define FS_EXTENT_FL 0x00080000 /* Extents */ 309 + #define FS_VERITY_FL 0x00100000 /* Verity protected inode */ 261 310 #define FS_EA_INODE_FL 0x00200000 /* Inode used for large EA */ 262 311 #define FS_EOFBLOCKS_FL 0x00400000 /* Reserved for ext4 */ 263 312 #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
+181
tools/include/uapi/linux/fscrypt.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + /* 3 + * fscrypt user API 4 + * 5 + * These ioctls can be used on filesystems that support fscrypt. See the 6 + * "User API" section of Documentation/filesystems/fscrypt.rst. 7 + */ 8 + #ifndef _UAPI_LINUX_FSCRYPT_H 9 + #define _UAPI_LINUX_FSCRYPT_H 10 + 11 + #include <linux/types.h> 12 + 13 + /* Encryption policy flags */ 14 + #define FSCRYPT_POLICY_FLAGS_PAD_4 0x00 15 + #define FSCRYPT_POLICY_FLAGS_PAD_8 0x01 16 + #define FSCRYPT_POLICY_FLAGS_PAD_16 0x02 17 + #define FSCRYPT_POLICY_FLAGS_PAD_32 0x03 18 + #define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03 19 + #define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04 20 + #define FSCRYPT_POLICY_FLAGS_VALID 0x07 21 + 22 + /* Encryption algorithms */ 23 + #define FSCRYPT_MODE_AES_256_XTS 1 24 + #define FSCRYPT_MODE_AES_256_CTS 4 25 + #define FSCRYPT_MODE_AES_128_CBC 5 26 + #define FSCRYPT_MODE_AES_128_CTS 6 27 + #define FSCRYPT_MODE_ADIANTUM 9 28 + #define __FSCRYPT_MODE_MAX 9 29 + 30 + /* 31 + * Legacy policy version; ad-hoc KDF and no key verification. 32 + * For new encrypted directories, use fscrypt_policy_v2 instead. 33 + * 34 + * Careful: the .version field for this is actually 0, not 1. 35 + */ 36 + #define FSCRYPT_POLICY_V1 0 37 + #define FSCRYPT_KEY_DESCRIPTOR_SIZE 8 38 + struct fscrypt_policy_v1 { 39 + __u8 version; 40 + __u8 contents_encryption_mode; 41 + __u8 filenames_encryption_mode; 42 + __u8 flags; 43 + __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; 44 + }; 45 + #define fscrypt_policy fscrypt_policy_v1 46 + 47 + /* 48 + * Process-subscribed "logon" key description prefix and payload format. 49 + * Deprecated; prefer FS_IOC_ADD_ENCRYPTION_KEY instead. 50 + */ 51 + #define FSCRYPT_KEY_DESC_PREFIX "fscrypt:" 52 + #define FSCRYPT_KEY_DESC_PREFIX_SIZE 8 53 + #define FSCRYPT_MAX_KEY_SIZE 64 54 + struct fscrypt_key { 55 + __u32 mode; 56 + __u8 raw[FSCRYPT_MAX_KEY_SIZE]; 57 + __u32 size; 58 + }; 59 + 60 + /* 61 + * New policy version with HKDF and key verification (recommended). 62 + */ 63 + #define FSCRYPT_POLICY_V2 2 64 + #define FSCRYPT_KEY_IDENTIFIER_SIZE 16 65 + struct fscrypt_policy_v2 { 66 + __u8 version; 67 + __u8 contents_encryption_mode; 68 + __u8 filenames_encryption_mode; 69 + __u8 flags; 70 + __u8 __reserved[4]; 71 + __u8 master_key_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]; 72 + }; 73 + 74 + /* Struct passed to FS_IOC_GET_ENCRYPTION_POLICY_EX */ 75 + struct fscrypt_get_policy_ex_arg { 76 + __u64 policy_size; /* input/output */ 77 + union { 78 + __u8 version; 79 + struct fscrypt_policy_v1 v1; 80 + struct fscrypt_policy_v2 v2; 81 + } policy; /* output */ 82 + }; 83 + 84 + /* 85 + * v1 policy keys are specified by an arbitrary 8-byte key "descriptor", 86 + * matching fscrypt_policy_v1::master_key_descriptor. 87 + */ 88 + #define FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR 1 89 + 90 + /* 91 + * v2 policy keys are specified by a 16-byte key "identifier" which the kernel 92 + * calculates as a cryptographic hash of the key itself, 93 + * matching fscrypt_policy_v2::master_key_identifier. 94 + */ 95 + #define FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER 2 96 + 97 + /* 98 + * Specifies a key, either for v1 or v2 policies. This doesn't contain the 99 + * actual key itself; this is just the "name" of the key. 100 + */ 101 + struct fscrypt_key_specifier { 102 + __u32 type; /* one of FSCRYPT_KEY_SPEC_TYPE_* */ 103 + __u32 __reserved; 104 + union { 105 + __u8 __reserved[32]; /* reserve some extra space */ 106 + __u8 descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; 107 + __u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]; 108 + } u; 109 + }; 110 + 111 + /* Struct passed to FS_IOC_ADD_ENCRYPTION_KEY */ 112 + struct fscrypt_add_key_arg { 113 + struct fscrypt_key_specifier key_spec; 114 + __u32 raw_size; 115 + __u32 __reserved[9]; 116 + __u8 raw[]; 117 + }; 118 + 119 + /* Struct passed to FS_IOC_REMOVE_ENCRYPTION_KEY */ 120 + struct fscrypt_remove_key_arg { 121 + struct fscrypt_key_specifier key_spec; 122 + #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY 0x00000001 123 + #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS 0x00000002 124 + __u32 removal_status_flags; /* output */ 125 + __u32 __reserved[5]; 126 + }; 127 + 128 + /* Struct passed to FS_IOC_GET_ENCRYPTION_KEY_STATUS */ 129 + struct fscrypt_get_key_status_arg { 130 + /* input */ 131 + struct fscrypt_key_specifier key_spec; 132 + __u32 __reserved[6]; 133 + 134 + /* output */ 135 + #define FSCRYPT_KEY_STATUS_ABSENT 1 136 + #define FSCRYPT_KEY_STATUS_PRESENT 2 137 + #define FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED 3 138 + __u32 status; 139 + #define FSCRYPT_KEY_STATUS_FLAG_ADDED_BY_SELF 0x00000001 140 + __u32 status_flags; 141 + __u32 user_count; 142 + __u32 __out_reserved[13]; 143 + }; 144 + 145 + #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) 146 + #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) 147 + #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) 148 + #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */ 149 + #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg) 150 + #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg) 151 + #define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg) 152 + #define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg) 153 + 154 + /**********************************************************************/ 155 + 156 + /* old names; don't add anything new here! */ 157 + #ifndef __KERNEL__ 158 + #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE 159 + #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4 160 + #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8 161 + #define FS_POLICY_FLAGS_PAD_16 FSCRYPT_POLICY_FLAGS_PAD_16 162 + #define FS_POLICY_FLAGS_PAD_32 FSCRYPT_POLICY_FLAGS_PAD_32 163 + #define FS_POLICY_FLAGS_PAD_MASK FSCRYPT_POLICY_FLAGS_PAD_MASK 164 + #define FS_POLICY_FLAG_DIRECT_KEY FSCRYPT_POLICY_FLAG_DIRECT_KEY 165 + #define FS_POLICY_FLAGS_VALID FSCRYPT_POLICY_FLAGS_VALID 166 + #define FS_ENCRYPTION_MODE_INVALID 0 /* never used */ 167 + #define FS_ENCRYPTION_MODE_AES_256_XTS FSCRYPT_MODE_AES_256_XTS 168 + #define FS_ENCRYPTION_MODE_AES_256_GCM 2 /* never used */ 169 + #define FS_ENCRYPTION_MODE_AES_256_CBC 3 /* never used */ 170 + #define FS_ENCRYPTION_MODE_AES_256_CTS FSCRYPT_MODE_AES_256_CTS 171 + #define FS_ENCRYPTION_MODE_AES_128_CBC FSCRYPT_MODE_AES_128_CBC 172 + #define FS_ENCRYPTION_MODE_AES_128_CTS FSCRYPT_MODE_AES_128_CTS 173 + #define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7 /* removed */ 174 + #define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8 /* removed */ 175 + #define FS_ENCRYPTION_MODE_ADIANTUM FSCRYPT_MODE_ADIANTUM 176 + #define FS_KEY_DESC_PREFIX FSCRYPT_KEY_DESC_PREFIX 177 + #define FS_KEY_DESC_PREFIX_SIZE FSCRYPT_KEY_DESC_PREFIX_SIZE 178 + #define FS_MAX_KEY_SIZE FSCRYPT_MAX_KEY_SIZE 179 + #endif /* !__KERNEL__ */ 180 + 181 + #endif /* _UAPI_LINUX_FSCRYPT_H */
+3
tools/include/uapi/linux/kvm.h
··· 243 243 #define KVM_INTERNAL_ERROR_SIMUL_EX 2 244 244 /* Encounter unexpected vm-exit due to delivery event. */ 245 245 #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 246 + /* Encounter unexpected vm-exit reason */ 247 + #define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4 246 248 247 249 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 248 250 struct kvm_run { ··· 998 996 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 999 997 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 1000 998 #define KVM_CAP_PMU_EVENT_FILTER 173 999 + #define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174 1001 1000 1002 1001 #ifdef KVM_CAP_IRQ_ROUTING 1003 1002
+4
tools/include/uapi/linux/usbdevice_fs.h
··· 158 158 #define USBDEVFS_CAP_MMAP 0x20 159 159 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 160 160 #define USBDEVFS_CAP_CONNINFO_EX 0x80 161 + #define USBDEVFS_CAP_SUSPEND 0x100 161 162 162 163 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ 163 164 ··· 224 223 * extending size of the data returned. 225 224 */ 226 225 #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) 226 + #define USBDEVFS_FORBID_SUSPEND _IO('U', 33) 227 + #define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) 228 + #define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35) 227 229 228 230 #endif /* _UAPI_LINUX_USBDEVICE_FS_H */
+7 -1
tools/lib/subcmd/Makefile
··· 20 20 LIBFILE = $(OUTPUT)libsubcmd.a 21 21 22 22 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) 23 - CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC 23 + CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -fPIC 24 + 25 + ifeq ($(DEBUG),0) 26 + ifeq ($(feature-fortify-source), 1) 27 + CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 28 + endif 29 + endif 24 30 25 31 ifeq ($(CC_NO_CLANG), 0) 26 32 CFLAGS += -O3
+3
tools/perf/Documentation/asciidoc.conf
··· 71 71 [header] 72 72 template::[header-declarations] 73 73 <refentry> 74 + ifdef::perf_date[] 75 + <refentryinfo><date>{perf_date}</date></refentryinfo> 76 + endif::perf_date[] 74 77 <refmeta> 75 78 <refentrytitle>{mantitle}</refentrytitle> 76 79 <manvolnum>{manvolnum}</manvolnum>
+2 -2
tools/perf/Documentation/jitdump-specification.txt
··· 36 36 Each jitdump file starts with a fixed size header containing the following fields in order: 37 37 38 38 39 - * 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 40 - * uint32_t version : a 4-byte value representing the format version. It is currently set to 2 39 + * 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. 40 + * uint32_t version : a 4-byte value representing the format version. It is currently set to 1 41 41 * uint32_t total_size: size in bytes of file header 42 42 * uint32_t elf_mach : ELF architecture encoding (ELF e_machine value as specified in /usr/include/elf.h) 43 43 * uint32_t pad1 : padding. Reserved for future use
+2 -2
tools/perf/arch/arm/annotate/instructions.c
··· 37 37 38 38 arm = zalloc(sizeof(*arm)); 39 39 if (!arm) 40 - return -1; 40 + return ENOMEM; 41 41 42 42 #define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" 43 43 err = regcomp(&arm->call_insn, "^blx?" ARM_CONDS "?$", REG_EXTENDED); ··· 59 59 regfree(&arm->call_insn); 60 60 out_free_arm: 61 61 free(arm); 62 - return -1; 62 + return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP; 63 63 }
+2 -2
tools/perf/arch/arm64/annotate/instructions.c
··· 95 95 96 96 arm = zalloc(sizeof(*arm)); 97 97 if (!arm) 98 - return -1; 98 + return ENOMEM; 99 99 100 100 /* bl, blr */ 101 101 err = regcomp(&arm->call_insn, "^blr?$", REG_EXTENDED); ··· 118 118 regfree(&arm->call_insn); 119 119 out_free_arm: 120 120 free(arm); 121 - return -1; 121 + return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP; 122 122 }
+2 -1
tools/perf/arch/powerpc/util/header.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <sys/types.h> 3 + #include <errno.h> 3 4 #include <unistd.h> 4 5 #include <stdio.h> 5 6 #include <stdlib.h> ··· 31 30 buffer[nb-1] = '\0'; 32 31 return 0; 33 32 } 34 - return -1; 33 + return ENOBUFS; 35 34 } 36 35 37 36 char *
+4 -2
tools/perf/arch/s390/annotate/instructions.c
··· 164 164 if (!arch->initialized) { 165 165 arch->initialized = true; 166 166 arch->associate_instruction_ops = s390__associate_ins_ops; 167 - if (cpuid) 168 - err = s390__cpuid_parse(arch, cpuid); 167 + if (cpuid) { 168 + if (s390__cpuid_parse(arch, cpuid)) 169 + err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; 170 + } 169 171 } 170 172 171 173 return err;
+5 -4
tools/perf/arch/s390/util/header.c
··· 8 8 */ 9 9 10 10 #include <sys/types.h> 11 + #include <errno.h> 11 12 #include <unistd.h> 12 13 #include <stdio.h> 13 14 #include <string.h> ··· 55 54 56 55 sysinfo = fopen(SYSINFO, "r"); 57 56 if (sysinfo == NULL) 58 - return -1; 57 + return errno; 59 58 60 59 while ((read = getline(&line, &line_sz, sysinfo)) != -1) { 61 60 if (!strncmp(line, SYSINFO_MANU, strlen(SYSINFO_MANU))) { ··· 90 89 91 90 /* Missing manufacturer, type or model information should not happen */ 92 91 if (!manufacturer[0] || !type[0] || !model[0]) 93 - return -1; 92 + return EINVAL; 94 93 95 94 /* 96 95 * Scan /proc/service_levels and return the CPU-MF counter facility ··· 134 133 else 135 134 nbytes = snprintf(buffer, sz, "%s,%s,%s", manufacturer, type, 136 135 model); 137 - return (nbytes >= sz) ? -1 : 0; 136 + return (nbytes >= sz) ? ENOBUFS : 0; 138 137 } 139 138 140 139 char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused) 141 140 { 142 141 char *buf = malloc(128); 143 142 144 - if (buf && get_cpuid(buf, 128) < 0) 143 + if (buf && get_cpuid(buf, 128)) 145 144 zfree(&buf); 146 145 return buf; 147 146 }
+4 -2
tools/perf/arch/x86/annotate/instructions.c
··· 196 196 if (arch->initialized) 197 197 return 0; 198 198 199 - if (cpuid) 200 - err = x86__cpuid_parse(arch, cpuid); 199 + if (cpuid) { 200 + if (x86__cpuid_parse(arch, cpuid)) 201 + err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; 202 + } 201 203 202 204 arch->initialized = true; 203 205 return err;
+2 -1
tools/perf/arch/x86/util/header.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <sys/types.h> 3 + #include <errno.h> 3 4 #include <unistd.h> 4 5 #include <stdio.h> 5 6 #include <stdlib.h> ··· 59 58 buffer[nb-1] = '\0'; 60 59 return 0; 61 60 } 62 - return -1; 61 + return ENOBUFS; 63 62 } 64 63 65 64 int
+4 -3
tools/perf/builtin-kvm.c
··· 705 705 706 706 static int cpu_isa_config(struct perf_kvm_stat *kvm) 707 707 { 708 - char buf[64], *cpuid; 708 + char buf[128], *cpuid; 709 709 int err; 710 710 711 711 if (kvm->live) { 712 712 err = get_cpuid(buf, sizeof(buf)); 713 713 if (err != 0) { 714 - pr_err("Failed to look up CPU type\n"); 715 - return err; 714 + pr_err("Failed to look up CPU type: %s\n", 715 + str_error_r(err, buf, sizeof(buf))); 716 + return -err; 716 717 } 717 718 cpuid = buf; 718 719 } else
+5 -1
tools/perf/builtin-script.c
··· 1063 1063 continue; 1064 1064 1065 1065 insn = 0; 1066 - for (off = 0;; off += ilen) { 1066 + for (off = 0; off < (unsigned)len; off += ilen) { 1067 1067 uint64_t ip = start + off; 1068 1068 1069 1069 printed += ip__fprintf_sym(ip, thread, x.cpumode, x.cpu, &lastsym, attr, fp); ··· 1074 1074 printed += print_srccode(thread, x.cpumode, ip); 1075 1075 break; 1076 1076 } else { 1077 + ilen = 0; 1077 1078 printed += fprintf(fp, "\t%016" PRIx64 "\t%s\n", ip, 1078 1079 dump_insn(&x, ip, buffer + off, len - off, &ilen)); 1079 1080 if (ilen == 0) ··· 1084 1083 insn++; 1085 1084 } 1086 1085 } 1086 + if (off != (unsigned)len) 1087 + printed += fprintf(fp, "\tmismatch of LBR data and executable\n"); 1087 1088 } 1088 1089 1089 1090 /* ··· 1126 1123 goto out; 1127 1124 } 1128 1125 for (off = 0; off <= end - start; off += ilen) { 1126 + ilen = 0; 1129 1127 printed += fprintf(fp, "\t%016" PRIx64 "\t%s\n", start + off, 1130 1128 dump_insn(&x, start + off, buffer + off, len - off, &ilen)); 1131 1129 if (ilen == 0)
+1
tools/perf/check-headers.sh
··· 8 8 include/uapi/linux/fadvise.h 9 9 include/uapi/linux/fcntl.h 10 10 include/uapi/linux/fs.h 11 + include/uapi/linux/fscrypt.h 11 12 include/uapi/linux/kcmp.h 12 13 include/uapi/linux/kvm.h 13 14 include/uapi/linux/in.h
tools/perf/pmu-events/arch/s390/cf_m8561/basic.json tools/perf/pmu-events/arch/s390/cf_z15/basic.json
tools/perf/pmu-events/arch/s390/cf_m8561/crypto.json tools/perf/pmu-events/arch/s390/cf_z15/crypto.json
tools/perf/pmu-events/arch/s390/cf_m8561/crypto6.json tools/perf/pmu-events/arch/s390/cf_z15/crypto6.json
tools/perf/pmu-events/arch/s390/cf_m8561/extended.json tools/perf/pmu-events/arch/s390/cf_z15/extended.json
+7
tools/perf/pmu-events/arch/s390/cf_z15/transaction.json
··· 1 + [ 2 + { 3 + "BriefDescription": "Transaction count", 4 + "MetricName": "transaction", 5 + "MetricExpr": "TX_C_TEND + TX_NC_TEND + TX_NC_TABORT + TX_C_TABORT_SPECIAL + TX_C_TABORT_NO_SPECIAL" 6 + } 7 + ]
+1 -1
tools/perf/pmu-events/arch/s390/mapfile.csv
··· 4 4 ^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core 5 5 ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core 6 6 ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core 7 - ^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_m8561,core 7 + ^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15,core
+6 -6
tools/perf/pmu-events/jevents.c
··· 450 450 const char *name; 451 451 const char *event; 452 452 } fixed[] = { 453 - { "inst_retired.any", "event=0xc0" }, 454 - { "inst_retired.any_p", "event=0xc0" }, 455 - { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" }, 456 - { "cpu_clk_unhalted.thread", "event=0x3c" }, 457 - { "cpu_clk_unhalted.core", "event=0x3c" }, 458 - { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" }, 453 + { "inst_retired.any", "event=0xc0,period=2000003" }, 454 + { "inst_retired.any_p", "event=0xc0,period=2000003" }, 455 + { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03,period=2000003" }, 456 + { "cpu_clk_unhalted.thread", "event=0x3c,period=2000003" }, 457 + { "cpu_clk_unhalted.core", "event=0x3c,period=2000003" }, 458 + { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1,period=2000003" }, 459 459 { NULL, NULL}, 460 460 }; 461 461
+1 -2
tools/perf/tests/perf-hooks.c
··· 19 19 static void the_hook(void *_hook_flags) 20 20 { 21 21 int *hook_flags = _hook_flags; 22 - int *p = NULL; 23 22 24 23 *hook_flags = 1234; 25 24 26 25 /* Generate a segfault, test perf_hooks__recover */ 27 - *p = 0; 26 + raise(SIGSEGV); 28 27 } 29 28 30 29 int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused)
+26 -9
tools/perf/util/annotate.c
··· 1631 1631 case SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF: 1632 1632 scnprintf(buf, buflen, "Please link with binutils's libopcode to enable BPF annotation"); 1633 1633 break; 1634 + case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP: 1635 + scnprintf(buf, buflen, "Problems with arch specific instruction name regular expressions."); 1636 + break; 1637 + case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING: 1638 + scnprintf(buf, buflen, "Problems while parsing the CPUID in the arch specific initialization."); 1639 + break; 1640 + case SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE: 1641 + scnprintf(buf, buflen, "Invalid BPF file: %s.", dso->long_name); 1642 + break; 1643 + case SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF: 1644 + scnprintf(buf, buflen, "The %s BPF file has no BTF section, compile with -g or use pahole -J.", 1645 + dso->long_name); 1646 + break; 1634 1647 default: 1635 1648 scnprintf(buf, buflen, "Internal error: Invalid %d error code\n", errnum); 1636 1649 break; ··· 1675 1662 1676 1663 build_id_path = strdup(filename); 1677 1664 if (!build_id_path) 1678 - return -1; 1665 + return ENOMEM; 1679 1666 1680 1667 /* 1681 1668 * old style build-id cache has name of XX/XXXXXXX.. while ··· 1726 1713 char tpath[PATH_MAX]; 1727 1714 size_t buf_size; 1728 1715 int nr_skip = 0; 1729 - int ret = -1; 1730 1716 char *buf; 1731 1717 bfd *bfdf; 1718 + int ret; 1732 1719 FILE *s; 1733 1720 1734 1721 if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO) 1735 - return -1; 1722 + return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE; 1736 1723 1737 1724 pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__, 1738 1725 sym->name, sym->start, sym->end - sym->start); ··· 1745 1732 assert(bfd_check_format(bfdf, bfd_object)); 1746 1733 1747 1734 s = open_memstream(&buf, &buf_size); 1748 - if (!s) 1735 + if (!s) { 1736 + ret = errno; 1749 1737 goto out; 1738 + } 1750 1739 init_disassemble_info(&info, s, 1751 1740 (fprintf_ftype) fprintf); 1752 1741 ··· 1757 1742 1758 1743 info_node = perf_env__find_bpf_prog_info(dso->bpf_prog.env, 1759 1744 dso->bpf_prog.id); 1760 - if (!info_node) 1745 + if (!info_node) { 1746 + return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF; 1761 1747 goto out; 1748 + } 1762 1749 info_linear = info_node->info_linear; 1763 1750 sub_id = dso->bpf_prog.sub_id; 1764 1751 ··· 2088 2071 int err; 2089 2072 2090 2073 if (!arch_name) 2091 - return -1; 2074 + return errno; 2092 2075 2093 2076 args.arch = arch = arch__find(arch_name); 2094 2077 if (arch == NULL) 2095 - return -ENOTSUP; 2078 + return ENOTSUP; 2096 2079 2097 2080 if (parch) 2098 2081 *parch = arch; ··· 2988 2971 2989 2972 notes->offsets = zalloc(size * sizeof(struct annotation_line *)); 2990 2973 if (notes->offsets == NULL) 2991 - return -1; 2974 + return ENOMEM; 2992 2975 2993 2976 if (perf_evsel__is_group_event(evsel)) 2994 2977 nr_pcnt = evsel->core.nr_members; ··· 3014 2997 3015 2998 out_free_offsets: 3016 2999 zfree(&notes->offsets); 3017 - return -1; 3000 + return err; 3018 3001 } 3019 3002 3020 3003 #define ANNOTATION__CFG(n) \
+4
tools/perf/util/annotate.h
··· 370 370 371 371 SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX = __SYMBOL_ANNOTATE_ERRNO__START, 372 372 SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF, 373 + SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING, 374 + SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP, 375 + SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE, 376 + SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF, 373 377 374 378 __SYMBOL_ANNOTATE_ERRNO__END, 375 379 };
+2 -1
tools/perf/util/evsel.c
··· 30 30 #include "counts.h" 31 31 #include "event.h" 32 32 #include "evsel.h" 33 + #include "util/env.h" 33 34 #include "util/evsel_config.h" 34 35 #include "util/evsel_fprintf.h" 35 36 #include "evlist.h" ··· 2513 2512 { 2514 2513 if (evsel && evsel->evlist) 2515 2514 return evsel->evlist->env; 2516 - return NULL; 2515 + return &perf_env; 2517 2516 } 2518 2517 2519 2518 static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
+3 -3
tools/perf/util/jitdump.c
··· 395 395 size_t size; 396 396 u16 idr_size; 397 397 const char *sym; 398 - uint32_t count; 398 + uint64_t count; 399 399 int ret, csize, usize; 400 400 pid_t pid, tid; 401 401 struct { ··· 418 418 return -1; 419 419 420 420 filename = event->mmap2.filename; 421 - size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%u.so", 421 + size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so", 422 422 jd->dir, 423 423 pid, 424 424 count); ··· 529 529 return -1; 530 530 531 531 filename = event->mmap2.filename; 532 - size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%"PRIu64, 532 + size = snprintf(filename, PATH_MAX, "%s/jitted-%d-%" PRIu64 ".so", 533 533 jd->dir, 534 534 pid, 535 535 jr->move.code_index);
+3 -3
tools/perf/util/llvm-utils.c
··· 233 233 const char *prefix_dir = ""; 234 234 const char *suffix_dir = ""; 235 235 236 + /* _UTSNAME_LENGTH is 65 */ 237 + char release[128]; 238 + 236 239 char *autoconf_path; 237 240 238 241 int err; 239 242 240 243 if (!test_dir) { 241 - /* _UTSNAME_LENGTH is 65 */ 242 - char release[128]; 243 - 244 244 err = fetch_kernel_version(NULL, release, 245 245 sizeof(release)); 246 246 if (err)
+3
tools/perf/util/map.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "symbol.h" 3 + #include <assert.h> 3 4 #include <errno.h> 4 5 #include <inttypes.h> 5 6 #include <limits.h> ··· 851 850 } 852 851 853 852 after->start = map->end; 853 + after->pgoff += map->end - pos->start; 854 + assert(pos->map_ip(pos, map->end) == after->map_ip(after, map->end)); 854 855 __map_groups__insert(pos->groups, after); 855 856 if (verbose >= 2 && !use_browser) 856 857 map__fprintf(after, fp);
+6
tools/perf/util/python.c
··· 14 14 #include "thread_map.h" 15 15 #include "trace-event.h" 16 16 #include "mmap.h" 17 + #include "util/env.h" 17 18 #include <internal/lib.h> 18 19 #include "../perf-sys.h" 19 20 ··· 53 52 { 54 53 return 0; 55 54 } 55 + 56 + /* 57 + * Add this one here not to drag util/env.c 58 + */ 59 + struct perf_env perf_env; 56 60 57 61 /* 58 62 * Support debug printing even though util/debug.c is not linked. That means