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 Thomas Gleixner:
"A set of perf fixes:

kernel:

- Unbreak the tracking of auxiliary buffer allocations which got
imbalanced causing recource limit failures.

- Fix the fallout of splitting of ToPA entries which missed to shift
the base entry PA correctly.

- Use the correct context to lookup the AUX event when unmapping the
associated AUX buffer so the event can be stopped and the buffer
reference dropped.

tools:

- Fix buildiid-cache mode setting in copyfile_mode_ns() when copying
/proc/kcore

- Fix freeing id arrays in the event list so the correct event is
closed.

- Sync sched.h anc kvm.h headers with the kernel sources.

- Link jvmti against tools/lib/ctype.o to have weak strlcpy().

- Fix multiple memory and file descriptor leaks, found by coverity in
perf annotate.

- Fix leaks in error handling paths in 'perf c2c', 'perf kmem', found
by a static analysis tool"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/aux: Fix AUX output stopping
perf/aux: Fix tracking of auxiliary trace buffer allocation
perf/x86/intel/pt: Fix base for single entry topa
perf kmem: Fix memory leak in compact_gfp_flags()
tools headers UAPI: Sync sched.h with the kernel
tools headers kvm: Sync kvm.h headers with the kernel sources
tools headers kvm: Sync kvm headers with the kernel sources
tools headers kvm: Sync kvm headers with the kernel sources
perf c2c: Fix memory leak in build_cl_output()
perf tools: Fix mode setting in copyfile_mode_ns()
perf annotate: Fix multiple memory and file descriptor leaks
perf tools: Fix resource leak of closedir() on the error paths
perf evlist: Fix fix for freed id arrays
perf jvmti: Link against tools/lib/ctype.h to have weak strlcpy()

+71 -21
+1 -1
arch/x86/events/intel/pt.c
··· 627 627 * link as the 2nd entry in the table 628 628 */ 629 629 if (!intel_pt_validate_hw_cap(PT_CAP_topa_multiple_entries)) { 630 - TOPA_ENTRY(&tp->topa, 1)->base = page_to_phys(p); 630 + TOPA_ENTRY(&tp->topa, 1)->base = page_to_phys(p) >> TOPA_SHIFT; 631 631 TOPA_ENTRY(&tp->topa, 1)->end = 1; 632 632 } 633 633
+5 -3
kernel/events/core.c
··· 5607 5607 perf_pmu_output_stop(event); 5608 5608 5609 5609 /* now it's safe to free the pages */ 5610 - atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm); 5611 - atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); 5610 + if (!rb->aux_mmap_locked) 5611 + atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm); 5612 + else 5613 + atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm); 5612 5614 5613 5615 /* this has to be the last one */ 5614 5616 rb_free_aux(rb); ··· 6949 6947 static int __perf_pmu_output_stop(void *info) 6950 6948 { 6951 6949 struct perf_event *event = info; 6952 - struct pmu *pmu = event->pmu; 6950 + struct pmu *pmu = event->ctx->pmu; 6953 6951 struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); 6954 6952 struct remote_output ro = { 6955 6953 .rb = event->rb,
+1
tools/arch/x86/include/uapi/asm/svm.h
··· 75 75 #define SVM_EXIT_MWAIT 0x08b 76 76 #define SVM_EXIT_MWAIT_COND 0x08c 77 77 #define SVM_EXIT_XSETBV 0x08d 78 + #define SVM_EXIT_RDPRU 0x08e 78 79 #define SVM_EXIT_NPF 0x400 79 80 #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 80 81 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402
+5 -1
tools/arch/x86/include/uapi/asm/vmx.h
··· 86 86 #define EXIT_REASON_PML_FULL 62 87 87 #define EXIT_REASON_XSAVES 63 88 88 #define EXIT_REASON_XRSTORS 64 89 + #define EXIT_REASON_UMWAIT 67 90 + #define EXIT_REASON_TPAUSE 68 89 91 90 92 #define VMX_EXIT_REASONS \ 91 93 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ ··· 146 144 { EXIT_REASON_RDSEED, "RDSEED" }, \ 147 145 { EXIT_REASON_PML_FULL, "PML_FULL" }, \ 148 146 { EXIT_REASON_XSAVES, "XSAVES" }, \ 149 - { EXIT_REASON_XRSTORS, "XRSTORS" } 147 + { EXIT_REASON_XRSTORS, "XRSTORS" }, \ 148 + { EXIT_REASON_UMWAIT, "UMWAIT" }, \ 149 + { EXIT_REASON_TPAUSE, "TPAUSE" } 150 150 151 151 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1 152 152 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
+2
tools/include/uapi/linux/kvm.h
··· 999 999 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 1000 1000 #define KVM_CAP_PMU_EVENT_FILTER 173 1001 1001 #define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174 1002 + #define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175 1002 1003 1003 1004 #ifdef KVM_CAP_IRQ_ROUTING 1004 1005 ··· 1146 1145 #define KVM_REG_S390 0x5000000000000000ULL 1147 1146 #define KVM_REG_ARM64 0x6000000000000000ULL 1148 1147 #define KVM_REG_MIPS 0x7000000000000000ULL 1148 + #define KVM_REG_RISCV 0x8000000000000000ULL 1149 1149 1150 1150 #define KVM_REG_SIZE_SHIFT 52 1151 1151 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL
+28 -2
tools/include/uapi/linux/sched.h
··· 33 33 #define CLONE_NEWNET 0x40000000 /* New network namespace */ 34 34 #define CLONE_IO 0x80000000 /* Clone io context */ 35 35 36 - /* 37 - * Arguments for the clone3 syscall 36 + #ifndef __ASSEMBLY__ 37 + /** 38 + * struct clone_args - arguments for the clone3 syscall 39 + * @flags: Flags for the new process as listed above. 40 + * All flags are valid except for CSIGNAL and 41 + * CLONE_DETACHED. 42 + * @pidfd: If CLONE_PIDFD is set, a pidfd will be 43 + * returned in this argument. 44 + * @child_tid: If CLONE_CHILD_SETTID is set, the TID of the 45 + * child process will be returned in the child's 46 + * memory. 47 + * @parent_tid: If CLONE_PARENT_SETTID is set, the TID of 48 + * the child process will be returned in the 49 + * parent's memory. 50 + * @exit_signal: The exit_signal the parent process will be 51 + * sent when the child exits. 52 + * @stack: Specify the location of the stack for the 53 + * child process. 54 + * @stack_size: The size of the stack for the child process. 55 + * @tls: If CLONE_SETTLS is set, the tls descriptor 56 + * is set to tls. 57 + * 58 + * The structure is versioned by size and thus extensible. 59 + * New struct members must go at the end of the struct and 60 + * must be properly 64bit aligned. 38 61 */ 39 62 struct clone_args { 40 63 __aligned_u64 flags; ··· 69 46 __aligned_u64 stack_size; 70 47 __aligned_u64 tls; 71 48 }; 49 + #endif 50 + 51 + #define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */ 72 52 73 53 /* 74 54 * Scheduling policies
+9 -5
tools/perf/builtin-c2c.c
··· 2635 2635 bool add_sym = false; 2636 2636 bool add_dso = false; 2637 2637 bool add_src = false; 2638 + int ret = 0; 2638 2639 2639 2640 if (!buf) 2640 2641 return -ENOMEM; ··· 2654 2653 add_dso = true; 2655 2654 } else if (strcmp(tok, "offset")) { 2656 2655 pr_err("unrecognized sort token: %s\n", tok); 2657 - return -EINVAL; 2656 + ret = -EINVAL; 2657 + goto err; 2658 2658 } 2659 2659 } 2660 2660 ··· 2678 2676 add_sym ? "symbol," : "", 2679 2677 add_dso ? "dso," : "", 2680 2678 add_src ? "cl_srcline," : "", 2681 - "node") < 0) 2682 - return -ENOMEM; 2679 + "node") < 0) { 2680 + ret = -ENOMEM; 2681 + goto err; 2682 + } 2683 2683 2684 2684 c2c.show_src = add_src; 2685 - 2685 + err: 2686 2686 free(buf); 2687 - return 0; 2687 + return ret; 2688 2688 } 2689 2689 2690 2690 static int setup_coalesce(const char *coalesce, bool no_source)
+1
tools/perf/builtin-kmem.c
··· 691 691 new = realloc(new_flags, len + strlen(cpt) + 2); 692 692 if (new == NULL) { 693 693 free(new_flags); 694 + free(orig_flags); 694 695 return NULL; 695 696 } 696 697
+5 -1
tools/perf/jvmti/Build
··· 2 2 jvmti-y += jvmti_agent.o 3 3 4 4 # For strlcpy 5 - jvmti-y += libstring.o 5 + jvmti-y += libstring.o libctype.o 6 6 7 7 CFLAGS_jvmti = -fPIC -DPIC -I$(JDIR)/include -I$(JDIR)/include/linux 8 8 CFLAGS_REMOVE_jvmti = -Wmissing-declarations ··· 13 13 CFLAGS_libstring.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))" 14 14 15 15 $(OUTPUT)jvmti/libstring.o: ../lib/string.c FORCE 16 + $(call rule_mkdir) 17 + $(call if_changed_dep,cc_o_c) 18 + 19 + $(OUTPUT)jvmti/libctype.o: ../lib/ctype.c FORCE 16 20 $(call rule_mkdir) 17 21 $(call if_changed_dep,cc_o_c)
+1 -1
tools/perf/util/annotate.c
··· 1758 1758 info_node = perf_env__find_bpf_prog_info(dso->bpf_prog.env, 1759 1759 dso->bpf_prog.id); 1760 1760 if (!info_node) { 1761 - return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF; 1761 + ret = SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF; 1762 1762 goto out; 1763 1763 } 1764 1764 info_linear = info_node->info_linear;
+5 -3
tools/perf/util/copyfile.c
··· 101 101 if (tofd < 0) 102 102 goto out; 103 103 104 - if (fchmod(tofd, mode)) 105 - goto out_close_to; 106 - 107 104 if (st.st_size == 0) { /* /proc? do it slowly... */ 108 105 err = slow_copyfile(from, tmp, nsi); 106 + if (!err && fchmod(tofd, mode)) 107 + err = -1; 109 108 goto out_close_to; 110 109 } 110 + 111 + if (fchmod(tofd, mode)) 112 + goto out_close_to; 111 113 112 114 nsinfo__mountns_enter(nsi, &nsc); 113 115 fromfd = open(from, O_RDONLY);
+1 -1
tools/perf/util/evlist.c
··· 1659 1659 is_open = false; 1660 1660 if (c2->leader == leader) { 1661 1661 if (is_open) 1662 - perf_evsel__close(&evsel->core); 1662 + perf_evsel__close(&c2->core); 1663 1663 c2->leader = c2; 1664 1664 c2->core.nr_members = 0; 1665 1665 }
+3 -1
tools/perf/util/header.c
··· 1296 1296 continue; 1297 1297 1298 1298 if (WARN_ONCE(cnt >= size, 1299 - "failed to write MEM_TOPOLOGY, way too many nodes\n")) 1299 + "failed to write MEM_TOPOLOGY, way too many nodes\n")) { 1300 + closedir(dir); 1300 1301 return -1; 1302 + } 1301 1303 1302 1304 ret = memory_node__read(&nodes[cnt++], idx); 1303 1305 }
+4 -2
tools/perf/util/util.c
··· 154 154 if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) 155 155 continue; 156 156 157 - if (!match_pat(d->d_name, pat)) 158 - return -2; 157 + if (!match_pat(d->d_name, pat)) { 158 + ret = -2; 159 + break; 160 + } 159 161 160 162 scnprintf(namebuf, sizeof(namebuf), "%s/%s", 161 163 path, d->d_name);