alistair23-linux/tools/perf/tests
Song Liu d56354dc49 perf tools: Save bpf_prog_info and BTF of new BPF programs
To fully annotate BPF programs with source code mapping, 4 different
information are needed:

    1) PERF_RECORD_KSYMBOL
    2) PERF_RECORD_BPF_EVENT
    3) bpf_prog_info
    4) btf

This patch handles 3) and 4) for BPF programs loaded after 'perf
record|top'.

For timely process of these information, a dedicated event is added to
the side band evlist.

When PERF_RECORD_BPF_EVENT is received via the side band event, the
polling thread gathers 3) and 4) vis sys_bpf and store them in perf_env.

This information is saved to perf.data at the end of 'perf record'.

Committer testing:

The 'wakeup_watermark' member in 'struct perf_event_attr' is inside a
unnamed union, so can't be used in a struct designated initialization
with older gccs, get it out of that, isolating as 'attr.wakeup_watermark
= 1;' to work with all gcc versions.

We also need to add '--no-bpf-event' to the 'perf record'
perf_event_attr tests in 'perf test', as the way that that test goes is
to intercept the events being setup and looking if they match the fields
described in the control files, since now it finds first the side band
event used to catch the PERF_RECORD_BPF_EVENT, they all fail.

With these issues fixed:

Same scenario as for testing BPF programs loaded before 'perf record' or
'perf top' starts, only start the BPF programs after 'perf record|top',
so that its information get collected by the sideband threads, the rest
works as for the programs loaded before start monitoring.

Add missing 'inline' to the bpf_event__add_sb_event() when
HAVE_LIBBPF_SUPPORT is not defined, fixing the build in systems without
binutils devel files installed.

Signed-off-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislav Fomichev <sdf@google.com>
Link: http://lkml.kernel.org/r/20190312053051.2690567-16-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-03-21 11:27:04 -03:00
..
attr perf tools: Save bpf_prog_info and BTF of new BPF programs 2019-03-21 11:27:04 -03:00
shell perf tests shell: Skip trace+probe_vfs_getname.sh if built without trace support 2019-02-15 13:42:26 -03:00
.gitignore
attr.c perf tools: Fix diverse comment typos 2018-12-17 14:56:47 -03:00
attr.py perf script python: Add Python3 support to tests/attr.py 2019-02-05 10:31:08 -03:00
backward-ring-buffer.c perf tools: Fix errors under optimization level '-Og' 2019-03-19 16:52:04 -03:00
bitmap.c
bp_account.c perf tools: Remove duplicate headers 2019-01-21 15:15:57 -03:00
bp_signal.c perf tests ARM: Disable breakpoint tests 32-bit 2018-12-17 14:56:27 -03:00
bp_signal_overflow.c
bpf-script-example.c
bpf-script-test-kbuild.c
bpf-script-test-prologue.c
bpf-script-test-relocation.c
bpf.c
Build perf test: Add watchpoint test 2018-09-18 17:21:13 -03:00
builtin-test.c perf tests: Use shebangs in the shell scripts 2018-12-18 12:21:44 -03:00
clang.c
code-reading.c perf tools: Add missing include for symbols.h 2019-02-06 10:00:38 -03:00
cpumap.c
dso-data.c
dwarf-unwind.c perf tools: Add missing include for symbols.h 2019-02-06 10:00:38 -03:00
event-times.c
event_update.c
evsel-roundtrip-name.c
evsel-tp-sched.c perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() 2019-03-19 16:52:06 -03:00
expr.c perf tests: Fix memory leak by expr__find_other() in test__expr() 2019-03-19 16:52:05 -03:00
fdarray.c
hists_common.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
hists_common.h
hists_cumulate.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
hists_filter.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
hists_link.c perf hist: Use cached rbtrees 2019-01-25 15:12:10 +01:00
hists_output.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
is_printable_array.c
keep-tracking.c
kmod-path.c perf tools: Remove ext from struct kmod_path 2018-08-20 08:54:59 -03:00
llvm.c
llvm.h
make
mem.c
mem2node.c
mmap-basic.c
mmap-thread-lookup.c pref tools: Add missing map.h includes 2019-02-06 10:00:38 -03:00
openat-syscall-all-cpus.c perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test 2019-03-19 16:52:05 -03:00
openat-syscall-tp-fields.c
openat-syscall.c
parse-events.c perf tools: Fix legacy events symbol separator parsing 2019-02-14 15:18:08 -03:00
parse-no-sample-id-all.c
perf-hooks.c
perf-record.c perf tests record: Allow for 'sleep' being 'coreutils' 2018-12-17 14:54:26 -03:00
perf-targz-src-pkg
pmu.c perf tests pmu: Add missing headers 2019-02-06 10:00:38 -03:00
python-use.c
sample-parsing.c perf tests: Add missing headers so far obtained indirectly 2019-02-06 10:00:38 -03:00
sdt.c perf tests: Add missing headers so far obtained indirectly 2019-02-06 10:00:38 -03:00
stat.c
sw-clock.c
switch-tracking.c
task-exit.c
tests.h perf tests: Add a test for the ARM 32-bit [vectors] page 2019-01-08 13:28:13 -03:00
thread-map.c
thread-mg-share.c
topology.c
unit_number__scnprintf.c
vmlinux-kallsyms.c
wp.c perf test: S390 does not support watchpoints in test 22 2018-10-08 14:23:44 -03:00