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:
"Fixes and HW enablement patches:

- Tooling fixes, most of which are tooling header synchronization
with v5.6 changes

- Fix kprobes fallout on ARM

- Add Intel Elkhart Lake support and extend Tremont support, these
are relatively simple and should only affect those models

- Fix the AMD family 17h generic event table"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
perf llvm: Fix script used to obtain kernel make directives to work with new kbuild
tools headers kvm: Sync linux/kvm.h with the kernel sources
tools headers kvm: Sync kvm headers with the kernel sources
tools arch x86: Sync asm/cpufeatures.h with the kernel sources
tools headers x86: Sync disabled-features.h
tools include UAPI: Sync sound/asound.h copy
tools headers UAPI: Sync asm-generic/mman-common.h with the kernel
perf tools: Add arm64 version of get_cpuid()
tools headers UAPI: Sync drm/i915_drm.h with the kernel sources
tools headers uapi: Sync linux/fscrypt.h with the kernel sources
tools headers UAPI: Sync sched.h with the kernel
perf trace: Resolve prctl's 'option' arg strings to numbers
perf beauty prctl: Export the 'options' strarray
tools headers UAPI: Sync prctl.h with the kernel sources
tools headers UAPI: Sync copy of arm64's asm/unistd.h with the kernel sources
perf maps: Move kmap::kmaps setup to maps__insert()
perf maps: Fix map__clone() for struct kmap
perf maps: Mark ksymbol DSOs with kernel type
perf maps: Mark module DSOs with kernel type
tools include UAPI: Sync x86's syscalls_64.tbl, generic unistd.h and fcntl.h to pick up openat2 and pidfd_getfd
...

+383 -103
+2 -5
arch/arm/kernel/ftrace.c
··· 78 78 { 79 79 unsigned long replaced; 80 80 81 - if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { 81 + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) 82 82 old = __opcode_to_mem_thumb32(old); 83 - new = __opcode_to_mem_thumb32(new); 84 - } else { 83 + else 85 84 old = __opcode_to_mem_arm(old); 86 - new = __opcode_to_mem_arm(new); 87 - } 88 85 89 86 if (validate) { 90 87 if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
+9 -10
arch/arm/kernel/patch.c
··· 16 16 unsigned int insn; 17 17 }; 18 18 19 + #ifdef CONFIG_MMU 19 20 static DEFINE_RAW_SPINLOCK(patch_lock); 20 21 21 22 static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) 22 - __acquires(&patch_lock) 23 23 { 24 24 unsigned int uintaddr = (uintptr_t) addr; 25 25 bool module = !core_kernel_text(uintaddr); ··· 34 34 35 35 if (flags) 36 36 raw_spin_lock_irqsave(&patch_lock, *flags); 37 - else 38 - __acquire(&patch_lock); 39 37 40 38 set_fixmap(fixmap, page_to_phys(page)); 41 39 ··· 41 43 } 42 44 43 45 static void __kprobes patch_unmap(int fixmap, unsigned long *flags) 44 - __releases(&patch_lock) 45 46 { 46 47 clear_fixmap(fixmap); 47 48 48 49 if (flags) 49 50 raw_spin_unlock_irqrestore(&patch_lock, *flags); 50 - else 51 - __release(&patch_lock); 52 51 } 52 + #else 53 + static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags) 54 + { 55 + return addr; 56 + } 57 + static void __kprobes patch_unmap(int fixmap, unsigned long *flags) { } 58 + #endif 53 59 54 60 void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap) 55 61 { ··· 66 64 67 65 if (remap) 68 66 waddr = patch_map(addr, FIX_TEXT_POKE0, &flags); 69 - else 70 - __acquire(&patch_lock); 71 67 72 68 if (thumb2 && __opcode_is_thumb16(insn)) { 73 69 *(u16 *)waddr = __opcode_to_mem_thumb16(insn); ··· 102 102 if (waddr != addr) { 103 103 flush_kernel_vmap_range(waddr, twopage ? size / 2 : size); 104 104 patch_unmap(FIX_TEXT_POKE0, &flags); 105 - } else 106 - __release(&patch_lock); 105 + } 107 106 108 107 flush_icache_range((uintptr_t)(addr), 109 108 (uintptr_t)(addr) + size);
+1
arch/x86/events/amd/core.c
··· 250 250 [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, 251 251 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 252 252 [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, 253 + [PERF_COUNT_HW_CACHE_MISSES] = 0x0964, 253 254 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, 254 255 [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, 255 256 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287,
+1
arch/x86/events/intel/core.c
··· 4765 4765 break; 4766 4766 4767 4767 case INTEL_FAM6_ATOM_TREMONT_D: 4768 + case INTEL_FAM6_ATOM_TREMONT: 4768 4769 x86_pmu.late_ack = true; 4769 4770 memcpy(hw_cache_event_ids, glp_hw_cache_event_ids, 4770 4771 sizeof(hw_cache_event_ids));
+13 -9
arch/x86/events/intel/cstate.c
··· 40 40 * Model specific counters: 41 41 * MSR_CORE_C1_RES: CORE C1 Residency Counter 42 42 * perf code: 0x00 43 - * Available model: SLM,AMT,GLM,CNL 43 + * Available model: SLM,AMT,GLM,CNL,TNT 44 44 * Scope: Core (each processor core has a MSR) 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,KBL,CML 48 + * CNL,KBL,CML,TNT 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,KBL,CML,ICL,TGL 53 + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL, 54 + * TNT 54 55 * Scope: Core 55 56 * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter 56 57 * perf code: 0x03 ··· 61 60 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. 62 61 * perf code: 0x00 63 62 * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL, 64 - * KBL,CML,ICL,TGL 63 + * KBL,CML,ICL,TGL,TNT 65 64 * Scope: Package (physical package) 66 65 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. 67 66 * perf code: 0x01 68 67 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL, 69 - * GLM,CNL,KBL,CML,ICL,TGL 68 + * GLM,CNL,KBL,CML,ICL,TGL,TNT 70 69 * Scope: Package (physical package) 71 70 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. 72 71 * perf code: 0x02 73 - * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 74 - * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL 72 + * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW, 73 + * SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL, 74 + * TNT 75 75 * Scope: Package (physical package) 76 76 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. 77 77 * perf code: 0x03 ··· 89 87 * Scope: Package (physical package) 90 88 * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. 91 89 * perf code: 0x06 92 - * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL 90 + * Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL, 91 + * TNT 93 92 * Scope: Package (physical package) 94 93 * 95 94 */ ··· 643 640 644 641 X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates), 645 642 X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_D, glm_cstates), 646 - 647 643 X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), 644 + X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT_D, glm_cstates), 645 + X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT, glm_cstates), 648 646 649 647 X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates), 650 648 X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates),
+2
arch/x86/events/intel/ds.c
··· 1714 1714 old = ((s64)(prev_raw_count << shift) >> shift); 1715 1715 local64_add(new - old + count * period, &event->count); 1716 1716 1717 + local64_set(&hwc->period_left, -new); 1718 + 1717 1719 perf_event_update_userpage(event); 1718 1720 1719 1721 return 0;
+2 -1
arch/x86/events/msr.c
··· 75 75 76 76 case INTEL_FAM6_ATOM_GOLDMONT: 77 77 case INTEL_FAM6_ATOM_GOLDMONT_D: 78 - 79 78 case INTEL_FAM6_ATOM_GOLDMONT_PLUS: 79 + case INTEL_FAM6_ATOM_TREMONT_D: 80 + case INTEL_FAM6_ATOM_TREMONT: 80 81 81 82 case INTEL_FAM6_XEON_PHI_KNL: 82 83 case INTEL_FAM6_XEON_PHI_KNM:
+10 -2
tools/arch/arm64/include/uapi/asm/kvm.h
··· 220 220 #define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2) 221 221 #define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1) 222 222 223 - /* EL0 Virtual Timer Registers */ 223 + /* 224 + * EL0 Virtual Timer Registers 225 + * 226 + * WARNING: 227 + * KVM_REG_ARM_TIMER_CVAL and KVM_REG_ARM_TIMER_CNT are not defined 228 + * with the appropriate register encodings. Their values have been 229 + * accidentally swapped. As this is set API, the definitions here 230 + * must be used, rather than ones derived from the encodings. 231 + */ 224 232 #define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1) 225 - #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) 226 233 #define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2) 234 + #define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2) 227 235 228 236 /* KVM-as-firmware specific pseudo-registers */ 229 237 #define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)
+1
tools/arch/arm64/include/uapi/asm/unistd.h
··· 19 19 #define __ARCH_WANT_NEW_STAT 20 20 #define __ARCH_WANT_SET_GET_RLIMIT 21 21 #define __ARCH_WANT_TIME32_SYSCALLS 22 + #define __ARCH_WANT_SYS_CLONE3 22 23 23 24 #include <asm-generic/unistd.h>
+2
tools/arch/x86/include/asm/cpufeatures.h
··· 220 220 #define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */ 221 221 #define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ 222 222 #define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */ 223 + #define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */ 223 224 224 225 /* Virtualization flags: Linux defined, word 8 */ 225 226 #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */ ··· 358 357 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ 359 358 #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */ 360 359 #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */ 360 + #define X86_FEATURE_FSRM (18*32+ 4) /* Fast Short Rep Mov */ 361 361 #define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */ 362 362 #define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */ 363 363 #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
+1 -7
tools/arch/x86/include/asm/disabled-features.h
··· 10 10 * cpu_feature_enabled(). 11 11 */ 12 12 13 - #ifdef CONFIG_X86_INTEL_MPX 14 - # define DISABLE_MPX 0 15 - #else 16 - # define DISABLE_MPX (1<<(X86_FEATURE_MPX & 31)) 17 - #endif 18 - 19 13 #ifdef CONFIG_X86_SMAP 20 14 # define DISABLE_SMAP 0 21 15 #else ··· 68 74 #define DISABLED_MASK6 0 69 75 #define DISABLED_MASK7 (DISABLE_PTI) 70 76 #define DISABLED_MASK8 0 71 - #define DISABLED_MASK9 (DISABLE_MPX|DISABLE_SMAP) 77 + #define DISABLED_MASK9 (DISABLE_SMAP) 72 78 #define DISABLED_MASK10 0 73 79 #define DISABLED_MASK11 0 74 80 #define DISABLED_MASK12 0
+2
tools/include/uapi/asm-generic/mman-common.h
··· 11 11 #define PROT_WRITE 0x2 /* page can be written */ 12 12 #define PROT_EXEC 0x4 /* page can be executed */ 13 13 #define PROT_SEM 0x8 /* page may be used for atomic ops */ 14 + /* 0x10 reserved for arch-specific use */ 15 + /* 0x20 reserved for arch-specific use */ 14 16 #define PROT_NONE 0x0 /* page can not be accessed */ 15 17 #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 16 18 #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
+6 -1
tools/include/uapi/asm-generic/unistd.h
··· 851 851 __SYSCALL(__NR_clone3, sys_clone3) 852 852 #endif 853 853 854 + #define __NR_openat2 437 855 + __SYSCALL(__NR_openat2, sys_openat2) 856 + #define __NR_pidfd_getfd 438 857 + __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd) 858 + 854 859 #undef __NR_syscalls 855 - #define __NR_syscalls 436 860 + #define __NR_syscalls 439 856 861 857 862 /* 858 863 * 32 bit systems traditionally used different
+32
tools/include/uapi/drm/i915_drm.h
··· 395 395 #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 396 396 #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 397 397 #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 398 + #define DRM_IOCTL_I915_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_offset) 398 399 #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 399 400 #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 400 401 #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) ··· 792 791 * This is a fixed-size type for 32/64 compatibility. 793 792 */ 794 793 __u64 offset; 794 + }; 795 + 796 + struct drm_i915_gem_mmap_offset { 797 + /** Handle for the object being mapped. */ 798 + __u32 handle; 799 + __u32 pad; 800 + /** 801 + * Fake offset to use for subsequent mmap call 802 + * 803 + * This is a fixed-size type for 32/64 compatibility. 804 + */ 805 + __u64 offset; 806 + 807 + /** 808 + * Flags for extended behaviour. 809 + * 810 + * It is mandatory that one of the MMAP_OFFSET types 811 + * (GTT, WC, WB, UC, etc) should be included. 812 + */ 813 + __u64 flags; 814 + #define I915_MMAP_OFFSET_GTT 0 815 + #define I915_MMAP_OFFSET_WC 1 816 + #define I915_MMAP_OFFSET_WB 2 817 + #define I915_MMAP_OFFSET_UC 3 818 + 819 + /* 820 + * Zero-terminated chain of extensions. 821 + * 822 + * No current extensions defined; mbz. 823 + */ 824 + __u64 extensions; 795 825 }; 796 826 797 827 struct drm_i915_gem_set_domain {
+1 -1
tools/include/uapi/linux/fcntl.h
··· 3 3 #define _UAPI_LINUX_FCNTL_H 4 4 5 5 #include <asm/fcntl.h> 6 + #include <linux/openat2.h> 6 7 7 8 #define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0) 8 9 #define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1) ··· 100 99 #define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ 101 100 102 101 #define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */ 103 - 104 102 105 103 #endif /* _UAPI_LINUX_FCNTL_H */
+13 -1
tools/include/uapi/linux/fscrypt.h
··· 8 8 #ifndef _UAPI_LINUX_FSCRYPT_H 9 9 #define _UAPI_LINUX_FSCRYPT_H 10 10 11 + #include <linux/ioctl.h> 11 12 #include <linux/types.h> 12 13 13 14 /* Encryption policy flags */ ··· 110 109 } u; 111 110 }; 112 111 112 + /* 113 + * Payload of Linux keyring key of type "fscrypt-provisioning", referenced by 114 + * fscrypt_add_key_arg::key_id as an alternative to fscrypt_add_key_arg::raw. 115 + */ 116 + struct fscrypt_provisioning_key_payload { 117 + __u32 type; 118 + __u32 __reserved; 119 + __u8 raw[]; 120 + }; 121 + 113 122 /* Struct passed to FS_IOC_ADD_ENCRYPTION_KEY */ 114 123 struct fscrypt_add_key_arg { 115 124 struct fscrypt_key_specifier key_spec; 116 125 __u32 raw_size; 117 - __u32 __reserved[9]; 126 + __u32 key_id; 127 + __u32 __reserved[8]; 118 128 __u8 raw[]; 119 129 }; 120 130
+5
tools/include/uapi/linux/kvm.h
··· 1009 1009 #define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176 1010 1010 #define KVM_CAP_ARM_NISV_TO_USER 177 1011 1011 #define KVM_CAP_ARM_INJECT_EXT_DABT 178 1012 + #define KVM_CAP_S390_VCPU_RESETS 179 1012 1013 1013 1014 #ifdef KVM_CAP_IRQ_ROUTING 1014 1015 ··· 1473 1472 1474 1473 /* Available with KVM_CAP_ARM_SVE */ 1475 1474 #define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int) 1475 + 1476 + /* Available with KVM_CAP_S390_VCPU_RESETS */ 1477 + #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3) 1478 + #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4) 1476 1479 1477 1480 /* Secure Encrypted Virtualization command */ 1478 1481 enum sev_cmd_id {
+39
tools/include/uapi/linux/openat2.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _UAPI_LINUX_OPENAT2_H 3 + #define _UAPI_LINUX_OPENAT2_H 4 + 5 + #include <linux/types.h> 6 + 7 + /* 8 + * Arguments for how openat2(2) should open the target path. If only @flags and 9 + * @mode are non-zero, then openat2(2) operates very similarly to openat(2). 10 + * 11 + * However, unlike openat(2), unknown or invalid bits in @flags result in 12 + * -EINVAL rather than being silently ignored. @mode must be zero unless one of 13 + * {O_CREAT, O_TMPFILE} are set. 14 + * 15 + * @flags: O_* flags. 16 + * @mode: O_CREAT/O_TMPFILE file mode. 17 + * @resolve: RESOLVE_* flags. 18 + */ 19 + struct open_how { 20 + __u64 flags; 21 + __u64 mode; 22 + __u64 resolve; 23 + }; 24 + 25 + /* how->resolve flags for openat2(2). */ 26 + #define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings 27 + (includes bind-mounts). */ 28 + #define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style 29 + "magic-links". */ 30 + #define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks 31 + (implies OEXT_NO_MAGICLINKS) */ 32 + #define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like 33 + "..", symlinks, and absolute 34 + paths which escape the dirfd. */ 35 + #define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." 36 + be scoped inside the dirfd 37 + (similar to chroot(2)). */ 38 + 39 + #endif /* _UAPI_LINUX_OPENAT2_H */
+4
tools/include/uapi/linux/prctl.h
··· 234 234 #define PR_GET_TAGGED_ADDR_CTRL 56 235 235 # define PR_TAGGED_ADDR_ENABLE (1UL << 0) 236 236 237 + /* Control reclaim behavior when allocating memory */ 238 + #define PR_SET_IO_FLUSHER 57 239 + #define PR_GET_IO_FLUSHER 58 240 + 237 241 #endif /* _LINUX_PRCTL_H */
+6
tools/include/uapi/linux/sched.h
··· 36 36 /* Flags for the clone3() syscall. */ 37 37 #define CLONE_CLEAR_SIGHAND 0x100000000ULL /* Clear any signal handler and reset to SIG_DFL. */ 38 38 39 + /* 40 + * cloning flags intersect with CSIGNAL so can be used with unshare and clone3 41 + * syscalls only: 42 + */ 43 + #define CLONE_NEWTIME 0x00000080 /* New time namespace */ 44 + 39 45 #ifndef __ASSEMBLY__ 40 46 /** 41 47 * struct clone_args - arguments for the clone3 syscall
+132 -23
tools/include/uapi/sound/asound.h
··· 26 26 27 27 #if defined(__KERNEL__) || defined(__linux__) 28 28 #include <linux/types.h> 29 + #include <asm/byteorder.h> 29 30 #else 31 + #include <endian.h> 30 32 #include <sys/ioctl.h> 31 33 #endif 32 34 ··· 156 154 * * 157 155 *****************************************************************************/ 158 156 159 - #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14) 157 + #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15) 160 158 161 159 typedef unsigned long snd_pcm_uframes_t; 162 160 typedef signed long snd_pcm_sframes_t; ··· 303 301 #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */ 304 302 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ 305 303 306 - 304 + #if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__ 305 + #define __SND_STRUCT_TIME64 306 + #endif 307 307 308 308 typedef int __bitwise snd_pcm_state_t; 309 309 #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ ··· 321 317 322 318 enum { 323 319 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 324 - SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, 325 - SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 320 + SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000, 321 + SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000, 322 + SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000, 323 + SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000, 324 + #ifdef __SND_STRUCT_TIME64 325 + SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW, 326 + SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW, 327 + #else 328 + SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD, 329 + SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD, 330 + #endif 326 331 }; 327 332 328 333 union snd_pcm_sync_id { ··· 469 456 SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED 470 457 }; 471 458 459 + #ifndef __KERNEL__ 460 + /* explicit padding avoids incompatibility between i386 and x86-64 */ 461 + typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad; 462 + 472 463 struct snd_pcm_status { 473 464 snd_pcm_state_t state; /* stream state */ 465 + __time_pad pad1; /* align to timespec */ 474 466 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 475 467 struct timespec tstamp; /* reference timestamp */ 476 468 snd_pcm_uframes_t appl_ptr; /* appl ptr */ ··· 491 473 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ 492 474 unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ 493 475 }; 476 + #endif 494 477 495 - struct snd_pcm_mmap_status { 478 + /* 479 + * For mmap operations, we need the 64-bit layout, both for compat mode, 480 + * and for y2038 compatibility. For 64-bit applications, the two definitions 481 + * are identical, so we keep the traditional version. 482 + */ 483 + #ifdef __SND_STRUCT_TIME64 484 + #define __snd_pcm_mmap_status64 snd_pcm_mmap_status 485 + #define __snd_pcm_mmap_control64 snd_pcm_mmap_control 486 + #define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr 487 + #ifdef __KERNEL__ 488 + #define __snd_timespec64 __kernel_timespec 489 + #else 490 + #define __snd_timespec64 timespec 491 + #endif 492 + struct __snd_timespec { 493 + __s32 tv_sec; 494 + __s32 tv_nsec; 495 + }; 496 + #else 497 + #define __snd_pcm_mmap_status snd_pcm_mmap_status 498 + #define __snd_pcm_mmap_control snd_pcm_mmap_control 499 + #define __snd_pcm_sync_ptr snd_pcm_sync_ptr 500 + #define __snd_timespec timespec 501 + struct __snd_timespec64 { 502 + __s64 tv_sec; 503 + __s64 tv_nsec; 504 + }; 505 + 506 + #endif 507 + 508 + struct __snd_pcm_mmap_status { 496 509 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 497 510 int pad1; /* Needed for 64 bit alignment */ 498 511 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 499 - struct timespec tstamp; /* Timestamp */ 512 + struct __snd_timespec tstamp; /* Timestamp */ 500 513 snd_pcm_state_t suspended_state; /* RO: suspended stream state */ 501 - struct timespec audio_tstamp; /* from sample counter or wall clock */ 514 + struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */ 502 515 }; 503 516 504 - struct snd_pcm_mmap_control { 517 + struct __snd_pcm_mmap_control { 505 518 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 506 519 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 507 520 }; ··· 541 492 #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 542 493 #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 543 494 544 - struct snd_pcm_sync_ptr { 495 + struct __snd_pcm_sync_ptr { 545 496 unsigned int flags; 546 497 union { 547 - struct snd_pcm_mmap_status status; 498 + struct __snd_pcm_mmap_status status; 548 499 unsigned char reserved[64]; 549 500 } s; 550 501 union { 551 - struct snd_pcm_mmap_control control; 502 + struct __snd_pcm_mmap_control control; 503 + unsigned char reserved[64]; 504 + } c; 505 + }; 506 + 507 + #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) 508 + typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)]; 509 + typedef char __pad_after_uframe[0]; 510 + #endif 511 + 512 + #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) 513 + typedef char __pad_before_uframe[0]; 514 + typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)]; 515 + #endif 516 + 517 + struct __snd_pcm_mmap_status64 { 518 + snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 519 + __u32 pad1; /* Needed for 64 bit alignment */ 520 + __pad_before_uframe __pad1; 521 + snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 522 + __pad_after_uframe __pad2; 523 + struct __snd_timespec64 tstamp; /* Timestamp */ 524 + snd_pcm_state_t suspended_state;/* RO: suspended stream state */ 525 + __u32 pad3; /* Needed for 64 bit alignment */ 526 + struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */ 527 + }; 528 + 529 + struct __snd_pcm_mmap_control64 { 530 + __pad_before_uframe __pad1; 531 + snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 532 + __pad_before_uframe __pad2; 533 + 534 + __pad_before_uframe __pad3; 535 + snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 536 + __pad_after_uframe __pad4; 537 + }; 538 + 539 + struct __snd_pcm_sync_ptr64 { 540 + __u32 flags; 541 + __u32 pad1; 542 + union { 543 + struct __snd_pcm_mmap_status64 status; 544 + unsigned char reserved[64]; 545 + } s; 546 + union { 547 + struct __snd_pcm_mmap_control64 control; 552 548 unsigned char reserved[64]; 553 549 } c; 554 550 }; ··· 678 584 #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) 679 585 #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) 680 586 #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) 587 + #define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr) 588 + #define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64) 681 589 #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) 682 590 #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status) 683 591 #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) ··· 710 614 * Raw MIDI section - /dev/snd/midi?? 711 615 */ 712 616 713 - #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 617 + #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) 714 618 715 619 enum { 716 620 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, ··· 744 648 unsigned char reserved[16]; /* reserved for future use */ 745 649 }; 746 650 651 + #ifndef __KERNEL__ 747 652 struct snd_rawmidi_status { 748 653 int stream; 654 + __time_pad pad1; 749 655 struct timespec tstamp; /* Timestamp */ 750 656 size_t avail; /* available bytes */ 751 657 size_t xruns; /* count of overruns since last status (in bytes) */ 752 658 unsigned char reserved[16]; /* reserved for future use */ 753 659 }; 660 + #endif 754 661 755 662 #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) 756 663 #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) ··· 766 667 * Timer section - /dev/snd/timer 767 668 */ 768 669 769 - #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) 670 + #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 770 671 771 672 enum { 772 673 SNDRV_TIMER_CLASS_NONE = -1, ··· 860 761 unsigned char reserved[60]; /* reserved */ 861 762 }; 862 763 764 + #ifndef __KERNEL__ 863 765 struct snd_timer_status { 864 766 struct timespec tstamp; /* Timestamp - last update */ 865 767 unsigned int resolution; /* current period resolution in ns */ ··· 869 769 unsigned int queue; /* used queue size */ 870 770 unsigned char reserved[64]; /* reserved */ 871 771 }; 772 + #endif 872 773 873 774 #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) 874 775 #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) 875 - #define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) 776 + #define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int) 876 777 #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) 877 778 #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) 878 779 #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) ··· 886 785 #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) 887 786 #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) 888 787 #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) 788 + #define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int) 789 + 790 + #if __BITS_PER_LONG == 64 791 + #define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD 792 + #else 793 + #define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \ 794 + SNDRV_TIMER_IOCTL_TREAD_OLD : \ 795 + SNDRV_TIMER_IOCTL_TREAD64) 796 + #endif 889 797 890 798 struct snd_timer_read { 891 799 unsigned int resolution; ··· 920 810 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 921 811 }; 922 812 813 + #ifndef __KERNEL__ 923 814 struct snd_timer_tread { 924 815 int event; 816 + __time_pad pad1; 925 817 struct timespec tstamp; 926 818 unsigned int val; 819 + __time_pad pad2; 927 820 }; 821 + #endif 928 822 929 823 /**************************************************************************** 930 824 * * ··· 936 822 * * 937 823 ****************************************************************************/ 938 824 939 - #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7) 825 + #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8) 940 826 941 827 struct snd_ctl_card_info { 942 828 int card; /* card number */ ··· 974 860 #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 975 861 #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) 976 862 #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ 977 - #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ 863 + // (1 << 3) is unused. 978 864 #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ 979 865 #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ 980 866 #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) ··· 1040 926 } enumerated; 1041 927 unsigned char reserved[128]; 1042 928 } value; 1043 - union { 1044 - unsigned short d[4]; /* dimensions */ 1045 - unsigned short *d_ptr; /* indirect - obsoleted */ 1046 - } dimen; 1047 - unsigned char reserved[64-4*sizeof(unsigned short)]; 929 + unsigned char reserved[64]; 1048 930 }; 1049 931 1050 932 struct snd_ctl_elem_value { ··· 1065 955 } bytes; 1066 956 struct snd_aes_iec958 iec958; 1067 957 } value; /* RO */ 1068 - struct timespec tstamp; 1069 - unsigned char reserved[128-sizeof(struct timespec)]; 958 + unsigned char reserved[128]; 1070 959 }; 1071 960 1072 961 struct snd_ctl_tlv {
+48 -15
tools/perf/arch/arm64/util/header.c
··· 1 1 #include <stdio.h> 2 2 #include <stdlib.h> 3 3 #include <perf/cpumap.h> 4 + #include <util/cpumap.h> 4 5 #include <internal/cpumap.h> 5 6 #include <api/fs/fs.h> 7 + #include <errno.h> 6 8 #include "debug.h" 7 9 #include "header.h" 8 10 ··· 14 12 #define MIDR_VARIANT_SHIFT 20 15 13 #define MIDR_VARIANT_MASK (0xf << MIDR_VARIANT_SHIFT) 16 14 17 - char *get_cpuid_str(struct perf_pmu *pmu) 15 + static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus) 18 16 { 19 - char *buf = NULL; 20 - char path[PATH_MAX]; 21 17 const char *sysfs = sysfs__mountpoint(); 22 - int cpu; 23 18 u64 midr = 0; 24 - struct perf_cpu_map *cpus; 25 - FILE *file; 19 + int cpu; 26 20 27 - if (!sysfs || !pmu || !pmu->cpus) 28 - return NULL; 21 + if (!sysfs || sz < MIDR_SIZE) 22 + return EINVAL; 29 23 30 - buf = malloc(MIDR_SIZE); 31 - if (!buf) 32 - return NULL; 24 + cpus = perf_cpu_map__get(cpus); 33 25 34 - /* read midr from list of cpus mapped to this pmu */ 35 - cpus = perf_cpu_map__get(pmu->cpus); 36 26 for (cpu = 0; cpu < perf_cpu_map__nr(cpus); cpu++) { 27 + char path[PATH_MAX]; 28 + FILE *file; 29 + 37 30 scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR, 38 31 sysfs, cpus->map[cpu]); 39 32 ··· 54 57 break; 55 58 } 56 59 57 - if (!midr) { 60 + perf_cpu_map__put(cpus); 61 + 62 + if (!midr) 63 + return EINVAL; 64 + 65 + return 0; 66 + } 67 + 68 + int get_cpuid(char *buf, size_t sz) 69 + { 70 + struct perf_cpu_map *cpus = perf_cpu_map__new(NULL); 71 + int ret; 72 + 73 + if (!cpus) 74 + return EINVAL; 75 + 76 + ret = _get_cpuid(buf, sz, cpus); 77 + 78 + perf_cpu_map__put(cpus); 79 + 80 + return ret; 81 + } 82 + 83 + char *get_cpuid_str(struct perf_pmu *pmu) 84 + { 85 + char *buf = NULL; 86 + int res; 87 + 88 + if (!pmu || !pmu->cpus) 89 + return NULL; 90 + 91 + buf = malloc(MIDR_SIZE); 92 + if (!buf) 93 + return NULL; 94 + 95 + /* read midr from list of cpus mapped to this pmu */ 96 + res = _get_cpuid(buf, MIDR_SIZE, pmu->cpus); 97 + if (res) { 58 98 pr_err("failed to get cpuid string for PMU %s\n", pmu->name); 59 99 free(buf); 60 100 buf = NULL; 61 101 } 62 102 63 - perf_cpu_map__put(cpus); 64 103 return buf; 65 104 }
+2
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
··· 357 357 433 common fspick __x64_sys_fspick 358 358 434 common pidfd_open __x64_sys_pidfd_open 359 359 435 common clone3 __x64_sys_clone3/ptregs 360 + 437 common openat2 __x64_sys_openat2 361 + 438 common pidfd_getfd __x64_sys_pidfd_getfd 360 362 361 363 # 362 364 # x32-specific system call numbers start at 512 to avoid cache impact
+3 -1
tools/perf/builtin-trace.c
··· 1065 1065 { .name = "poll", .timeout = true, }, 1066 1066 { .name = "ppoll", .timeout = true, }, 1067 1067 { .name = "prctl", 1068 - .arg = { [0] = { .scnprintf = SCA_PRCTL_OPTION, /* option */ }, 1068 + .arg = { [0] = { .scnprintf = SCA_PRCTL_OPTION, /* option */ 1069 + .strtoul = STUL_STRARRAY, 1070 + .parm = &strarray__prctl_options, }, 1069 1071 [1] = { .scnprintf = SCA_PRCTL_ARG2, /* arg2 */ }, 1070 1072 [2] = { .scnprintf = SCA_PRCTL_ARG3, /* arg3 */ }, }, }, 1071 1073 { .name = "pread", .alias = "pread64", },
+1
tools/perf/check-headers.sh
··· 13 13 include/uapi/linux/kvm.h 14 14 include/uapi/linux/in.h 15 15 include/uapi/linux/mount.h 16 + include/uapi/linux/openat2.h 16 17 include/uapi/linux/perf_event.h 17 18 include/uapi/linux/prctl.h 18 19 include/uapi/linux/sched.h
+2
tools/perf/trace/beauty/beauty.h
··· 213 213 size_t syscall_arg__scnprintf_prctl_option(char *bf, size_t size, struct syscall_arg *arg); 214 214 #define SCA_PRCTL_OPTION syscall_arg__scnprintf_prctl_option 215 215 216 + extern struct strarray strarray__prctl_options; 217 + 216 218 size_t syscall_arg__scnprintf_prctl_arg2(char *bf, size_t size, struct syscall_arg *arg); 217 219 #define SCA_PRCTL_ARG2 syscall_arg__scnprintf_prctl_arg2 218 220
+2 -1
tools/perf/trace/beauty/prctl.c
··· 11 11 12 12 #include "trace/beauty/generated/prctl_option_array.c" 13 13 14 + DEFINE_STRARRAY(prctl_options, "PR_"); 15 + 14 16 static size_t prctl__scnprintf_option(int option, char *bf, size_t size, bool show_prefix) 15 17 { 16 - static DEFINE_STRARRAY(prctl_options, "PR_"); 17 18 return strarray__scnprintf(&strarray__prctl_options, bf, size, "%d", show_prefix, option); 18 19 } 19 20
+1
tools/perf/util/llvm-utils.c
··· 288 288 "obj-y := dummy.o\n" 289 289 "\\$(obj)/%.o: \\$(src)/%.c\n" 290 290 "\t@echo -n \"\\$(NOSTDINC_FLAGS) \\$(LINUXINCLUDE) \\$(EXTRA_CFLAGS)\"\n" 291 + "\t\\$(CC) -c -o \\$@ \\$<\n" 291 292 "EOF\n" 292 293 "touch $TMPDIR/dummy.c\n" 293 294 "make -s -C $KBUILD_DIR M=$TMPDIR $KBUILD_OPTS dummy.o 2>/dev/null\n"
+12 -14
tools/perf/util/machine.c
··· 686 686 687 687 dso__set_module_info(dso, m, machine); 688 688 dso__set_long_name(dso, strdup(filename), true); 689 + dso->kernel = DSO_TYPE_KERNEL; 689 690 } 690 691 691 692 dso__get(dso); ··· 727 726 struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr); 728 727 729 728 if (!map) { 730 - map = dso__new_map(event->ksymbol.name); 731 - if (!map) 729 + struct dso *dso = dso__new(event->ksymbol.name); 730 + 731 + if (dso) { 732 + dso->kernel = DSO_TYPE_KERNEL; 733 + map = map__new2(0, dso); 734 + } 735 + 736 + if (!dso || !map) { 737 + dso__put(dso); 732 738 return -ENOMEM; 739 + } 733 740 734 741 map->start = event->ksymbol.addr; 735 742 map->end = map->start + event->ksymbol.len; ··· 981 972 982 973 kmap = map__kmap(map); 983 974 984 - kmap->kmaps = &machine->kmaps; 985 975 strlcpy(kmap->name, xm->name, KMAP_NAME_LEN); 986 976 987 977 maps__insert(&machine->kmaps, map); ··· 1090 1082 static int 1091 1083 __machine__create_kernel_maps(struct machine *machine, struct dso *kernel) 1092 1084 { 1093 - struct kmap *kmap; 1094 - struct map *map; 1095 - 1096 1085 /* In case of renewal the kernel map, destroy previous one */ 1097 1086 machine__destroy_kernel_maps(machine); 1098 1087 ··· 1098 1093 return -1; 1099 1094 1100 1095 machine->vmlinux_map->map_ip = machine->vmlinux_map->unmap_ip = identity__map_ip; 1101 - map = machine__kernel_map(machine); 1102 - kmap = map__kmap(map); 1103 - if (!kmap) 1104 - return -1; 1105 - 1106 - kmap->kmaps = &machine->kmaps; 1107 - maps__insert(&machine->kmaps, map); 1108 - 1096 + maps__insert(&machine->kmaps, machine->vmlinux_map); 1109 1097 return 0; 1110 1098 } 1111 1099
+16 -1
tools/perf/util/map.c
··· 375 375 376 376 struct map *map__clone(struct map *from) 377 377 { 378 - struct map *map = memdup(from, sizeof(*map)); 378 + size_t size = sizeof(struct map); 379 + struct map *map; 379 380 381 + if (from->dso && from->dso->kernel) 382 + size += sizeof(struct kmap); 383 + 384 + map = memdup(from, size); 380 385 if (map != NULL) { 381 386 refcount_set(&map->refcnt, 1); 382 387 RB_CLEAR_NODE(&map->rb_node); ··· 542 537 down_write(&maps->lock); 543 538 __maps__insert(maps, map); 544 539 ++maps->nr_maps; 540 + 541 + if (map->dso && map->dso->kernel) { 542 + struct kmap *kmap = map__kmap(map); 543 + 544 + if (kmap) 545 + kmap->kmaps = maps; 546 + else 547 + pr_err("Internal error: kernel dso with non kernel map\n"); 548 + } 549 + 545 550 546 551 /* 547 552 * If we already performed some search by name, then we need to add the just
-6
tools/perf/util/stat-shadow.c
··· 18 18 * AGGR_NONE: Use matching CPU 19 19 * AGGR_THREAD: Not supported? 20 20 */ 21 - static bool have_frontend_stalled; 22 21 23 22 struct runtime_stat rt_stat; 24 23 struct stats walltime_nsecs_stats; ··· 143 144 144 145 void perf_stat__init_shadow_stats(void) 145 146 { 146 - have_frontend_stalled = pmu_have_event("cpu", "stalled-cycles-frontend"); 147 147 runtime_stat__init(&rt_stat); 148 148 } 149 149 ··· 851 853 print_metric(config, ctxp, NULL, "%7.2f ", 852 854 "stalled cycles per insn", 853 855 ratio); 854 - } else if (have_frontend_stalled) { 855 - out->new_line(config, ctxp); 856 - print_metric(config, ctxp, NULL, "%7.2f ", 857 - "stalled cycles per insn", 0); 858 856 } 859 857 } else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) { 860 858 if (runtime_stat_n(st, STAT_BRANCHES, ctx, cpu) != 0)
+12 -5
tools/perf/util/symbol.c
··· 635 635 static bool symbol__is_idle(const char *name) 636 636 { 637 637 const char * const idle_symbols[] = { 638 + "acpi_idle_do_entry", 639 + "acpi_processor_ffh_cstate_enter", 638 640 "arch_cpu_idle", 639 641 "cpu_idle", 640 642 "cpu_startup_entry", 643 + "idle_cpu", 641 644 "intel_idle", 642 645 "default_idle", 643 646 "native_safe_halt", ··· 654 651 NULL 655 652 }; 656 653 int i; 654 + static struct strlist *idle_symbols_list; 657 655 658 - for (i = 0; idle_symbols[i]; i++) { 659 - if (!strcmp(idle_symbols[i], name)) 660 - return true; 661 - } 656 + if (idle_symbols_list) 657 + return strlist__has_entry(idle_symbols_list, name); 662 658 663 - return false; 659 + idle_symbols_list = strlist__new(NULL, NULL); 660 + 661 + for (i = 0; idle_symbols[i]; i++) 662 + strlist__add(idle_symbols_list, idle_symbols[i]); 663 + 664 + return strlist__has_entry(idle_symbols_list, name); 664 665 } 665 666 666 667 static int map__process_kallsym_symbol(void *arg, const char *name,