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 tag 'perf-tools-fixes-for-v5.13-2021-06-04' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

- Fix NULL pointer dereference in 'perf probe' when handling
DW_AT_const_value when looking for a variable, which is valid.

- Fix for capability querying of perf_event_attr.cgroup support in
older kernels.

- Add missing cloning of evsel->use_config_name.

- Honor event config name on --no-merge in 'perf stat'.

- Fix some memory leaks found using ASAN.

- Fix the perf entry for perf_event_attr setup with make LIBPFM4=1 on
s390 z/VM.

- Update MIPS UAPI perf_regs.h file.

- Fix 'perf stat' BPF counter load return check.

* tag 'perf-tools-fixes-for-v5.13-2021-06-04' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
perf env: Fix memory leak of bpf_prog_info_linear member
perf symbol-elf: Fix memory leak by freeing sdt_note.args
perf stat: Honor event config name on --no-merge
perf evsel: Add missing cloning of evsel->use_config_name
perf test: Test 17 fails with make LIBPFM4=1 on s390 z/VM
perf stat: Fix error return code in bperf__load()
perf record: Move probing cgroup sampling support
perf probe: Fix NULL pointer dereference in convert_variable_location()
perf tools: Copy uapi/asm/perf_regs.h from the kernel for MIPS

+80 -13
+40
tools/arch/mips/include/uapi/asm/perf_regs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 + #ifndef _ASM_MIPS_PERF_REGS_H 3 + #define _ASM_MIPS_PERF_REGS_H 4 + 5 + enum perf_event_mips_regs { 6 + PERF_REG_MIPS_PC, 7 + PERF_REG_MIPS_R1, 8 + PERF_REG_MIPS_R2, 9 + PERF_REG_MIPS_R3, 10 + PERF_REG_MIPS_R4, 11 + PERF_REG_MIPS_R5, 12 + PERF_REG_MIPS_R6, 13 + PERF_REG_MIPS_R7, 14 + PERF_REG_MIPS_R8, 15 + PERF_REG_MIPS_R9, 16 + PERF_REG_MIPS_R10, 17 + PERF_REG_MIPS_R11, 18 + PERF_REG_MIPS_R12, 19 + PERF_REG_MIPS_R13, 20 + PERF_REG_MIPS_R14, 21 + PERF_REG_MIPS_R15, 22 + PERF_REG_MIPS_R16, 23 + PERF_REG_MIPS_R17, 24 + PERF_REG_MIPS_R18, 25 + PERF_REG_MIPS_R19, 26 + PERF_REG_MIPS_R20, 27 + PERF_REG_MIPS_R21, 28 + PERF_REG_MIPS_R22, 29 + PERF_REG_MIPS_R23, 30 + PERF_REG_MIPS_R24, 31 + PERF_REG_MIPS_R25, 32 + PERF_REG_MIPS_R26, 33 + PERF_REG_MIPS_R27, 34 + PERF_REG_MIPS_R28, 35 + PERF_REG_MIPS_R29, 36 + PERF_REG_MIPS_R30, 37 + PERF_REG_MIPS_R31, 38 + PERF_REG_MIPS_MAX = PERF_REG_MIPS_R31 + 1, 39 + }; 40 + #endif /* _ASM_MIPS_PERF_REGS_H */
-1
tools/perf/Makefile.config
··· 90 90 ifeq ($(ARCH),mips) 91 91 NO_PERF_REGS := 0 92 92 CFLAGS += -I$(OUTPUT)arch/mips/include/generated 93 - CFLAGS += -I../../arch/mips/include/uapi -I../../arch/mips/include/generated/uapi 94 93 LIBUNWIND_LIBS = -lunwind -lunwind-mips 95 94 endif 96 95
+6
tools/perf/builtin-record.c
··· 2714 2714 rec->no_buildid = true; 2715 2715 } 2716 2716 2717 + if (rec->opts.record_cgroup && !perf_can_record_cgroup()) { 2718 + pr_err("Kernel has no cgroup sampling support.\n"); 2719 + err = -EINVAL; 2720 + goto out_opts; 2721 + } 2722 + 2717 2723 if (rec->opts.kcore) 2718 2724 rec->data.is_dir = true; 2719 2725
+1
tools/perf/check-headers.sh
··· 39 39 arch/x86/tools/gen-insn-attr-x86.awk 40 40 arch/arm/include/uapi/asm/perf_regs.h 41 41 arch/arm64/include/uapi/asm/perf_regs.h 42 + arch/mips/include/uapi/asm/perf_regs.h 42 43 arch/powerpc/include/uapi/asm/perf_regs.h 43 44 arch/s390/include/uapi/asm/perf_regs.h 44 45 arch/x86/include/uapi/asm/perf_regs.h
+1 -1
tools/perf/tests/attr/base-record
··· 16 16 exclusive=0 17 17 exclude_user=0 18 18 exclude_kernel=0|1 19 - exclude_hv=0 19 + exclude_hv=0|1 20 20 exclude_idle=0 21 21 mmap=1 22 22 comm=1
+4 -2
tools/perf/util/bpf_counter.c
··· 521 521 522 522 evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id); 523 523 if (evsel->bperf_leader_link_fd < 0 && 524 - bperf_reload_leader_program(evsel, attr_map_fd, &entry)) 524 + bperf_reload_leader_program(evsel, attr_map_fd, &entry)) { 525 + err = -1; 525 526 goto out; 526 - 527 + } 527 528 /* 528 529 * The bpf_link holds reference to the leader program, and the 529 530 * leader program holds reference to the maps. Therefore, if ··· 551 550 /* Step 2: load the follower skeleton */ 552 551 evsel->follower_skel = bperf_follower_bpf__open(); 553 552 if (!evsel->follower_skel) { 553 + err = -1; 554 554 pr_err("Failed to open follower skeleton\n"); 555 555 goto out; 556 556 }
+6 -2
tools/perf/util/dwarf-aux.c
··· 975 975 if ((tag == DW_TAG_formal_parameter || 976 976 tag == DW_TAG_variable) && 977 977 die_compare_name(die_mem, fvp->name) && 978 - /* Does the DIE have location information or external instance? */ 978 + /* 979 + * Does the DIE have location information or const value 980 + * or external instance? 981 + */ 979 982 (dwarf_attr(die_mem, DW_AT_external, &attr) || 980 - dwarf_attr(die_mem, DW_AT_location, &attr))) 983 + dwarf_attr(die_mem, DW_AT_location, &attr) || 984 + dwarf_attr(die_mem, DW_AT_const_value, &attr))) 981 985 return DIE_FIND_CB_END; 982 986 if (dwarf_haspc(die_mem, fvp->addr)) 983 987 return DIE_FIND_CB_CONTINUE;
+1
tools/perf/util/env.c
··· 144 144 node = rb_entry(next, struct bpf_prog_info_node, rb_node); 145 145 next = rb_next(&node->rb_node); 146 146 rb_erase(&node->rb_node, root); 147 + free(node->info_linear); 147 148 free(node); 148 149 } 149 150
+1
tools/perf/util/evsel.c
··· 428 428 evsel->auto_merge_stats = orig->auto_merge_stats; 429 429 evsel->collect_stat = orig->collect_stat; 430 430 evsel->weak_group = orig->weak_group; 431 + evsel->use_config_name = orig->use_config_name; 431 432 432 433 if (evsel__copy_config_terms(evsel, orig) < 0) 433 434 goto out_err;
+2 -2
tools/perf/util/evsel.h
··· 83 83 bool collect_stat; 84 84 bool weak_group; 85 85 bool bpf_counter; 86 + bool use_config_name; 86 87 int bpf_fd; 87 88 struct bpf_object *bpf_obj; 89 + struct list_head config_terms; 88 90 }; 89 91 90 92 /* ··· 118 116 bool merged_stat; 119 117 bool reset_group; 120 118 bool errored; 121 - bool use_config_name; 122 119 struct hashmap *per_pkg_mask; 123 120 struct evsel *leader; 124 - struct list_head config_terms; 125 121 int err; 126 122 int cpu_iter; 127 123 struct {
+10
tools/perf/util/perf_api_probe.c
··· 103 103 evsel->core.attr.build_id = 1; 104 104 } 105 105 106 + static void perf_probe_cgroup(struct evsel *evsel) 107 + { 108 + evsel->core.attr.cgroup = 1; 109 + } 110 + 106 111 bool perf_can_sample_identifier(void) 107 112 { 108 113 return perf_probe_api(perf_probe_sample_identifier); ··· 186 181 bool perf_can_record_build_id(void) 187 182 { 188 183 return perf_probe_api(perf_probe_build_id); 184 + } 185 + 186 + bool perf_can_record_cgroup(void) 187 + { 188 + return perf_probe_api(perf_probe_cgroup); 189 189 }
+1
tools/perf/util/perf_api_probe.h
··· 12 12 bool perf_can_record_text_poke_events(void); 13 13 bool perf_can_sample_identifier(void); 14 14 bool perf_can_record_build_id(void); 15 + bool perf_can_record_cgroup(void); 15 16 16 17 #endif // __PERF_API_PROBE_H
+3
tools/perf/util/probe-finder.c
··· 190 190 immediate_value_is_supported()) { 191 191 Dwarf_Sword snum; 192 192 193 + if (!tvar) 194 + return 0; 195 + 193 196 dwarf_formsdata(&attr, &snum); 194 197 ret = asprintf(&tvar->value, "\\%ld", (long)snum); 195 198
+3 -5
tools/perf/util/stat-display.c
··· 541 541 char *config; 542 542 int ret = 0; 543 543 544 - if (counter->uniquified_name || 544 + if (counter->uniquified_name || counter->use_config_name || 545 545 !counter->pmu_name || !strncmp(counter->name, counter->pmu_name, 546 546 strlen(counter->pmu_name))) 547 547 return; ··· 555 555 } 556 556 } else { 557 557 if (perf_pmu__has_hybrid()) { 558 - if (!counter->use_config_name) { 559 - ret = asprintf(&new_name, "%s/%s/", 560 - counter->pmu_name, counter->name); 561 - } 558 + ret = asprintf(&new_name, "%s/%s/", 559 + counter->pmu_name, counter->name); 562 560 } else { 563 561 ret = asprintf(&new_name, "%s [%s]", 564 562 counter->name, counter->pmu_name);
+1
tools/perf/util/symbol-elf.c
··· 2412 2412 2413 2413 list_for_each_entry_safe(pos, tmp, sdt_notes, note_list) { 2414 2414 list_del_init(&pos->note_list); 2415 + zfree(&pos->args); 2415 2416 zfree(&pos->name); 2416 2417 zfree(&pos->provider); 2417 2418 free(pos);