Jakub Kicinski
be3158290d
Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
...
Andrii Nakryiko says:
====================
bpf-next 2021-12-10 v2
We've added 115 non-merge commits during the last 26 day(s) which contain
a total of 182 files changed, 5747 insertions(+), 2564 deletions(-).
The main changes are:
1) Various samples fixes, from Alexander Lobakin.
2) BPF CO-RE support in kernel and light skeleton, from Alexei Starovoitov.
3) A batch of new unified APIs for libbpf, logging improvements, version
querying, etc. Also a batch of old deprecations for old APIs and various
bug fixes, in preparation for libbpf 1.0, from Andrii Nakryiko.
4) BPF documentation reorganization and improvements, from Christoph Hellwig
and Dave Tucker.
5) Support for declarative initialization of BPF_MAP_TYPE_PROG_ARRAY in
libbpf, from Hengqi Chen.
6) Verifier log fixes, from Hou Tao.
7) Runtime-bounded loops support with bpf_loop() helper, from Joanne Koong.
8) Extend branch record capturing to all platforms that support it,
from Kajol Jain.
9) Light skeleton codegen improvements, from Kumar Kartikeya Dwivedi.
10) bpftool doc-generating script improvements, from Quentin Monnet.
11) Two libbpf v0.6 bug fixes, from Shuyi Cheng and Vincent Minet.
12) Deprecation warning fix for perf/bpf_counter, from Song Liu.
13) MAX_TAIL_CALL_CNT unification and MIPS build fix for libbpf,
from Tiezhu Yang.
14) BTF_KING_TYPE_TAG follow-up fixes, from Yonghong Song.
15) Selftests fixes and improvements, from Ilya Leoshkevich, Jean-Philippe
Brucker, Jiri Olsa, Maxim Mikityanskiy, Tirthendu Sarkar, Yucong Sun,
and others.
* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next : (115 commits)
libbpf: Add "bool skipped" to struct bpf_map
libbpf: Fix typo in btf__dedup@LIBBPF_0.0.2 definition
bpftool: Switch bpf_object__load_xattr() to bpf_object__load()
selftests/bpf: Remove the only use of deprecated bpf_object__load_xattr()
selftests/bpf: Add test for libbpf's custom log_buf behavior
selftests/bpf: Replace all uses of bpf_load_btf() with bpf_btf_load()
libbpf: Deprecate bpf_object__load_xattr()
libbpf: Add per-program log buffer setter and getter
libbpf: Preserve kernel error code and remove kprobe prog type guessing
libbpf: Improve logging around BPF program loading
libbpf: Allow passing user log setting through bpf_object_open_opts
libbpf: Allow passing preallocated log_buf when loading BTF into kernel
libbpf: Add OPTS-based bpf_btf_load() API
libbpf: Fix bpf_prog_load() log_buf logic for log_level 0
samples/bpf: Remove unneeded variable
bpf: Remove redundant assignment to pointer t
selftests/bpf: Fix a compilation warning
perf/bpf_counter: Use bpf_map_create instead of bpf_create_map
samples: bpf: Fix 'unknown warning group' build warning on Clang
samples: bpf: Fix xdp_sample_user.o linking with Clang
...
====================
Link: https://lore.kernel.org/r/20211210234746.2100561-1-andrii@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org >
2021-12-10 15:56:13 -08:00
Andrii Nakryiko
0bf40542c0
perf: Mute libbpf API deprecations temporarily
...
Libbpf development version was bumped to 0.7 in c93faaaf2f
("libbpf: Deprecate bpf_prog_load_xattr() API"), activating a bunch of
previously scheduled deprecations. Most APIs are pretty straightforward
to replace with newer APIs, but perf has a complicated mixed setup with
libbpf used both as static and shared configurations, which makes it
non-trivial to migrate the APIs.
Further, bpf_program__set_prep() needs more involved refactoring, which
will require help from Arnaldo and/or Jiri.
So for now, mute deprecation warnings and work on migrating perf off of
deprecated APIs separately with the input from owners of the perf tool.
Fixes: c93faaaf2f ("libbpf: Deprecate bpf_prog_load_xattr() API")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Link: https://lore.kernel.org/bpf/20211203004640.2455717-1-andrii@kernel.org
2021-12-03 11:54:51 -08:00
Guo Zhengkui
f08a8fccd7
perf test bpf: Use ARRAY_CHECK() instead of ad-hoc equivalent, addressing array_size.cocci warning
...
Address following coccicheck warnings:
./tools/perf/tests/bpf.c:316:22-23: WARNING: Use ARRAY_SIZE.
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexei Starovoitov <ast@kernel.org >
Cc: Andrii Nakryiko <andrii@kernel.org >
Cc: Daniel Borkmann <daniel@iogearbox.net >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: John Fastabend <john.fastabend@gmail.com >
Cc: KP Singh <kpsingh@kernel.org >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Martin KaFai Lau <kafai@fb.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Riccardo Mancini <rickyman7@gmail.com >
Cc: Song Liu <songliubraving@fb.com >
Cc: Thomas Richter <tmricht@linux.ibm.com >
Cc: Yonghong Song <yhs@fb.com >
Cc: bpf@vger.kernel.org
Cc: kernel@vivo.com
Cc: netdev@vger.kernel.org
Link: http://lore.kernel.org/lkml/20211108070801.5540-1-guozhengkui@vivo.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-13 18:11:51 -03:00
Ian Rogers
b47d2fb40f
perf test: Remove skip_if_fail
...
Remove optionality, always run tests in a suite even if one fails. This
brings perf's test more inline with kunit that lacks this notion.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Brendan Higgins <brendanhiggins@google.com >
Cc: Daniel Latypov <dlatypov@google.com >
Cc: David Gow <davidgow@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jin Yao <yao.jin@linux.intel.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20211104064208.3156807-23-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-13 18:11:50 -03:00
Ian Rogers
5801e96b88
perf test: Convert bpf tests to test cases.
...
Use null terminated array of test cases rather than the previous sub
test functions.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Brendan Higgins <brendanhiggins@google.com >
Cc: Daniel Latypov <dlatypov@google.com >
Cc: David Gow <davidgow@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jin Yao <yao.jin@linux.intel.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20211104064208.3156807-14-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-13 18:11:49 -03:00
Ian Rogers
33f44bfd3c
perf test: Rename struct test to test_suite
...
This is to align with kunit's terminology.
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Brendan Higgins <brendanhiggins@google.com >
Cc: Daniel Latypov <dlatypov@google.com >
Cc: David Gow <davidgow@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jin Yao <yao.jin@linux.intel.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20211104064208.3156807-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-13 10:32:22 -03:00
Ian Rogers
d68f036508
perf test: Move each test suite struct to its test
...
Rather than export test functions, export the test struct. Rename with a
suite__ prefix to avoid name collisions.
Committer notes:
Its '&suite__vectors_page', not '&suite__vectors_pages', noticed when
cross building to arm (32-bit).
Signed-off-by: Ian Rogers <irogers@google.com >
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com >
Acked-by: Jiri Olsa <jolsa@redhat.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Brendan Higgins <brendanhiggins@google.com >
Cc: Daniel Latypov <dlatypov@google.com >
Cc: David Gow <davidgow@google.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: Jin Yao <yao.jin@linux.intel.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Paul Clarke <pc@us.ibm.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: https://lore.kernel.org/r/20211104064208.3156807-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-13 10:30:58 -03:00
Ian Rogers
07eafd4e05
perf parse-event: Add init and exit to parse_event_error
...
parse_events() may succeed but leave string memory allocations reachable
in the error.
Add an init/exit that must be called to initialize and clean up the
error. This fixes a leak in metricgroup parse_ids.
Signed-off-by: Ian Rogers <irogers@google.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: John Garry <john.garry@huawei.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Stephane Eranian <eranian@google.com >
Link: http://lore.kernel.org/lkml/20211107090002.3784612-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-11-07 15:39:25 -03:00
Michael Petlan
3e11300cdf
perf test: Fix bpf test sample mismatch reporting
...
When the expected sample count in the condition changed, the message
needs to be changed too, otherwise we'll get:
0x1001f2091d8: mmap mask[0]:
BPF filter result incorrect, expected 56, got 56 samples
Fixes: 4b04e0decd ("perf test: Fix basic bpf filtering test")
Signed-off-by: Michael Petlan <mpetlan@redhat.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com >
Link: https //lore.kernel.org/r/20210805160611.5542-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-09-10 11:45:19 -03:00
Riccardo Mancini
937654ce49
perf test bpf: Free obj_buf
...
ASan reports some memory leaks when running:
# perf test "42: BPF filter"
The first of these leaks is caused by obj_buf never being deallocated in
__test__bpf.
This patch adds the missing free.
Signed-off-by: Riccardo Mancini <rickyman7@gmail.com >
Fixes: ba1fae431e ("perf test: Add 'perf test BPF'")
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lore.kernel.org/lkml/60f3ca935fe6672e7e866276ce6264c9e26e4c87.1626343282.git.rickyman7@gmail.com
[ Added missing stdlib.h include ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-07-16 13:50:30 -03:00
Jiri Olsa
3a683120d8
libperf: Move 'nr_groups' from tools/perf to evlist::nr_groups
...
Move evsel::nr_groups to perf_evsel::nr_groups, so we can move the group
interface to libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Requested-by: Shunsuke Nakamura <nakamura.shun@fujitsu.com >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Mark Rutland <mark.rutland@arm.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20210706151704.73662-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-07-09 14:04:32 -03:00
Thomas Richter
eb8f998bbc
perf test: Remove now useless failing sub test "BPF relocation checker"
...
For some time now the 'perf test 42: BPF filter' returns an error on bpf
relocation subtest, at least on x86 and s390. This is caused by
d859900c4c ("bpf, libbpf: support global data/bss/rodata sections")
which introduces support for global variables in eBPF programs.
Perf test 42.4 checks that the eBPF relocation fails when the eBPF program
contains a global variable. It returns OK when the eBPF program
could not be loaded and FAILED otherwise.
With above commit the test logic for the eBPF relocation is obsolete.
The loading of the eBPF now succeeds and the test always shows FAILED.
This patch removes the sub test completely.
Also a lot of eBPF program testing is done in the eBPF test suite,
it also contains tests for global variables.
Output before:
42: BPF filter :
42.1: Basic BPF filtering : Ok
42.2: BPF pinning : Ok
42.3: BPF prologue generation : Ok
42.4: BPF relocation checker : Failed
#
Output after:
# ./perf test -F 42
42: BPF filter :
42.1: Basic BPF filtering : Ok
42.2: BPF pinning : Ok
42.3: BPF prologue generation : Ok
#
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com >
Cc: Sven Schnelle <svens@linux.ibm.com >
Cc: Vasily Gorbik <gor@linux.ibm.com >
Link: http://lore.kernel.org/lkml/20210324083734.1953123-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2021-03-24 10:33:03 -03:00
Arnaldo Carvalho de Melo
78e1bc2578
perf evlist: Use the right prefix for 'struct evlist' event attribute config methods
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-11-30 15:15:27 -03:00
Arnaldo Carvalho de Melo
606e2c2933
perf evlist: Use the right prefix for alternative 'struct evlist' constructors
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-11-30 15:04:05 -03:00
Arnaldo Carvalho de Melo
7748bb7175
perf evlist: Use the right prefix for 'struct evlist' create maps methods
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-11-30 14:56:52 -03:00
Arnaldo Carvalho de Melo
e414fd1a3f
perf evlist: Use the right prefix for 'struct evlist' evsel list methods
...
perf_evlist__ is for 'struct perf_evlist' methods, in tools/lib/perf/,
go on completing this split.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-11-30 14:52:44 -03:00
Arnaldo Carvalho de Melo
38219f2411
perf tests: Skip the llvm and bpf tests if HAVE_LIBBPF_SUPPORT isn't defined
...
If either NO_LIBBPF=1 is passed, explicitely disabling it or if libbpf
is not available due to some missing dependency, skip its tests, telling
the user the feature isn't available.
# perf test
<SNIP>
40: LLVM search and compile : Skip (not compiled in)
41: Session topology : Ok
42: BPF filter : Skip (not compiled in)
<SNIP>
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Ian Rogers <irogers@google.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-11-04 09:42:41 -03:00
Sumanth Korikkar
4b04e0decd
perf test: Fix basic bpf filtering test
...
BPF basic filtering test fails on s390x (when vmlinux debuginfo is
utilized instead of /proc/kallsyms)
Info:
- bpf_probe_load installs the bpf code at do_epoll_wait.
- For s390x, do_epoll_wait resolves to 3 functions including inlines.
found inline addr: 0x43769e
Probe point found: __s390_sys_epoll_wait+6
found inline addr: 0x437290
Probe point found: do_epoll_wait+0
found inline addr: 0x4375d6
Probe point found: __se_sys_epoll_wait+6
- add_bpf_event creates evsel for every probe in a BPF object. This
results in 3 evsels.
Solution:
- Expected result = 50% of the samples to be collected from epoll_wait *
number of entries present in the evlist.
Committer testing:
# perf test 42
42: BPF filter :
42.1: Basic BPF filtering : Ok
42.2: BPF pinning : Ok
42.3: BPF prologue generation : Ok
42.4: BPF relocation checker : Ok
#
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com >
Reviewed-by: Thomas Richter <tmricht@linux.ibm.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: bpf@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Sven Schnelle <svens@linux.ibm.com >
LPU-Reference: 20200817072754.58344-1-sumanthk@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2020-08-21 10:22:23 -03:00
Jiri Olsa
151ed5d70d
libperf: Adopt perf_mmap__read_event() from tools/perf
...
Move perf_mmap__read_event() from tools/perf to libperf and export it in
the perf/mmap.h header.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191007125344.14268-13-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-10-10 11:49:46 -03:00
Jiri Olsa
32fdc2ca7e
libperf: Adopt perf_mmap__read_done() from tools/perf
...
Move perf_mmap__read_init() from tools/perf to libperf and export it in
the perf/mmap.h header.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191007125344.14268-12-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-10-10 11:45:32 -03:00
Jiri Olsa
7c4d41824f
libperf: Adopt perf_mmap__read_init() from tools/perf
...
Move perf_mmap__read_init() from tools/perf to libperf and export it in
perf/mmap.h header.
And add pr_debug2()/pr_debug3() macros support, because the code is
using them.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191007125344.14268-11-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-10-10 11:45:21 -03:00
Jiri Olsa
7728fa0cfa
libperf: Adopt perf_mmap__consume() function from tools/perf
...
Move perf_mmap__consume() vrom tools/perf to libperf and export it in
the perf/mmap.h header.
Move also the needed helpers perf_mmap__write_tail(),
perf_mmap__read_head() and perf_mmap__empty().
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lore.kernel.org/lkml/20191007125344.14268-10-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-10-10 11:43:49 -03:00
Jiri Olsa
c976ee11a0
libperf: Move 'nr_mmaps' from 'struct evlist' to 'struct perf_evlist'
...
Moving 'nr_mmaps' from 'struct evlist' to 'struct perf_evlist', it will
be used in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-21-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:47 -03:00
Arnaldo Carvalho de Melo
e0fcfb086f
perf evlist: Adopt backwards ring buffer state enum
...
As this isn't used at all in mmap.h but in evlist.h, so to cut down the
header dependency tree, move it to where it is used.
Also add mmap.h to the places using it but previously getting it
indirectly via evlist.h.
Add missing pthread.h to evlist.h, as it has a pthread_t struct member
and was getting the header via mmap.h.
Noticed while processing a Jiri's libperf batch touching mmap.h, where
almost everything gets rebuilt because evlist.h is so popular, so cut
down't this rebuild the world party.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Song Liu <songliubraving@fb.com >
Link: https://lkml.kernel.org/n/tip-he0uljeftl0xfveh3d6vtode@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:45 -03:00
Jiri Olsa
9521b5f2d9
perf tools: Rename perf_evlist__mmap() to evlist__mmap()
...
Rename perf_evlist__mmap() to evlist__mmap(), so we don't have a name
clash when we add perf_evlist__mmap() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:44 -03:00
Jiri Olsa
a583053299
perf tools: Rename 'struct perf_mmap' to 'struct mmap'
...
Rename 'struct perf_evlist' to 'struct evlist', so we don't have a name
clash when we add 'struct perf_mmap' to libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl >
Link: http://lore.kernel.org/lkml/20190913132355.21634-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-09-25 09:51:44 -03:00
Arnaldo Carvalho de Melo
f2a39fe849
perf auxtrace: Uninline functions that touch perf_session
...
So that we don't carry the session.h include directive in auxtrace.h,
which in turn opens a can of worms of files that were getting all sorts
of things via that include, fix them all.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-d2d83aovpgri2z75wlitquni@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-31 22:24:10 -03:00
Arnaldo Carvalho de Melo
8520a98dba
perf debug: Remove needless include directives from debug.h
...
All we need there is a forward declaration for 'union perf_event', so
remove it from there and add missing header directives in places using
things from this indirect include.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-7ftk0ztstqub1tirjj8o8xbl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-31 19:10:19 -03:00
Arnaldo Carvalho de Melo
aeb00b1aea
perf record: Move record_opts and other record decls out of perf.h
...
And into a separate util/record.h, to better isolate things and make
sure that those who use record_opts and the other moved declarations
are explicitly including the necessary header.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-31q8mei1qkh74qvkl9nwidfq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-08-26 11:58:22 -03:00
Jiri Olsa
e74676deba
perf evlist: Rename perf_evlist__disable() to evlist__disable()
...
Rename perf_evlist__disable() to evlist__disable(), so we don't have a
name clash when we add perf_evlist__disable() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-23-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
1c87f1654c
perf evlist: Rename perf_evlist__enable() to evlist__enable()
...
Rename perf_evlist__enable() to evlist__enable(), so we don't have a
name clash when we add perf_evlist__enable() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-22-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
474ddc4c46
perf evlist: Rename perf_evlist__open() to evlist__open()
...
Rename perf_evlist__open() to evlist__open(), so we don't have a name
clash when we add perf_evlist__open() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-20-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
c12995a554
perf evlist: Rename perf_evlist__delete() to evlist__delete()
...
Rename perf_evlist__delete() to evlist__delete(), so we don't have a
name clash when we add perf_evlist__delete() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-10-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
0f98b11c61
perf evlist: Rename perf_evlist__new() to evlist__new()
...
Rename perf_evlist__new() to evlist__new(), so we don't have a name
clash when we add perf_evlist__new() in libperf.
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:43 -03:00
Jiri Olsa
63503dba87
perf evlist: Rename struct perf_evlist to struct evlist
...
Rename struct perf_evlist to struct evlist, so we don't have a name
clash when we add struct perf_evlist in libperf.
Committer notes:
Added fixes to build on arm64, from Jiri and from me
(tools/perf/util/cs-etm.c)
Signed-off-by: Jiri Olsa <jolsa@kernel.org >
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com >
Cc: Alexey Budankov <alexey.budankov@linux.intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20190721112506.12306-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-07-29 18:34:42 -03:00
Arnaldo Carvalho de Melo
5875cf4cd3
perf tests: Add missing SPDX headers
...
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: https://lkml.kernel.org/n/tip-p0kg493z2m8qizjbdefzip1i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2019-06-17 15:57:19 -03:00
Kan Liang
b9bae2c841
perf mmap: Simplify perf_mmap__read_init()
...
It isn't necessary to pass the 'start', 'end' and 'overwrite' arguments
to perf_mmap__read_init(). The data is stored in the struct perf_mmap.
Discard the parameters.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1520350567-80082-8-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-08 10:05:53 -03:00
Kan Liang
0019dc87b9
perf mmap: Simplify perf_mmap__read_event()
...
It isn't necessary to pass the 'overwrite', 'start' and 'end' argument
to perf_mmap__read_event(). Discard them.
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Acked-by: Jiri Olsa <jolsa@kernel.org >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1520350567-80082-7-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-08 10:05:53 -03:00
Kan Liang
2f54f3a473
perf test: Switch to new perf_mmap__read_event() interface for bpf
...
The perf test 'bpf' still use the legacy interface.
No functional change.
Committer notes:
Tested with:
# perf test bpf
39: BPF filter :
39.1: Basic BPF filtering : Ok
39.2: BPF pinning : Ok
39.3: BPF prologue generation : Ok
39.4: BPF relocation checker : Ok
#
Signed-off-by: Kan Liang <kan.liang@linux.intel.com >
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com >
Cc: Andi Kleen <ak@linux.intel.com >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/r/1519945751-37786-4-git-send-email-kan.liang@linux.intel.com
[ Changed bool parameters from 0 to 'false', as per Jiri comment ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-03-05 10:47:54 -03:00
Arnaldo Carvalho de Melo
bafae98e7a
perf evlist: Remove fcntl.h from evlist.h
...
Not needed there, fixup the places where it is needed and was getting
only by luck via evlist.h.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: https://lkml.kernel.org/n/tip-yxjpetn64z8vjuguu84gr6x6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-01-25 06:37:30 -03:00
Arnaldo Carvalho de Melo
e0337f4f9a
perf test bpf: Hook on epoll_pwait()
...
The 'perf test bpf' was hooking a eBPF program on the SyS_epoll_wait()
kernel function, that was what the epoll_wait() glibc function ended up
calling, but since at least glibc 2.26, the one that comes with, for
instance, Fedora 27, glibc ends up calling SyS_epoll_pwait() when
epoll_wait() is used, causing this 'perf test' entry to fail.
So switch to using epoll_pwait() and hook the eBPF program to the
SyS_epoll_pwait() kernel function to make it work on a wider range of
glibc and kernel versions.
Tested-by: Wang Nan <wangnan0@huawei.com >
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Link: https://lkml.kernel.org/n/tip-zynvquy63er8s5mrgsz65pto@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-01-08 11:11:57 -03:00
Arnaldo Carvalho de Melo
13cb2d0f51
perf test bpf: Use designated struct field initializers
...
To follow standard practice in the kernel sources, documenting the
initialization better and helping quickly finding the value for some
field in a struct with many entries.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: https://lkml.kernel.org/n/tip-syn3hz9hz7ukxlxbx5x6hv20@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-01-08 11:11:56 -03:00
Arnaldo Carvalho de Melo
6703c9771d
perf test bpf: Improve message about expected samples
...
When failing on one of the BPF tests we were just stating:
BPF filter result incorrect
Add some more info to help figuring out the problem:
BPF filter result incorrect, expected 56, got 0 samples
This came out while investigating this failure, first seen after
updating the kernel to the 4.15.0-rc6 tag:
[root@jouet ~]# perf test bpf
39: BPF filter :
39.1: Basic BPF filtering : FAILED!
39.2: BPF pinning : Skip
39.3: BPF prologue generation: Skip
39.4: BPF relocation checker : Skip
[root@jouet ~]#
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: https://lkml.kernel.org/n/tip-403npu7daupv6b2bmxliv5pk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2018-01-08 11:11:56 -03:00
Wang Nan
f74b9d3a1a
perf evlist: Remove 'overwrite' parameter from perf_evlist__mmap
...
Now all perf_evlist__mmap's users doesn't set 'overwrite'. Remove it
from arguments list.
Signed-off-by: Wang Nan <wangnan0@huawei.com >
Acked-by: Namhyung Kim <namhyung@kernel.org >
Cc: Jiri Olsa <jolsa@redhat.com >
Cc: Kan Liang <kan.liang@intel.com >
Link: http://lkml.kernel.org/r/20171203020044.81680-2-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-12-05 15:43:53 -03:00
Arnaldo Carvalho de Melo
5d9cdc1181
perf events parse: Rename parse_events_parse arguments
...
Calling them just "data" is too vague, call it 'perf_state', to make it
clearer, for instance, when looking at patch hunks.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-rnhk5yb05wem77rjpclrh7so@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-08-17 16:39:15 -03:00
Arnaldo Carvalho de Melo
5d369a75ed
perf events parse: Rename parsing state struct to clearer name
...
Rename it from 'parse_events_evlist' to 'parse_events_state' to better
state that this is parsing state that has to be passed around.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-dursqtg2h2w98ztaa297u43x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-08-17 16:39:15 -03:00
Arnaldo Carvalho de Melo
81f17c90f1
perf test: Add 'struct test *' to the test functions
...
This way we'll be able to pass more test specific parameters without
having to change this function signature.
Will be used by the upcoming 'shell tests', shell scripts that will
call perf tools and check if they work as expected, comparing its
effects on the system (think 'perf probe foo') the output produced, etc.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Michael Petlan <mpetlan@redhat.com >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-wq250w7j1opbzyiynozuajbl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-08-11 10:42:53 -03:00
Arnaldo Carvalho de Melo
7a8ef4c4b5
perf tools: Remove string.h, unistd.h and sys/stat.h from util.h
...
Not needed in this header, added to the places that need FILE,
putchar(), access() and a few other prototypes.
Link: http://lkml.kernel.org/n/tip-xxtdsl6nsna82j7puwbdjqhs@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-04-24 13:43:33 -03:00
Arnaldo Carvalho de Melo
a43783aeec
perf tools: Include errno.h where needed
...
Removing it from util.h, part of an effort to disentangle the includes
hell, that makes changes to util.h or something included by it to cause
a complete rebuild of the tools.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-ztrjy52q1rqcchuy3rubfgt2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-04-19 13:01:51 -03:00
Arnaldo Carvalho de Melo
877a7a1105
perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used
...
To pave the way for further cleanups where linux/kernel.h may stop being
included in some header.
Cc: Adrian Hunter <adrian.hunter@intel.com >
Cc: David Ahern <dsahern@gmail.com >
Cc: Jiri Olsa <jolsa@kernel.org >
Cc: Namhyung Kim <namhyung@kernel.org >
Cc: Wang Nan <wangnan0@huawei.com >
Link: http://lkml.kernel.org/n/tip-qqxan6tfsl6qx3l0v3nwgjvk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com >
2017-04-19 13:01:44 -03:00