linux/tools/perf/util
John Garry 3d6e79ee9e perf metricgroup: Fix system PMU metrics
Joakim reports that getting "perf stat" for multiple system PMU metrics
segfaults:

  $ perf stat -a -I 1000 -M imx8mm_ddr_write.all,imx8mm_ddr_write.all
  Segmentation fault
  $

While the same works without issue for a single metric.

The logic in metricgroup__add_metric_sys_event_iter() is broken, in that
add_metric() @m argument should be NULL for each new metric. Fix by not
passing a holder for that, and rather make local in
metricgroup__add_metric_sys_event_iter().

Fixes: be335ec28e ("perf metricgroup: Support adding metrics for system PMUs")
Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linuxarm@openeuler.org
Link: https://lore.kernel.org/r/1611050655-44020-1-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-01-21 17:25:33 -03:00
..
arm-spe-decoder perf arm-spe: Add support for ARMv8.3-SPE 2020-11-26 09:31:46 -03:00
c++
cs-etm-decoder
include tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' 2020-11-12 17:55:41 -03:00
intel-pt-decoder
libunwind
scripting-engines perf scripting python: Avoid declaring function pointers with a visibility attribute 2020-11-03 08:32:43 -03:00
Build perf streams: Introduce branch history "streams" 2020-10-14 13:27:28 -03:00
PERF-VERSION-GEN
affinity.c
affinity.h
annotate.c perf annotate: Move bpf header inclusion to inside HAVE_LIBBPF_SUPPORT 2020-11-04 09:42:41 -03:00
annotate.h
archinsn.h
arm-spe.c perf arm-spe: Refactor printing string to buffer 2020-11-26 09:31:23 -03:00
arm-spe.h
auxtrace.c perf evlist: Use the right prefix for 'struct evlist' event group methods 2020-11-30 15:00:12 -03:00
auxtrace.h perf auxtrace: Add itrace option '-M' for memory events 2020-11-11 12:24:51 -03:00
block-info.c
block-info.h
block-range.c
block-range.h
bpf-event.c perf evlist: Use the right prefix for 'struct evlist' sideband thread methods 2020-11-30 09:40:10 -03:00
bpf-event.h
bpf-loader.c perf evlist: Use the right prefix for 'struct evlist' 'find' methods 2020-11-30 09:48:07 -03:00
bpf-loader.h perf bpf: Enclose libbpf.h include within HAVE_LIBBPF_SUPPORT 2020-11-04 09:42:40 -03:00
bpf-prologue.c
bpf-prologue.h
bpf_map.c
bpf_map.h
branch.c
branch.h
build-id.c perf build-id: Add build_id_cache__add function 2020-11-27 08:37:29 -03:00
build-id.h perf build-id: Add build_id_cache__add function 2020-11-27 08:37:29 -03:00
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c perf streams: Report hot streams 2020-10-14 13:34:26 -03:00
callchain.h perf streams: Report hot streams 2020-10-14 13:34:26 -03:00
cap.c
cap.h
cgroup.c perf evlist: Use the right prefix for 'struct evlist' evsel list methods 2020-11-30 14:52:44 -03:00
cgroup.h perf tools: Allow creation of cgroup without open 2020-09-28 09:18:06 -03:00
clockid.c
clockid.h
cloexec.c
cloexec.h
color.c
color.h
color_config.c
comm.c
comm.h
compress.h
config.c perf config: Export the perf_config_from_file() function 2020-10-13 17:03:19 -03:00
config.h perf config: Export the perf_config_from_file() function 2020-10-13 17:03:19 -03:00
copyfile.c
copyfile.h
counts.c
counts.h
cpu-set-sched.h
cpumap.c perf stat aggregation: Add separate thread member 2020-12-24 10:05:28 -03:00
cpumap.h perf stat aggregation: Add separate thread member 2020-12-24 10:05:28 -03:00
cputopo.c
cputopo.h
cs-etm.c
cs-etm.h
data-convert-bt.c
data-convert-bt.h
data-convert.h
data.c perf data: Add is_perf_data function 2020-11-27 08:37:15 -03:00
data.h perf data: Add is_perf_data function 2020-11-27 08:37:15 -03:00
db-export.c
db-export.h
debug.c perf debug: Add debug_set_file function 2020-12-17 14:36:17 -03:00
debug.h perf debug: Add debug_set_file function 2020-12-17 14:36:17 -03:00
demangle-java.c
demangle-java.h
demangle-rust.c
demangle-rust.h
dso.c perf tools: Add filename__decompress function 2020-11-27 08:36:53 -03:00
dso.h perf tools: Add filename__decompress function 2020-11-27 08:36:53 -03:00
dsos.c perf tools: Align buildid list output for short build ids 2020-10-14 11:28:52 -03:00
dsos.h
dump-insn.c
dump-insn.h
dwarf-aux.c perf probe: Change function definition check due to broken DWARF 2020-11-27 14:36:15 -03:00
dwarf-aux.h
dwarf-regs.c
env.c perf env: Conditionally compile BPF support code on having HAVE_LIBBPF_SUPPORT 2020-11-04 09:42:41 -03:00
env.h perf env: Conditionally compile BPF support code on having HAVE_LIBBPF_SUPPORT 2020-11-04 09:42:41 -03:00
event.c
event.h perf script: Support data page size 2020-12-19 17:04:39 -03:00
events_stats.h
evlist.c perf tools: Add evlist__disable_evsel/evlist__enable_evsel 2020-12-17 14:36:17 -03:00
evlist.h perf tools: Add evlist__disable_evsel/evlist__enable_evsel 2020-12-17 14:36:17 -03:00
evsel.c perf evsel: Emit warning about kernel not supporting the data page size sample_type bit 2020-12-17 14:36:16 -03:00
evsel.h perf evsel: Emit warning about kernel not supporting the data page size sample_type bit 2020-12-17 14:36:16 -03:00
evsel_config.h
evsel_fprintf.c
evsel_fprintf.h
evswitch.c perf evlist: Use the right prefix for 'struct evlist' 'find' methods 2020-11-30 09:48:07 -03:00
evswitch.h
expr.c perf expr: Force encapsulation on expr_id_data 2020-11-16 14:09:18 -03:00
expr.h perf expr: Force encapsulation on expr_id_data 2020-11-16 14:09:18 -03:00
expr.l
expr.y perf expr: Force encapsulation on expr_id_data 2020-11-16 14:09:18 -03:00
find-map.c
fncache.c
fncache.h
genelf.c
genelf.h
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c
get_current_dir_name.h
hashmap.c perf tools: Update copy of libbpf's hashmap.c 2020-11-03 08:26:55 -03:00
hashmap.h perf tools: Update copy of libbpf's hashmap.c 2020-11-27 14:19:33 -03:00
header.c perf inject: Correct event attribute sizes 2021-01-15 17:28:28 -03:00
header.h
help-unknown-cmd.c
help-unknown-cmd.h
hist.c perf sort: Add sort option for data page size 2020-12-19 17:52:24 -03:00
hist.h perf sort: Add sort option for data page size 2020-12-19 17:52:24 -03:00
intel-bts.c
intel-bts.h
intel-pt.c perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods 2020-11-30 14:17:57 -03:00
intel-pt.h
intlist.c
intlist.h
jit.h
jitdump.c
jitdump.h
kvm-stat.h
levenshtein.c
levenshtein.h
llvm-utils.c
llvm-utils.h
lzma.c
machine.c perf intel-pt: Fix 'CPU too large' error 2021-01-15 17:28:27 -03:00
machine.h
map.c perf tools: Pass build_id object to build_id__sprintf() 2020-10-14 08:46:22 -03:00
map.h perf inject: Do not load map/dso when injecting build-id 2020-10-13 11:01:37 -03:00
map_symbol.h perf sort: Add sort option for data page size 2020-12-19 17:52:24 -03:00
maps.h
mem-events.c perf mem: Support new memory event PERF_MEM_EVENTS__LOAD_STORE 2020-11-11 10:30:25 -03:00
mem-events.h perf mem: Support new memory event PERF_MEM_EVENTS__LOAD_STORE 2020-11-11 10:30:25 -03:00
mem2node.c perf mem2node: Improve warning if detected no memory nodes 2020-11-04 09:42:40 -03:00
mem2node.h
memswap.c
memswap.h
metricgroup.c perf metricgroup: Fix system PMU metrics 2021-01-21 17:25:33 -03:00
metricgroup.h perf tools: Copy metric events properly when expand cgroups 2020-09-28 09:16:21 -03:00
mmap.c
mmap.h
namespaces.c
namespaces.h
ordered-events.c
ordered-events.h
parse-branch-options.c
parse-branch-options.h
parse-events.c perf evlist: Use the right prefix for 'struct evlist' evsel list methods 2020-11-30 14:52:44 -03:00
parse-events.h perf parse-events: Reduce casts around bp_addr 2020-09-28 09:22:39 -03:00
parse-events.l perf tools: Add support for exclusive groups/events 2020-10-14 12:24:28 -03:00
parse-events.y perf parse-events: Reduce casts around bp_addr 2020-09-28 09:22:39 -03:00
parse-regs-options.c perf record: Fix memory leak when using '--user-regs=?' to list registers 2020-12-17 14:36:16 -03:00
parse-regs-options.h
parse-sublevel-options.c
parse-sublevel-options.h
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
perf_api_probe.c
perf_api_probe.h
perf_event_attr_fprintf.c perf record: Support new sample type for data page size 2020-12-17 14:36:16 -03:00
perf_regs.c
perf_regs.h
pfm.c
pfm.h
pmu.c perf pmu: Add pmu_add_sys_aliases() 2020-12-17 14:36:17 -03:00
pmu.h perf pmu: Add pmu_add_sys_aliases() 2020-12-17 14:36:17 -03:00
pmu.l
pmu.y
print_binary.c perf python scripting: Fix printable strings in python3 scripts 2020-10-01 12:10:56 -03:00
print_binary.h
probe-event.c perf tools: Pass build_id object to build_id__sprintf() 2020-10-14 08:46:22 -03:00
probe-event.h
probe-file.c perf probe: Fix memory leak when synthesizing SDT probes 2020-12-24 10:52:10 -03:00
probe-file.h
probe-finder.c perf probe: Change function definition check due to broken DWARF 2020-11-27 14:36:15 -03:00
probe-finder.h
pstack.c
pstack.h
python-ext-sources
python.c perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods 2020-11-30 14:17:57 -03:00
rb_resort.h
rblist.c
rblist.h
record.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
record.h perf record: Support new sample type for data page size 2020-12-17 14:36:16 -03:00
rlimit.c
rlimit.h
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods 2020-11-30 14:17:57 -03:00
s390-cpumsf.h
s390-sample-raw.c perf evlist: Use the right prefix for 'struct evlist' raw samples methods 2020-11-30 15:15:30 -03:00
sample-raw.c perf evlist: Use the right prefix for 'struct evlist' raw samples methods 2020-11-30 15:15:30 -03:00
sample-raw.h perf evlist: Use the right prefix for 'struct evlist' raw samples methods 2020-11-30 15:15:30 -03:00
session.c perf intel-pt: Fix 'CPU too large' error 2021-01-15 17:28:27 -03:00
session.h
setns.c
setup.py
sideband_evlist.c perf evlist: Use the right prefix for 'struct evlist' create maps methods 2020-11-30 14:56:52 -03:00
smt.c
smt.h
sort.c perf sort: Add sort option for data page size 2020-12-19 17:52:24 -03:00
sort.h perf sort: Add sort option for data page size 2020-12-19 17:52:24 -03:00
spark.c
spark.h
srccode.c
srccode.h
srcline.c
srcline.h
stat-display.c perf stat aggregation: Add separate thread member 2020-12-24 10:05:28 -03:00
stat-shadow.c perf stat: Take cgroups into account for shadow stats 2021-01-15 17:28:27 -03:00
stat.c perf stat aggregation: Add separate socket member 2020-12-24 10:05:04 -03:00
stat.h perf cpumap: Drop in cpu_aggr_map struct 2020-12-24 10:04:32 -03:00
strbuf.c
strbuf.h
stream.c perf streams: Report hot streams 2020-10-14 13:34:26 -03:00
stream.h perf streams: Report hot streams 2020-10-14 13:34:26 -03:00
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf tools: Add support to read build id from compressed elf 2020-12-17 14:36:17 -03:00
symbol-minimal.c perf tools: Pass build_id object to dso__set_build_id() 2020-10-14 08:46:42 -03:00
symbol.c perf symbols: Try to load vmlinux from buildid database 2020-11-27 08:37:08 -03:00
symbol.h perf tools: Fix crash with non-jited bpf progs 2020-11-03 08:30:34 -03:00
symbol_conf.h
symbol_fprintf.c
symsrc.h
synthetic-events.c perf record: Support new sample type for data page size 2020-12-17 14:36:16 -03:00
synthetic-events.h
syscalltbl.c
syscalltbl.h
target.c
target.h
term.c
term.h
thread-stack.c
thread-stack.h
thread.c
thread.h
thread_map.c
thread_map.h
time-utils.c
time-utils.h
tool.h
top.c
top.h
topdown.c
topdown.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c
trace-event.c
trace-event.h
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c perf unwind: Fix separate debug info files when using elfutils' libdw's unwinder 2020-12-17 14:36:16 -03:00
unwind-libdw.h
unwind-libunwind-local.c
unwind-libunwind.c
unwind.h
usage.c
util.c
util.h
values.c
values.h
vdso.c
vdso.h
xyarray.c
zlib.c
zstd.c