diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-30 14:15:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-30 14:15:14 -0500 |
commit | d8b91dde38f4c43bd0bbbf17a90f735b16aaff2c (patch) | |
tree | bd72dabf6e4b23e060fce429c87e60504f69de54 /tools/perf/tests/bpf.c | |
parent | 5e7481a25e90b661d1dbbba18be3fd3dfe12ec6f (diff) | |
parent | e4c1091cb495d9cbec8956d642644a71a1689958 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"Kernel side changes:
- Clean up the x86 instruction decoder (Masami Hiramatsu)
- Add new uprobes optimization for PUSH instructions on x86 (Yonghong
Song)
- Add MSR_IA32_THERM_STATUS to the MSR events (Stephane Eranian)
- Fix misc bugs, update documentation, plus various cleanups (Jiri
Olsa)
There's a large number of tooling side improvements:
- Intel-PT/BTS improvements (Adrian Hunter)
- Numerous 'perf trace' improvements (Arnaldo Carvalho de Melo)
- Introduce an errno code to string facility (Hendrik Brueckner)
- Various build system improvements (Jiri Olsa)
- Add support for CoreSight trace decoding by making the perf tools
use the external openCSD (Mathieu Poirier, Tor Jeremiassen)
- Add ARM Statistical Profiling Extensions (SPE) support (Kim
Phillips)
- libtraceevent updates (Steven Rostedt)
- Intel vendor event JSON updates (Andi Kleen)
- Introduce 'perf report --mmaps' and 'perf report --tasks' to show
info present in 'perf.data' (Jiri Olsa, Arnaldo Carvalho de Melo)
- Add infrastructure to record first and last sample time to the
perf.data file header, so that when processing all samples in a
'perf record' session, such as when doing build-id processing, or
when specifically requesting that that info be recorded, use that
in 'perf report --time', that also got support for percent slices
in addition to absolute ones.
I.e. now it is possible to ask for the samples in the 10%-20% time
slice of a perf.data file (Jin Yao)
- Allow system wide 'perf stat --per-thread', sorting the result (Jin
Yao)
E.g.:
[root@jouet ~]# perf stat --per-thread --metrics IPC
^C
Performance counter stats for 'system wide':
make-22229 23,012,094,032 inst_retired.any # 0.8 IPC
cc1-22419 692,027,497 inst_retired.any # 0.8 IPC
gcc-22418 328,231,855 inst_retired.any # 0.9 IPC
cc1-22509 220,853,647 inst_retired.any # 0.8 IPC
gcc-22486 199,874,810 inst_retired.any # 1.0 IPC
as-22466 177,896,365 inst_retired.any # 0.9 IPC
cc1-22465 150,732,374 inst_retired.any # 0.8 IPC
gcc-22508 112,555,593 inst_retired.any # 0.9 IPC
cc1-22487 108,964,079 inst_retired.any # 0.7 IPC
qemu-system-x86-2697 21,330,550 inst_retired.any # 0.3 IPC
systemd-journal-551 20,642,951 inst_retired.any # 0.4 IPC
docker-containe-17651 9,552,892 inst_retired.any # 0.5 IPC
dockerd-current-9809 7,528,586 inst_retired.any # 0.5 IPC
make-22153 12,504,194,380 inst_retired.any # 0.8 IPC
python2-22429 12,081,290,954 inst_retired.any # 0.8 IPC
<SNIP>
python2-22429 15,026,328,103 cpu_clk_unhalted.thread
cc1-22419 826,660,193 cpu_clk_unhalted.thread
gcc-22418 365,321,295 cpu_clk_unhalted.thread
cc1-22509 279,169,362 cpu_clk_unhalted.thread
gcc-22486 210,156,950 cpu_clk_unhalted.thread
<SNIP>
5.638075538 seconds time elapsed
[root@jouet ~]#
- Improve shell auto-completion of perf events (Jin Yao)
- 'perf probe' improvements (Masami Hiramatsu)
- Improve PMU infrastructure to support amp64's ThunderX2
implementation defined core events (Ganapatrao Kulkarni)
- Various annotation related improvements and fixes (Thomas Richter)
- Clarify usage of 'overwrite' and 'backward' in the evlist/mmap
code, removing the 'overwrite' parameter from several functions as
it was always used it as 'false' (Wang Nan)
- Fix/improve 'perf record' reverse recording support (Wang Nan)
- Improve command line options documentation (Sihyeon Jang)
- Optimize sample parsing for ordering events, where we don't need to
parse all the PERF_SAMPLE_ bits, just the ones leading to the
timestamp needed to reorder events (Jiri Olsa)
- Generalize the annotation code to support other source information
besides objdump/DWARF obtained ones, starting with python scripts,
that will is slated to be merged soon (Jiri Olsa)
- ... and a lot more that I failed to list, see the shortlog and
changelog for details"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (262 commits)
perf trace beauty flock: Move to separate object file
perf evlist: Remove fcntl.h from evlist.h
perf trace beauty futex: Beautify FUTEX_BITSET_MATCH_ANY
perf trace: Do not print from time delta for interrupted syscall lines
perf trace: Add --print-sample
perf bpf: Remove misplaced __maybe_unused attribute
MAINTAINERS: Adding entry for CoreSight trace decoding
perf tools: Add mechanic to synthesise CoreSight trace packets
perf tools: Add full support for CoreSight trace decoding
pert tools: Add queue management functionality
perf tools: Add functionality to communicate with the openCSD decoder
perf tools: Add support for decoding CoreSight trace data
perf tools: Add decoder mechanic to support dumping trace data
perf tools: Add processing of coresight metadata
perf tools: Add initial entry point for decoder CoreSight traces
perf tools: Integrating the CoreSight decoding library
perf vendor events intel: Update IvyTown files to V20
perf vendor events intel: Update IvyBridge files to V20
perf vendor events intel: Update BroadwellDE events to V7
perf vendor events intel: Update SkylakeX events to V1.06
...
Diffstat (limited to 'tools/perf/tests/bpf.c')
-rw-r--r-- | tools/perf/tests/bpf.c | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c index 34c22cdf4d5d..e8399beca62b 100644 --- a/tools/perf/tests/bpf.c +++ b/tools/perf/tests/bpf.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <sys/epoll.h> | 3 | #include <sys/epoll.h> |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | #include <fcntl.h> | ||
6 | #include <util/util.h> | 7 | #include <util/util.h> |
7 | #include <util/bpf-loader.h> | 8 | #include <util/bpf-loader.h> |
8 | #include <util/evlist.h> | 9 | #include <util/evlist.h> |
@@ -19,13 +20,13 @@ | |||
19 | 20 | ||
20 | #ifdef HAVE_LIBBPF_SUPPORT | 21 | #ifdef HAVE_LIBBPF_SUPPORT |
21 | 22 | ||
22 | static int epoll_wait_loop(void) | 23 | static int epoll_pwait_loop(void) |
23 | { | 24 | { |
24 | int i; | 25 | int i; |
25 | 26 | ||
26 | /* Should fail NR_ITERS times */ | 27 | /* Should fail NR_ITERS times */ |
27 | for (i = 0; i < NR_ITERS; i++) | 28 | for (i = 0; i < NR_ITERS; i++) |
28 | epoll_wait(-(i + 1), NULL, 0, 0); | 29 | epoll_pwait(-(i + 1), NULL, 0, 0, NULL); |
29 | return 0; | 30 | return 0; |
30 | } | 31 | } |
31 | 32 | ||
@@ -63,46 +64,41 @@ static struct { | |||
63 | bool pin; | 64 | bool pin; |
64 | } bpf_testcase_table[] = { | 65 | } bpf_testcase_table[] = { |
65 | { | 66 | { |
66 | LLVM_TESTCASE_BASE, | 67 | .prog_id = LLVM_TESTCASE_BASE, |
67 | "Basic BPF filtering", | 68 | .desc = "Basic BPF filtering", |
68 | "[basic_bpf_test]", | 69 | .name = "[basic_bpf_test]", |
69 | "fix 'perf test LLVM' first", | 70 | .msg_compile_fail = "fix 'perf test LLVM' first", |
70 | "load bpf object failed", | 71 | .msg_load_fail = "load bpf object failed", |
71 | &epoll_wait_loop, | 72 | .target_func = &epoll_pwait_loop, |
72 | (NR_ITERS + 1) / 2, | 73 | .expect_result = (NR_ITERS + 1) / 2, |
73 | false, | ||
74 | }, | 74 | }, |
75 | { | 75 | { |
76 | LLVM_TESTCASE_BASE, | 76 | .prog_id = LLVM_TESTCASE_BASE, |
77 | "BPF pinning", | 77 | .desc = "BPF pinning", |
78 | "[bpf_pinning]", | 78 | .name = "[bpf_pinning]", |
79 | "fix kbuild first", | 79 | .msg_compile_fail = "fix kbuild first", |
80 | "check your vmlinux setting?", | 80 | .msg_load_fail = "check your vmlinux setting?", |
81 | &epoll_wait_loop, | 81 | .target_func = &epoll_pwait_loop, |
82 | (NR_ITERS + 1) / 2, | 82 | .expect_result = (NR_ITERS + 1) / 2, |
83 | true, | 83 | .pin = true, |
84 | }, | 84 | }, |
85 | #ifdef HAVE_BPF_PROLOGUE | 85 | #ifdef HAVE_BPF_PROLOGUE |
86 | { | 86 | { |
87 | LLVM_TESTCASE_BPF_PROLOGUE, | 87 | .prog_id = LLVM_TESTCASE_BPF_PROLOGUE, |
88 | "BPF prologue generation", | 88 | .desc = "BPF prologue generation", |
89 | "[bpf_prologue_test]", | 89 | .name = "[bpf_prologue_test]", |
90 | "fix kbuild first", | 90 | .msg_compile_fail = "fix kbuild first", |
91 | "check your vmlinux setting?", | 91 | .msg_load_fail = "check your vmlinux setting?", |
92 | &llseek_loop, | 92 | .target_func = &llseek_loop, |
93 | (NR_ITERS + 1) / 4, | 93 | .expect_result = (NR_ITERS + 1) / 4, |
94 | false, | ||
95 | }, | 94 | }, |
96 | #endif | 95 | #endif |
97 | { | 96 | { |
98 | LLVM_TESTCASE_BPF_RELOCATION, | 97 | .prog_id = LLVM_TESTCASE_BPF_RELOCATION, |
99 | "BPF relocation checker", | 98 | .desc = "BPF relocation checker", |
100 | "[bpf_relocation_test]", | 99 | .name = "[bpf_relocation_test]", |
101 | "fix 'perf test LLVM' first", | 100 | .msg_compile_fail = "fix 'perf test LLVM' first", |
102 | "libbpf error when dealing with relocation", | 101 | .msg_load_fail = "libbpf error when dealing with relocation", |
103 | NULL, | ||
104 | 0, | ||
105 | false, | ||
106 | }, | 102 | }, |
107 | }; | 103 | }; |
108 | 104 | ||
@@ -167,7 +163,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), | |||
167 | goto out_delete_evlist; | 163 | goto out_delete_evlist; |
168 | } | 164 | } |
169 | 165 | ||
170 | err = perf_evlist__mmap(evlist, opts.mmap_pages, false); | 166 | err = perf_evlist__mmap(evlist, opts.mmap_pages); |
171 | if (err < 0) { | 167 | if (err < 0) { |
172 | pr_debug("perf_evlist__mmap: %s\n", | 168 | pr_debug("perf_evlist__mmap: %s\n", |
173 | str_error_r(errno, sbuf, sizeof(sbuf))); | 169 | str_error_r(errno, sbuf, sizeof(sbuf))); |
@@ -190,7 +186,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), | |||
190 | } | 186 | } |
191 | 187 | ||
192 | if (count != expect) { | 188 | if (count != expect) { |
193 | pr_debug("BPF filter result incorrect\n"); | 189 | pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count); |
194 | goto out_delete_evlist; | 190 | goto out_delete_evlist; |
195 | } | 191 | } |
196 | 192 | ||