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
Unified · Split
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | #define MIDR_VARIANT(midr) \ | 36 | #define MIDR_VARIANT(midr) \ |
| 37 | (((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT) | 37 | (((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT) |
| 38 | #define MIDR_IMPLEMENTOR_SHIFT 24 | 38 | #define MIDR_IMPLEMENTOR_SHIFT 24 |
| 39 | #define MIDR_IMPLEMENTOR_MASK (0xff << MIDR_IMPLEMENTOR_SHIFT) | 39 | #define MIDR_IMPLEMENTOR_MASK (0xffU << MIDR_IMPLEMENTOR_SHIFT) |
| 40 | #define MIDR_IMPLEMENTOR(midr) \ | 40 | #define MIDR_IMPLEMENTOR(midr) \ |
| 41 | (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT) | 41 | (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT) |
| 42 | 42 | ||
| @@ -118,6 +118,10 @@ · 75 unmodified lines | |||
| 118 | 118 | ||
| 119 | #define APPLE_CPU_PART_M1_ICESTORM 0x022 | 119 | #define APPLE_CPU_PART_M1_ICESTORM 0x022 |
| 120 | #define APPLE_CPU_PART_M1_FIRESTORM 0x023 | 120 | #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 | ||
| 121 | 125 | ||
| 122 | #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) | 126 | #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) |
| 123 | #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) | 127 | #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) |
| @@ -164,6 +168,10 @@ · 40 unmodified lines | |||
| 164 | #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110) | 168 | #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110) |
| 165 | #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM) | 169 | #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM) |
| 166 | #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM) | 170 | #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) | ||
| 167 | 175 | ||
| 168 | /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */ | 176 | /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */ |
| 169 | #define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX | 177 | #define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX |
| @@ -172,7 +180,7 @@ · 2 unmodified lines | |||
| 172 | 180 | ||
| 173 | #ifndef __ASSEMBLY__ | 181 | #ifndef __ASSEMBLY__ |
| 174 | 182 | ||
| 175 | #include "sysreg.h" | 183 | #include <asm/sysreg.h> |
| 176 | 184 | ||
| 177 | #define read_cpuid(reg) read_sysreg_s(SYS_ ## reg) | 185 | #define read_cpuid(reg) read_sysreg_s(SYS_ ## reg) |
| 178 | 186 | ||
| @@ -428,11 +428,12 @@ struct kvm_sync_regs { · 427 unmodified lines | |||
| 428 | struct kvm_vcpu_events events; | 428 | struct kvm_vcpu_events events; |
| 429 | }; | 429 | }; |
| 430 | 430 | ||
| 431 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) | 431 | #define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0) |
| 432 | #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) | 432 | #define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1) |
| 433 | #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) | 433 | #define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2) |
| 434 | #define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3) | 434 | #define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3) |
| 435 | #define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4) | 435 | #define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4) |
| 436 | #define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5) | ||
| 436 | 437 | ||
| 437 | #define KVM_STATE_NESTED_FORMAT_VMX 0 | 438 | #define KVM_STATE_NESTED_FORMAT_VMX 0 |
| 438 | #define KVM_STATE_NESTED_FORMAT_SVM 1 | 439 | #define KVM_STATE_NESTED_FORMAT_SVM 1 |
| @@ -272,6 +272,15 @@ struct prctl_mm_map { · 271 unmodified lines | |||
| 272 | # define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1 | 272 | # define PR_SCHED_CORE_SCOPE_THREAD_GROUP 1 |
| 273 | # define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2 | 273 | # define PR_SCHED_CORE_SCOPE_PROCESS_GROUP 2 |
| 274 | 274 | ||
| 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 | |||
| 275 | #define PR_SET_VMA 0x53564d41 | 284 | #define PR_SET_VMA 0x53564d41 |
| 276 | # define PR_SET_VMA_ANON_NAME 0 | 285 | # define PR_SET_VMA_ANON_NAME 0 |
| 277 | 286 | ||
| @@ -149,23 +149,30 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, · 148 unmodified lines | |||
| 149 | int fd, group_fd, *evsel_fd; | 149 | int fd, group_fd, *evsel_fd; |
| 150 | 150 | ||
| 151 | evsel_fd = FD(evsel, idx, thread); | 151 | evsel_fd = FD(evsel, idx, thread); |
| 152 | if (evsel_fd == NULL) | 152 | if (evsel_fd == NULL) { |
| 153 | return -EINVAL; | 153 | err = -EINVAL; |
| 154 | goto out; | ||
| 155 | } | ||
| 154 | 156 | ||
| 155 | err = get_group_fd(evsel, idx, thread, &group_fd); | 157 | err = get_group_fd(evsel, idx, thread, &group_fd); |
| 156 | if (err < 0) | 158 | if (err < 0) |
| 157 | return err; | 159 | goto out; |
| 158 | 160 | ||
| 159 | fd = sys_perf_event_open(&evsel->attr, | 161 | fd = sys_perf_event_open(&evsel->attr, |
| 160 | threads->map[thread].pid, | 162 | threads->map[thread].pid, |
| 161 | cpu, group_fd, 0); | 163 | cpu, group_fd, 0); |
| 162 | 164 | ||
| 163 | if (fd < 0) | 165 | if (fd < 0) { |
| 164 | return -errno; | 166 | err = -errno; |
| 167 | goto out; | ||
| 168 | } | ||
| 165 | 169 | ||
| 166 | *evsel_fd = fd; | 170 | *evsel_fd = fd; |
| 167 | } | 171 | } |
| 168 | } | 172 | } |
| 173 | out: | ||
| 174 | if (err) | ||
| 175 | perf_evsel__close(evsel); | ||
| 169 | 176 | ||
| 170 | return err; | 177 | return err; |
| 171 | } | 178 | } |
| @@ -151,11 +151,21 @@ static int detect_ioctl(void) · 150 unmodified lines | |||
| 151 | static int detect_share(int wp_cnt, int bp_cnt) | 151 | static int detect_share(int wp_cnt, int bp_cnt) |
| 152 | { | 152 | { |
| 153 | struct perf_event_attr attr; | 153 | 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; | ||
| 155 | 162 | ||
| 156 | for (i = 0; i < wp_cnt; i++) { | 163 | for (i = 0; i < wp_cnt; i++) { |
| 157 | fd[i] = wp_event((void *)&the_var, &attr); | 164 | 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 | } | ||
| 159 | } | 169 | } |
| 160 | 170 | ||
| 161 | for (; i < (bp_cnt + wp_cnt); i++) { | 171 | for (; i < (bp_cnt + wp_cnt); i++) { |
| @@ -166,9 +176,11 @@ static int detect_share(int wp_cnt, int bp_cnt) · 4 unmodified lines | |||
| 166 | 176 | ||
| 167 | ret = i != (bp_cnt + wp_cnt); | 177 | ret = i != (bp_cnt + wp_cnt); |
| 168 | 178 | ||
| 179 | out: | ||
| 169 | while (i--) | 180 | while (i--) |
| 170 | close(fd[i]); | 181 | close(fd[i]); |
| 171 | 182 | ||
| 183 | free(fd); | ||
| 172 | return ret; | 184 | return ret; |
| 173 | } | 185 | } |
| 174 | 186 | ||
| @@ -97,6 +97,8 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u · 96 unmodified lines | |||
| 97 | ret |= test(ctx, "2.2 > 2.2", 0); | 97 | ret |= test(ctx, "2.2 > 2.2", 0); |
| 98 | ret |= test(ctx, "2.2 < 1.1", 0); | 98 | ret |= test(ctx, "2.2 < 1.1", 0); |
| 99 | ret |= test(ctx, "1.1 > 2.2", 0); | 99 | 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); | ||
| 100 | 102 | ||
| 101 | if (ret) { | 103 | if (ret) { |
| 102 | expr__ctx_free(ctx); | 104 | expr__ctx_free(ctx); |
| @@ -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 | ||
| @@ -6,20 +6,41 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | set -e | 7 | set -e |
| 8 | 8 | ||
| 9 | pythonchecker=$(dirname $0)/lib/perf_csv_output_lint.py | 9 | function commachecker() |
| 10 | if [ "x$PYTHON" == "x" ] | 10 | { |
| 11 | then | 11 | local -i cnt=0 exp=0 |
| 12 | if which python3 > /dev/null | 12 | |
| 13 | then | 13 | case "$1" |
| 14 | PYTHON=python3 | 14 | in "--no-args") exp=6 |
| 15 | elif which python > /dev/null | 15 | ;; "--system-wide") exp=6 |
| 16 | then | 16 | ;; "--event") exp=6 |
| 17 | PYTHON=python | 17 | ;; "--interval") exp=7 |
| 18 | else | 18 | ;; "--per-thread") exp=7 |
| 19 | echo Skipping test, python not detected please set environment variable PYTHON. | 19 | ;; "--system-wide-no-aggr") exp=7 |
| 20 | exit 2 | 20 | [ $(uname -m) = "s390x" ] && exp=6 |
| 21 | fi | 21 | ;; "--per-core") exp=8 |
| 22 | fi | 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 | } | ||
| 23 | 44 | ||
| 24 | # Return true if perf_event_paranoid is > $1 and not running as root. | 45 | # Return true if perf_event_paranoid is > $1 and not running as root. |
| 25 | function ParanoidAndNotRoot() | 46 | function ParanoidAndNotRoot() |
| @@ -30,7 +51,7 @@ function ParanoidAndNotRoot() · 4 unmodified lines | |||
| 30 | check_no_args() | 51 | check_no_args() |
| 31 | { | 52 | { |
| 32 | echo -n "Checking CSV output: no args " | 53 | 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 |
| 34 | echo "[Success]" | 55 | echo "[Success]" |
| 35 | } | 56 | } |
| 36 | 57 | ||
| @@ -42,7 +63,7 @@ check_system_wide() · 5 unmodified lines | |||
| 42 | echo "[Skip] paranoid and not root" | 63 | echo "[Skip] paranoid and not root" |
| 43 | return | 64 | return |
| 44 | fi | 65 | fi |
| 45 | perf stat -x, -a true 2>&1 | $PYTHON $pythonchecker --system-wide | 66 | perf stat -x, -a true 2>&1 | commachecker --system-wide |
| 46 | echo "[Success]" | 67 | echo "[Success]" |
| 47 | } | 68 | } |
| 48 | 69 | ||
| @@ -55,14 +76,14 @@ check_system_wide_no_aggr() · 6 unmodified lines | |||
| 55 | return | 76 | return |
| 56 | fi | 77 | fi |
| 57 | echo -n "Checking CSV output: system wide no aggregation " | 78 | 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 |
| 59 | echo "[Success]" | 80 | echo "[Success]" |
| 60 | } | 81 | } |
| 61 | 82 | ||
| 62 | check_interval() | 83 | check_interval() |
| 63 | { | 84 | { |
| 64 | echo -n "Checking CSV output: interval " | 85 | 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 |
| 66 | echo "[Success]" | 87 | echo "[Success]" |
| 67 | } | 88 | } |
| 68 | 89 | ||
| @@ -70,7 +91,7 @@ check_interval() · 1 unmodified line | |||
| 70 | check_event() | 91 | check_event() |
| 71 | { | 92 | { |
| 72 | echo -n "Checking CSV output: event " | 93 | 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 |
| 74 | echo "[Success]" | 95 | echo "[Success]" |
| 75 | } | 96 | } |
| 76 | 97 | ||
| @@ -82,7 +103,7 @@ check_per_core() · 5 unmodified lines | |||
| 82 | echo "[Skip] paranoid and not root" | 103 | echo "[Skip] paranoid and not root" |
| 83 | return | 104 | return |
| 84 | fi | 105 | 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 |
| 86 | echo "[Success]" | 107 | echo "[Success]" |
| 87 | } | 108 | } |
| 88 | 109 | ||
| @@ -94,7 +115,7 @@ check_per_thread() · 5 unmodified lines | |||
| 94 | echo "[Skip] paranoid and not root" | 115 | echo "[Skip] paranoid and not root" |
| 95 | return | 116 | return |
| 96 | fi | 117 | 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 |
| 98 | echo "[Success]" | 119 | echo "[Success]" |
| 99 | } | 120 | } |
| 100 | 121 | ||
| @@ -106,7 +127,7 @@ check_per_die() · 5 unmodified lines | |||
| 106 | echo "[Skip] paranoid and not root" | 127 | echo "[Skip] paranoid and not root" |
| 107 | return | 128 | return |
| 108 | fi | 129 | 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 |
| 110 | echo "[Success]" | 131 | echo "[Success]" |
| 111 | } | 132 | } |
| 112 | 133 | ||
| @@ -118,7 +139,7 @@ check_per_node() · 5 unmodified lines | |||
| 118 | echo "[Skip] paranoid and not root" | 139 | echo "[Skip] paranoid and not root" |
| 119 | return | 140 | return |
| 120 | fi | 141 | 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 |
| 122 | echo "[Success]" | 143 | echo "[Success]" |
| 123 | } | 144 | } |
| 124 | 145 | ||
| @@ -130,7 +151,7 @@ check_per_socket() · 5 unmodified lines | |||
| 130 | echo "[Skip] paranoid and not root" | 151 | echo "[Skip] paranoid and not root" |
| 131 | return | 152 | return |
| 132 | fi | 153 | 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 |
| 134 | echo "[Success]" | 155 | echo "[Success]" |
| 135 | } | 156 | } |
| 136 | 157 | ||
| @@ -43,7 +43,7 @@ CFLAGS="-g -O0 -fno-inline -fno-omit-frame-pointer" · 42 unmodified lines | |||
| 43 | cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1 | 43 | cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1 |
| 44 | 44 | ||
| 45 | # Add a 1 second delay to skip samples that are not in the leaf() function | 45 | # 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 & |
| 47 | PID=$! | 47 | PID=$! |
| 48 | 48 | ||
| 49 | echo " + Recording (PID=$PID)..." | 49 | echo " + Recording (PID=$PID)..." |
| @@ -115,7 +115,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map) · 114 unmodified lines | |||
| 115 | * physical_package_id will be set to -1. Hence skip this | 115 | * physical_package_id will be set to -1. Hence skip this |
| 116 | * test if physical_package_id returns -1 for cpu from perf_cpu_map. | 116 | * test if physical_package_id returns -1 for cpu from perf_cpu_map. |
| 117 | */ | 117 | */ |
| 118 | if (strncmp(session->header.env.arch, "powerpc", 7)) { | 118 | if (!strncmp(session->header.env.arch, "ppc64le", 7)) { |
| 119 | if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1) | 119 | if (cpu__get_socket_id(perf_cpu_map__cpu(map, 0)) == -1) |
| 120 | return TEST_SKIP; | 120 | return TEST_SKIP; |
| 121 | } | 121 | } |
| @@ -50,6 +50,9 @@ struct linger { · 49 unmodified lines | |||
| 50 | struct msghdr { | 50 | struct msghdr { |
| 51 | void *msg_name; /* ptr to socket address structure */ | 51 | void *msg_name; /* ptr to socket address structure */ |
| 52 | int msg_namelen; /* size of socket address structure */ | 52 | int msg_namelen; /* size of socket address structure */ |
| 53 | |||
| 54 | int msg_inq; /* output, data left in socket */ | ||
| 55 | |||
| 53 | struct iov_iter msg_iter; /* data */ | 56 | struct iov_iter msg_iter; /* data */ |
| 54 | 57 | ||
| 55 | /* | 58 | /* |
| @@ -62,8 +65,9 @@ struct msghdr { · 6 unmodified lines | |||
| 62 | void __user *msg_control_user; | 65 | void __user *msg_control_user; |
| 63 | }; | 66 | }; |
| 64 | bool msg_control_is_user : 1; | 67 | 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 */ |
| 66 | unsigned int msg_flags; /* flags on received message */ | 69 | unsigned int msg_flags; /* flags on received message */ |
| 70 | __kernel_size_t msg_controllen; /* ancillary data buffer length */ | ||
| 67 | struct kiocb *msg_iocb; /* ptr to iocb for async requests */ | 71 | struct kiocb *msg_iocb; /* ptr to iocb for async requests */ |
| 68 | }; | 72 | }; |
| 69 | 73 | ||
| @@ -434,6 +438,7 @@ extern struct file *do_accept(struct file *file, unsigned file_flags, · 364 unmodified lines | |||
| 434 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, | 438 | extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, |
| 435 | int __user *upeer_addrlen, int flags); | 439 | int __user *upeer_addrlen, int flags); |
| 436 | extern int __sys_socket(int family, int type, int protocol); | 440 | extern int __sys_socket(int family, int type, int protocol); |
| 441 | extern struct file *__sys_socket_file(int family, int type, int protocol); | ||
| 437 | extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen); | 442 | extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen); |
| 438 | extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr, | 443 | extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr, |
| 439 | int addrlen, int file_flags); | 444 | int addrlen, int file_flags); |
| @@ -387,26 +387,16 @@ static int arm_spe__synth_instruction_sample(struct arm_spe_queue *speq, · 386 unmodified lines | |||
| 387 | return arm_spe_deliver_synth_event(spe, speq, event, &sample); | 387 | return arm_spe_deliver_synth_event(spe, speq, event, &sample); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 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 | |||
| 402 | static u64 arm_spe__synth_data_source(const struct arm_spe_record *record) | 390 | static u64 arm_spe__synth_data_source(const struct arm_spe_record *record) |
| 403 | { | 391 | { |
| 404 | union perf_mem_data_src data_src = { 0 }; | 392 | union perf_mem_data_src data_src = { 0 }; |
| 405 | 393 | ||
| 406 | if (record->op == ARM_SPE_LD) | 394 | if (record->op == ARM_SPE_LD) |
| 407 | data_src.mem_op = PERF_MEM_OP_LOAD; | 395 | data_src.mem_op = PERF_MEM_OP_LOAD; |
| 408 | else | 396 | else if (record->op == ARM_SPE_ST) |
| 409 | data_src.mem_op = PERF_MEM_OP_STORE; | 397 | data_src.mem_op = PERF_MEM_OP_STORE; |
| 398 | else | ||
| 399 | return 0; | ||
| 410 | 400 | ||
| 411 | if (record->type & (ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS)) { | 401 | if (record->type & (ARM_SPE_LLC_ACCESS | ARM_SPE_LLC_MISS)) { |
| 412 | data_src.mem_lvl = PERF_MEM_LVL_L3; | 402 | 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 | |||
| 510 | return err; | 500 | return err; |
| 511 | } | 501 | } |
| 512 | 502 | ||
| 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) { | ||
| 514 | err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); | 508 | err = arm_spe__synth_mem_sample(speq, spe->memory_id, data_src); |
| 515 | if (err) | 509 | if (err) |
| 516 | return err; | 510 | return err; |
| @@ -91,7 +91,7 @@ static int literal(yyscan_t scanner) · 90 unmodified lines | |||
| 91 | } | 91 | } |
| 92 | %} | 92 | %} |
| 93 | 93 | ||
| 94 | number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+) | 94 | number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(e-?[0-9]+)? |
| 95 | 95 | ||
| 96 | sch [-,=] | 96 | sch [-,=] |
| 97 | spec \\{sch} | 97 | spec \\{sch} |
| @@ -1372,6 +1372,7 @@ static int parse_ids(bool metric_no_merge, struct perf_pmu *fake_pmu, · 1371 unmodified lines | |||
| 1372 | 1372 | ||
| 1373 | *out_evlist = NULL; | 1373 | *out_evlist = NULL; |
| 1374 | if (!metric_no_merge || hashmap__size(ids->ids) == 0) { | 1374 | if (!metric_no_merge || hashmap__size(ids->ids) == 0) { |
| 1375 | bool added_event = false; | ||
| 1375 | int i; | 1376 | int i; |
| 1376 | /* | 1377 | /* |
| 1377 | * We may fail to share events between metrics because a tool | 1378 | * 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 | |||
| 1393 | if (!tmp) | 1394 | if (!tmp) |
| 1394 | return -ENOMEM; | 1395 | return -ENOMEM; |
| 1395 | ids__insert(ids->ids, tmp); | 1396 | ids__insert(ids->ids, tmp); |
| 1397 | added_event = true; | ||
| 1396 | } | 1398 | } |
| 1397 | } | 1399 | } |
| 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 | } | ||
| 1398 | } | 1407 | } |
| 1399 | ret = metricgroup__build_event_string(&events, ids, modifier, | 1408 | ret = metricgroup__build_event_string(&events, ids, modifier, |
| 1400 | has_constraint); | 1409 | has_constraint); |
| @@ -174,7 +174,7 @@ static int elf_section_address_and_offset(int fd, const char *name, u64 *address · 173 unmodified lines | |||
| 174 | Elf *elf; | 174 | Elf *elf; |
| 175 | GElf_Ehdr ehdr; | 175 | GElf_Ehdr ehdr; |
| 176 | GElf_Shdr shdr; | 176 | GElf_Shdr shdr; |
| 177 | int ret; | 177 | int ret = -1; |
| 178 | 178 | ||
| 179 | elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); | 179 | elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); |
| 180 | if (elf == NULL) | 180 | if (elf == NULL) |