History

Merge tag 'perf-tools-fixes-for-v5.19-2022-06-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tool fixes from Arnaldo Carvalho de Melo: - Don't set data source if it's not a memory operation in ARM SPE (Statistical Profiling Extensions). - Fix handling of exponent floating point values in perf stat expressions. - Don't leak fd on failure on libperf open. - Fix 'perf test' CPU topology test for PPC guest systems. - Fix undefined behaviour on breakpoint account 'perf test' entry. - Record only user callchains on the "Check ARM64 callgraphs are complete in FP mode" 'perf test' entry. - Fix "perf stat CSV output linter" test on s390. - Sync batch of kernel headers with tools/perf/. * tag 'perf-tools-fixes-for-v5.19-2022-06-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: tools headers UAPI: Sync linux/prctl.h with the kernel sources perf metrics: Ensure at least 1 id per metric tools headers arm64: Sync arm64's cputype.h with the kernel sources tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources perf arm-spe: Don't set data source if it's not a memory operation perf expr: Allow exponents on floating point values perf test topology: Use !strncmp(right platform) to fix guest PPC comparision check perf test: Record only user callchains on the "Check Arm64 callgraphs are complete in fp mode" test perf beauty: Update copy of linux/socket.h with the kernel sources perf test: Fix variable length array undefined behavior in bp_account libperf evsel: Open shouldn't leak fd on failure perf test: Fix "perf stat CSV output linter" test on s390 perf unwind: Fix uninitialized variable

Linus Torvalds committed 4 years ago

Commit c5b3a092 parents 59b785f 140cd9e15 files · +125 −105Browse files

Unified · Split

15 files
  1. tools/arch/arm64/include/asm/cputype.h +10 −2
  2. tools/arch/x86/include/uapi/asm/kvm.h +6 −5
  3. tools/include/uapi/linux/prctl.h +9 −0
  4. tools/lib/perf/evsel.c +12 −5
  5. tools/perf/tests/bp_account.c +14 −2
  6. tools/perf/tests/expr.c +2 −0
  7. tools/perf/tests/shell/lib/perf_csv_output_lint.py +0 −48
  8. tools/perf/tests/shell/stat+csv_output.sh +45 −24
  9. tools/perf/tests/shell/test_arm_callgraph_fp.sh +1 −1
  10. tools/perf/tests/topology.c +1 −1
  11. tools/perf/trace/beauty/include/linux/socket.h +6 −1
  12. tools/perf/util/arm-spe.c +8 −14
  13. tools/perf/util/expr.l +1 −1
  14. tools/perf/util/metricgroup.c +9 −0
  15. tools/perf/util/unwind-libunwind-local.c +1 −1
tools/arch/arm64/include/asm/cputype.h+10−2
@@ -36,7 +36,7 @@ · 35 unmodified lines
3636 #define MIDR_VARIANT(midr) \
3737 (((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT)
3838 #define MIDR_IMPLEMENTOR_SHIFT 24
39−#define MIDR_IMPLEMENTOR_MASK (0xff << MIDR_IMPLEMENTOR_SHIFT)
39+#define MIDR_IMPLEMENTOR_MASK (0xffU << MIDR_IMPLEMENTOR_SHIFT)
4040 #define MIDR_IMPLEMENTOR(midr) \
4141 (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
4242
@@ -118,6 +118,10 @@ · 75 unmodified lines
118118
119119 #define APPLE_CPU_PART_M1_ICESTORM 0x022
120120 #define APPLE_CPU_PART_M1_FIRESTORM 0x023
121+#define APPLE_CPU_PART_M1_ICESTORM_PRO 0x024
122+#define APPLE_CPU_PART_M1_FIRESTORM_PRO 0x025
123+#define APPLE_CPU_PART_M1_ICESTORM_MAX 0x028
124+#define APPLE_CPU_PART_M1_FIRESTORM_MAX 0x029
121125
122126 #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
123127 #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
@@ -164,6 +168,10 @@ · 40 unmodified lines
164168 #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
165169 #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)
166170 #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)
171+#define MIDR_APPLE_M1_ICESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_PRO)
172+#define MIDR_APPLE_M1_FIRESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_PRO)
173+#define MIDR_APPLE_M1_ICESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_MAX)
174+#define MIDR_APPLE_M1_FIRESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_MAX)
167175
168176 /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */
169177 #define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX
@@ -172,7 +180,7 @@ · 2 unmodified lines
172180
173181 #ifndef __ASSEMBLY__
174182
175−#include "sysreg.h"
183+#include <asm/sysreg.h>
176184
177185 #define read_cpuid(reg) read_sysreg_s(SYS_ ## reg)
178186
tools/arch/x86/include/uapi/asm/kvm.h+6−5
@@ -428,11 +428,12 @@ struct kvm_sync_regs { · 427 unmodified lines
428428 struct kvm_vcpu_events events;
429429 };
430430
431−#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
432−#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
433−#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
434−#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
435−#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
431+#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
432+#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
433+#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
434+#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
435+#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
436+#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5)
436437
437438 #define KVM_STATE_NESTED_FORMAT_VMX 0
438439 #define KVM_STATE_NESTED_FORMAT_SVM 1
tools/include/uapi/linux/prctl.h+9−0
@@ -272,6 +272,15 @@ struct prctl_mm_map { · 271 unmodified lines
272272 # define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1
273273 # define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2
274274
275+/* arm64 Scalable Matrix Extension controls */
276+/* Flag values must be in sync with SVE versions */
277+#define PR_SME_SET_VL 63 /* set task vector length */
278+# define PR_SME_SET_VL_ONEXEC (1 << 18) /* defer effect until exec */
279+#define PR_SME_GET_VL 64 /* get task vector length */
280+/* Bits common to PR_SME_SET_VL and PR_SME_GET_VL */
281+# define PR_SME_VL_LEN_MASK 0xffff
282+# define PR_SME_VL_INHERIT (1 << 17) /* inherit across exec */
283+
275284 #define PR_SET_VMA 0x53564d41
276285 # define PR_SET_VMA_ANON_NAME 0
277286
tools/lib/perf/evsel.c+12−5
@@ -149,23 +149,30 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, · 148 unmodified lines
149149 int fd, group_fd, *evsel_fd;
150150
151151 evsel_fd = FD(evsel, idx, thread);
152− if (evsel_fd == NULL)
153− return -EINVAL;
152+ if (evsel_fd == NULL) {
153+ err = -EINVAL;
154+ goto out;
155+ }
154156
155157 err = get_group_fd(evsel, idx, thread, &group_fd);
156158 if (err < 0)
157− return err;
159+ goto out;
158160
159161 fd = sys_perf_event_open(&evsel->attr,
160162 threads->map[thread].pid,
161163 cpu, group_fd, 0);
162164
163− if (fd < 0)
164− return -errno;
165+ if (fd < 0) {
166+ err = -errno;
167+ goto out;
168+ }
165169
166170 *evsel_fd = fd;
167171 }
168172 }
173+out:
174+ if (err)
175+ perf_evsel__close(evsel);
169176
170177 return err;
171178 }
tools/perf/tests/bp_account.c+14−2
@@ -151,11 +151,21 @@ static int detect_ioctl(void) · 150 unmodified lines
151151 static int detect_share(int wp_cnt, int bp_cnt)
152152 {
153153 struct perf_event_attr attr;
154− int i, fd[wp_cnt + bp_cnt], ret;
154+ int i, *fd = NULL, ret = -1;
155+
156+ if (wp_cnt + bp_cnt == 0)
157+ return 0;
158+
159+ fd = malloc(sizeof(int) * (wp_cnt + bp_cnt));
160+ if (!fd)
161+ return -1;
155162
156163 for (i = 0; i < wp_cnt; i++) {
157164 fd[i] = wp_event((void *)&the_var, &attr);
158− TEST_ASSERT_VAL("failed to create wp\n", fd[i] != -1);
165+ if (fd[i] == -1) {
166+ pr_err("failed to create wp\n");
167+ goto out;
168+ }
159169 }
160170
161171 for (; i < (bp_cnt + wp_cnt); i++) {
@@ -166,9 +176,11 @@ static int detect_share(int wp_cnt, int bp_cnt) · 4 unmodified lines
166176
167177 ret = i != (bp_cnt + wp_cnt);
168178
179+out:
169180 while (i--)
170181 close(fd[i]);
171182
183+ free(fd);
172184 return ret;
173185 }
174186
tools/perf/tests/expr.c+2−0
@@ -97,6 +97,8 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u · 96 unmodified lines
9797 ret |= test(ctx, "2.2 > 2.2", 0);
9898 ret |= test(ctx, "2.2 < 1.1", 0);
9999 ret |= test(ctx, "1.1 > 2.2", 0);
100+ ret |= test(ctx, "1.1e10 < 1.1e100", 1);
101+ ret |= test(ctx, "1.1e2 > 1.1e-2", 1);
100102
101103 if (ret) {
102104 expr__ctx_free(ctx);
tools/perf/tests/shell/lib/perf_csv_output_lint.py+0−48
@@ -1,48 +0,0 @@
1−#!/usr/bin/python
2−# SPDX-License-Identifier: GPL-2.0
3−
4−import argparse
5−import sys
6−
7−# Basic sanity check of perf CSV output as specified in the man page.
8−# Currently just checks the number of fields per line in output.
9−
10−ap = argparse.ArgumentParser()
11−ap.add_argument('--no-args', action='store_true')
12−ap.add_argument('--interval', action='store_true')
13−ap.add_argument('--system-wide-no-aggr', action='store_true')
14−ap.add_argument('--system-wide', action='store_true')
15−ap.add_argument('--event', action='store_true')
16−ap.add_argument('--per-core', action='store_true')
17−ap.add_argument('--per-thread', action='store_true')
18−ap.add_argument('--per-die', action='store_true')
19−ap.add_argument('--per-node', action='store_true')
20−ap.add_argument('--per-socket', action='store_true')
21−ap.add_argument('--separator', default=',', nargs='?')
22−args = ap.parse_args()
23−
24−Lines = sys.stdin.readlines()
25−
26−def check_csv_output(exp):
27− for line in Lines:
28− if 'failed' not in line:
29− count = line.count(args.separator)
30− if count != exp:
31− sys.stdout.write(''.join(Lines))
32− raise RuntimeError(f'wrong number of fields. expected {exp} in {line}')
33−
34−try:
35− if args.no_args or args.system_wide or args.event:
36− expected_items = 6
37− elif args.interval or args.per_thread or args.system_wide_no_aggr:
38− expected_items = 7
39− elif args.per_core or args.per_socket or args.per_node or args.per_die:
40− expected_items = 8
41− else:
42− ap.print_help()
43− raise RuntimeError('No checking option specified')
44− check_csv_output(expected_items)
45−
46−except:
47− sys.stdout.write('Test failed for input: ' + ''.join(Lines))
48− raise
tools/perf/tests/shell/stat+csv_output.sh+45−24
@@ -6,20 +6,41 @@ · 5 unmodified lines
66
77 set -e
88
9−pythonchecker=$(dirname $0)/lib/perf_csv_output_lint.py
10−if [ "x$PYTHON" == "x" ]
11−then
12− if which python3 > /dev/null
13− then
14− PYTHON=python3
15− elif which python > /dev/null
16− then
17− PYTHON=python
18− else
19− echo Skipping test, python not detected please set environment variable PYTHON.
20− exit 2
21− fi
22−fi
9+function commachecker()
10+{
11+ local -i cnt=0 exp=0
12+
13+ case "$1"
14+ in "--no-args") exp=6
15+ ;; "--system-wide") exp=6
16+ ;; "--event") exp=6
17+ ;; "--interval") exp=7
18+ ;; "--per-thread") exp=7
19+ ;; "--system-wide-no-aggr") exp=7
20+ [ $(uname -m) = "s390x" ] && exp=6
21+ ;; "--per-core") exp=8
22+ ;; "--per-socket") exp=8
23+ ;; "--per-node") exp=8
24+ ;; "--per-die") exp=8
25+ esac
26+
27+ while read line
28+ do
29+ # Check for lines beginning with Failed
30+ x=${line:0:6}
31+ [ "$x" = "Failed" ] && continue
32+
33+ # Count the number of commas
34+ x=$(echo $line | tr -d -c ',')
35+ cnt="${#x}"
36+ # echo $line $cnt
37+ [ "$cnt" -ne "$exp" ] && {
38+ echo "wrong number of fields. expected $exp in $line" 1>&2
39+ exit 1;
40+ }
41+ done
42+ return 0
43+}
2344
2445 # Return true if perf_event_paranoid is > $1 and not running as root.
2546 function ParanoidAndNotRoot()
@@ -30,7 +51,7 @@ function ParanoidAndNotRoot() · 4 unmodified lines
3051 check_no_args()
3152 {
3253 echo -n "Checking CSV output: no args "
33− perf stat -x, true 2>&1 | $PYTHON $pythonchecker --no-args
54+ perf stat -x, true 2>&1 | commachecker --no-args
3455 echo "[Success]"
3556 }
3657
@@ -42,7 +63,7 @@ check_system_wide() · 5 unmodified lines
4263 echo "[Skip] paranoid and not root"
4364 return
4465 fi
45− perf stat -x, -a true 2>&1 | $PYTHON $pythonchecker --system-wide
66+ perf stat -x, -a true 2>&1 | commachecker --system-wide
4667 echo "[Success]"
4768 }
4869
@@ -55,14 +76,14 @@ check_system_wide_no_aggr() · 6 unmodified lines
5576 return
5677 fi
5778 echo -n "Checking CSV output: system wide no aggregation "
58− perf stat -x, -A -a --no-merge true 2>&1 | $PYTHON $pythonchecker --system-wide-no-aggr
79+ perf stat -x, -A -a --no-merge true 2>&1 | commachecker --system-wide-no-aggr
5980 echo "[Success]"
6081 }
6182
6283 check_interval()
6384 {
6485 echo -n "Checking CSV output: interval "
65− perf stat -x, -I 1000 true 2>&1 | $PYTHON $pythonchecker --interval
86+ perf stat -x, -I 1000 true 2>&1 | commachecker --interval
6687 echo "[Success]"
6788 }
6889
@@ -70,7 +91,7 @@ check_interval() · 1 unmodified line
7091 check_event()
7192 {
7293 echo -n "Checking CSV output: event "
73− perf stat -x, -e cpu-clock true 2>&1 | $PYTHON $pythonchecker --event
94+ perf stat -x, -e cpu-clock true 2>&1 | commachecker --event
7495 echo "[Success]"
7596 }
7697
@@ -82,7 +103,7 @@ check_per_core() · 5 unmodified lines
82103 echo "[Skip] paranoid and not root"
83104 return
84105 fi
85− perf stat -x, --per-core -a true 2>&1 | $PYTHON $pythonchecker --per-core
106+ perf stat -x, --per-core -a true 2>&1 | commachecker --per-core
86107 echo "[Success]"
87108 }
88109
@@ -94,7 +115,7 @@ check_per_thread() · 5 unmodified lines
94115 echo "[Skip] paranoid and not root"
95116 return
96117 fi
97− perf stat -x, --per-thread -a true 2>&1 | $PYTHON $pythonchecker --per-thread
118+ perf stat -x, --per-thread -a true 2>&1 | commachecker --per-thread
98119 echo "[Success]"
99120 }
100121
@@ -106,7 +127,7 @@ check_per_die() · 5 unmodified lines
106127 echo "[Skip] paranoid and not root"
107128 return
108129 fi
109− perf stat -x, --per-die -a true 2>&1 | $PYTHON $pythonchecker --per-die
130+ perf stat -x, --per-die -a true 2>&1 | commachecker --per-die
110131 echo "[Success]"
111132 }
112133
@@ -118,7 +139,7 @@ check_per_node() · 5 unmodified lines
118139 echo "[Skip] paranoid and not root"
119140 return
120141 fi
121− perf stat -x, --per-node -a true 2>&1 | $PYTHON $pythonchecker --per-node
142+ perf stat -x, --per-node -a true 2>&1 | commachecker --per-node
122143 echo "[Success]"
123144 }
124145
@@ -130,7 +151,7 @@ check_per_socket() · 5 unmodified lines
130151 echo "[Skip] paranoid and not root"
131152 return
132153 fi
133− perf stat -x, --per-socket -a true 2>&1 | $PYTHON $pythonchecker --per-socket
154+ perf stat -x, --per-socket -a true 2>&1 | commachecker --per-socket
134155 echo "[Success]"
135156 }
136157
tools/perf/tests/shell/test_arm_callgraph_fp.sh+1−1
@@ -43,7 +43,7 @@ CFLAGS="-g -O0 -fno-inline -fno-omit-frame-pointer" · 42 unmodified lines
4343 cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1
4444
4545 # Add a 1 second delay to skip samples that are not in the leaf() function
46−perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 -- $TEST_PROGRAM 2> /dev/null &
46+perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null &
4747 PID=$!
4848
4949 echo " + Recording (PID=$PID)..."
tools/perf/tests/topology.c+1−1
@@ -115,7 +115,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) · 114 unmodified lines
115115 * physical_package_id will be set to -1. Hence skip this
116116 * test if physical_package_id returns -1 for cpu from perf_cpu_map.
117117 */
118− if (strncmp(session->header.env.arch, "powerpc", 7)) {
118+ if (!strncmp(session->header.env.arch, "ppc64le", 7)) {
119119 if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1)
120120 return TEST_SKIP;
121121 }
tools/perf/trace/beauty/include/linux/socket.h+6−1
@@ -50,6 +50,9 @@ struct linger { · 49 unmodified lines
5050 struct msghdr {
5151 void *msg_name; /* ptr to socket address structure */
5252 int msg_namelen; /* size of socket address structure */
53+
54+ int msg_inq; /* output, data left in socket */
55+
5356 struct iov_iter msg_iter; /* data */
5457
5558 /*
@@ -62,8 +65,9 @@ struct msghdr { · 6 unmodified lines
6265 void __user *msg_control_user;
6366 };
6467 bool msg_control_is_user : 1;
65− __kernel_size_t msg_controllen; /* ancillary data buffer length */
68+ bool msg_get_inq : 1;/* return INQ after receive */
6669 unsigned int msg_flags; /* flags on received message */
70+ __kernel_size_t msg_controllen; /* ancillary data buffer length */
6771 struct kiocb *msg_iocb; /* ptr to iocb for async requests */
6872 };
6973
@@ -434,6 +438,7 @@ extern struct file *do_accept(struct file *file, unsigned file_flags, · 364 unmodified lines
434438 extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
435439 int __user *upeer_addrlen, int flags);
436440 extern int __sys_socket(int family, int type, int protocol);
441+extern struct file *__sys_socket_file(int family, int type, int protocol);
437442 extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
438443 extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr,
439444 int addrlen, int file_flags);
tools/perf/util/arm-spe.c+8−14
@@ -387,26 +387,16 @@ static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq, · 386 unmodified lines
387387 return arm_spe_deliver_synth_event(spe, speq, event, &sample);
388388 }
389389
390−#define SPE_MEM_TYPE (ARM_SPE_L1D_ACCESS | ARM_SPE_L1D_MISS | \
391− ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS | \
392− ARM_SPE_REMOTE_ACCESS)
393−
394−static bool arm_spe__is_memory_event(enum arm_spe_sample_type type)
395−{
396− if (type & SPE_MEM_TYPE)
397− return true;
398−
399− return false;
400−}
401−
402390 static u64 arm_spe__synth_data_source(const struct arm_spe_record *record)
403391 {
404392 union perf_mem_data_src data_src = { 0 };
405393
406394 if (record->op == ARM_SPE_LD)
407395 data_src.mem_op = PERF_MEM_OP_LOAD;
408− else
396+ else if (record->op == ARM_SPE_ST)
409397 data_src.mem_op = PERF_MEM_OP_STORE;
398+ else
399+ return 0;
410400
411401 if (record->type & (ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS)) {
412402 data_src.mem_lvl = PERF_MEM_LVL_L3;
@@ -510,7 +500,11 @@ static int arm_spe_sample(struct arm_spe_queue *speq) · 97 unmodified lines
510500 return err;
511501 }
512502
513− if (spe->sample_memory && arm_spe__is_memory_event(record->type)) {
503+ /*
504+ * When data_src is zero it means the record is not a memory operation,
505+ * skip to synthesize memory sample for this case.
506+ */
507+ if (spe->sample_memory && data_src) {
514508 err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src);
515509 if (err)
516510 return err;
tools/perf/util/expr.l+1−1
@@ -91,7 +91,7 @@ static int literal(yyscan_t scanner) · 90 unmodified lines
9191 }
9292 %}
9393
94−number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)
94+number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(e-?[0-9]+)?
9595
9696 sch [-,=]
9797 spec \\{sch}
tools/perf/util/metricgroup.c+9−0
@@ -1372,6 +1372,7 @@ static int parse_ids(bool metric_no_merge, struct perf_pmu *fake_pmu, · 1371 unmodified lines
13721372
13731373 *out_evlist = NULL;
13741374 if (!metric_no_merge || hashmap__size(ids->ids) == 0) {
1375+ bool added_event = false;
13751376 int i;
13761377 /*
13771378 * We may fail to share events between metrics because a tool
@@ -1393,8 +1394,16 @@ static int parse_ids(bool metric_no_merge, struct perf_pmu *fake_pmu, · 15 unmodified lines
13931394 if (!tmp)
13941395 return -ENOMEM;
13951396 ids__insert(ids->ids, tmp);
1397+ added_event = true;
13961398 }
13971399 }
1400+ if (!added_event && hashmap__size(ids->ids) == 0) {
1401+ char *tmp = strdup("duration_time");
1402+
1403+ if (!tmp)
1404+ return -ENOMEM;
1405+ ids__insert(ids->ids, tmp);
1406+ }
13981407 }
13991408 ret = metricgroup__build_event_string(&events, ids, modifier,
14001409 has_constraint);
tools/perf/util/unwind-libunwind-local.c+1−1
@@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address · 173 unmodified lines
174174 Elf *elf;
175175 GElf_Ehdr ehdr;
176176 GElf_Shdr shdr;
177− int ret;
177+ int ret = -1;
178178
179179 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
180180 if (elf == NULL)