-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'perf-tools-fixes-for-v6.0-2022-09-21' of git://git.kernel.…
…org/pub/scm/linux/kernel/git/acme/linux Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix polling of system-wide events related to mixing per-cpu and per-thread events. - Do not check if /proc/modules is unchanged when copying /proc/kcore, that doesn't get in the way of post processing analysis. - Include program header in ELF files generated for JIT files, so that they can be opened by tools using elfutils libraries. - Enter namespaces when synthesizing build-ids. - Fix some bugs related to a recent cpu_map overhaul where we should be using an index and not the cpu number. - Fix BPF program ELF section name, using the naming expected by libbpf when using BPF counters in 'perf stat'. - Add a new test for perf stat cgroup BPF counter. - Adjust check on 'perf test wp' for older kernels, where the PERF_EVENT_IOC_MODIFY_ATTRIBUTES ioctl isn't supported. - Sync x86 cpufeatures with the kernel sources, no changes in tooling. * tag 'perf-tools-fixes-for-v6.0-2022-09-21' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: perf tools: Honor namespace when synthesizing build-ids tools headers cpufeatures: Sync with the kernel sources perf kcore_copy: Do not check /proc/modules is unchanged libperf evlist: Fix polling of system-wide events perf record: Fix cpu mask bit setting for mixed mmaps perf test: Skip wp modify test on old kernels perf jit: Include program header in ELF files perf test: Add a new test for perf stat cgroup BPF counter perf stat: Use evsel->core.cpus to iterate cpus in BPF cgroup counters perf stat: Fix cpu map index in bperf cgroup code perf stat: Fix BPF program section name
- Loading branch information
Showing
11 changed files
with
139 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/sh | ||
# perf stat --bpf-counters --for-each-cgroup test | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
set -e | ||
|
||
test_cgroups= | ||
if [ "$1" = "-v" ]; then | ||
verbose="1" | ||
fi | ||
|
||
# skip if --bpf-counters --for-each-cgroup is not supported | ||
check_bpf_counter() | ||
{ | ||
if ! perf stat -a --bpf-counters --for-each-cgroup / true > /dev/null 2>&1; then | ||
if [ "${verbose}" = "1" ]; then | ||
echo "Skipping: --bpf-counters --for-each-cgroup not supported" | ||
perf --no-pager stat -a --bpf-counters --for-each-cgroup / true || true | ||
fi | ||
exit 2 | ||
fi | ||
} | ||
|
||
# find two cgroups to measure | ||
find_cgroups() | ||
{ | ||
# try usual systemd slices first | ||
if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then | ||
test_cgroups="system.slice,user.slice" | ||
return | ||
fi | ||
|
||
# try root and self cgroups | ||
local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3) | ||
if [ -z ${self_cgrp} ]; then | ||
# cgroup v2 doesn't specify perf_event | ||
self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3) | ||
fi | ||
|
||
if [ -z ${self_cgrp} ]; then | ||
test_cgroups="/" | ||
else | ||
test_cgroups="/,${self_cgrp}" | ||
fi | ||
} | ||
|
||
# As cgroup events are cpu-wide, we cannot simply compare the result. | ||
# Just check if it runs without failure and has non-zero results. | ||
check_system_wide_counted() | ||
{ | ||
local output | ||
|
||
output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, sleep 1 2>&1) | ||
if echo ${output} | grep -q -F "<not "; then | ||
echo "Some system-wide events are not counted" | ||
if [ "${verbose}" = "1" ]; then | ||
echo ${output} | ||
fi | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_cpu_list_counted() | ||
{ | ||
local output | ||
|
||
output=$(perf stat -C 1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1 2>&1) | ||
if echo ${output} | grep -q -F "<not "; then | ||
echo "Some CPU events are not counted" | ||
if [ "${verbose}" = "1" ]; then | ||
echo ${output} | ||
fi | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_bpf_counter | ||
find_cgroups | ||
|
||
check_system_wide_counted | ||
check_cpu_list_counted | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters