[GIT PULL 00/24] perf/ebpf lib + llvm/clang building infrastructure

From: Arnaldo Carvalho de Melo
Date: Fri Aug 07 2015 - 10:52:47 EST


Hi Ingo,

This is up to a test that checks that the infrastructure for getting
a C source file and build it to a form that can then be used to upload it to
the kernel is working.

Wang has a tree where we go all the way to passing a .c file as an
--event, but I thought about breaking the patchkit up to what is settled and
the "perf test -v LLVM" point looks like a good cutoff point for demoing/testing
what is in this patchkit.

It shouldn't affect people without the environment needed, as well it
should check the environment for sanity and provide info about how to get it
working, be it in the changeset logs, the docs and on tool output messages.o

If you find anything in it that needs fixing, please let us know if you
think we should fix it before merging it to this point or if something can be
fixed in follow up patches.

Wang's repo, rebased, almost builds, he should be refreshing this soon,
fixing those trailing whitespace issues, that is stopping the rebase here:

[acme@zoo linux]$ git remote -v | grep wang | head -1
wangnan.github https://github.com/WangNan0/linux.git (fetch)
[acme@zoo linux]$ git checkout -b ebpf-test wangnan.github/ebpf
Branch ebpf-test set up to track remote branch ebpf from wangnan.github.
Switched to a new branch 'ebpf-test'
[acme@zoo linux]$ git rebase perf/ebpf
First, rewinding head to replay your work on top of it...
Applying: perf tests: Add LLVM test for eBPF on-the-fly compiling
Using index info to reconstruct a base tree...
M tools/perf/tests/Build
M tools/perf/tests/builtin-test.c
M tools/perf/tests/tests.h
M tools/perf/util/llvm-utils.c
M tools/perf/util/llvm-utils.h
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: perf tools: Make perf depend on libbpf
Using index info to reconstruct a base tree...
M tools/perf/MANIFEST
Falling back to patching base and 3-way merge...
Auto-merging tools/perf/MANIFEST
Applying: perf ebpf: Add the libbpf glue
Applying: perf tools: Enable passing bpf object file to --event
Applying: perf tools: Parse probe points of eBPF programs during preparation
Applying: perf probe: Attach trace_probe_event with perf_probe_event
Applying: perf record: Probe at kprobe points
Applying: perf record: Load all eBPF object into kernel
Applying: perf tools: Add bpf_fd field to evsel and config it
Applying: perf tools: Attach eBPF program to perf event
Applying: perf tools: Suppress probing messages when probing by BPF loading
Applying: perf record: Add clang options for compiling BPF scripts
Applying: perf tools: Infrastructure for compiling scriptlets when passing '.c' to --event
Applying: perf tests: Enforce LLVM test for BPF test
Applying: perf test: Enable 'perf test' run as test targets
tools/perf/tests/builtin-test.c:279: trailing whitespace.
+ /*
[acme@zoo linux]$

After that whitespace thing is fixed, you'll get to a point where 'perf
test -v BPF' will show you all the steps involved in, from a .c file do all the
build process and loading, attaching to a kprobe, etc that we discussed, but
those extra patches need more working before I can submit to you.

Otherwise, please consider pulling,

- Arnaldo

The following changes since commit 1354ac6ad84395660f551d0614a6ca39e5bfe8e3:

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-08-07 09:11:30 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-ebpf-for-mingo

for you to fetch changes up to 9bc898c7019383b6aa2ae6cb2928c4ca926449f0:

perf tests: Add LLVM test for eBPF on-the-fly compiling (2015-08-07 10:57:24 -0300)

----------------------------------------------------------------
perf/ebpf library + llvm/clang infrastructure

Infrastructure:

- library for interfacing with the kernel eBPF infrastructure, with
tools/perf/ targeted as a first user (Wang Nan)

- llvm/clang infrastructure for building BPF object files from C source
code (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

----------------------------------------------------------------
Wang Nan (24):
bpf tools: Introduce 'bpf' library and add bpf feature check
bpf tools: Allow caller to set printing function
bpf tools: Open eBPF object file and do basic validation
bpf tools: Read eBPF object from buffer
bpf tools: Check endianness and make libbpf fail early
bpf tools: Iterate over ELF sections to collect information
bpf tools: Collect version and license from ELF sections
bpf tools: Collect map definitions from 'maps' section
bpf tools: Collect symbol table from SHT_SYMTAB section
bpf tools: Collect eBPF programs from their own sections
bpf tools: Collect relocation sections from SHT_REL sections
bpf tools: Record map accessing instructions for each program
bpf tools: Add bpf.c/h for common bpf operations
bpf tools: Create eBPF maps defined in an object file
bpf tools: Relocate eBPF programs
bpf tools: Introduce bpf_load_program() to bpf.c
bpf tools: Load eBPF programs in object files into kernel
bpf tools: Introduce accessors for struct bpf_program
bpf tools: Link all bpf objects onto a list
perf tools: Introduce llvm config options
perf tools: Call clang to compile C source to object code
perf tools: Auto detecting kernel build directory
perf tools: Auto detecting kernel include options
perf tests: Add LLVM test for eBPF on-the-fly compiling

tools/build/feature/Makefile | 6 +-
tools/build/feature/test-bpf.c | 18 +
tools/lib/bpf/.gitignore | 2 +
tools/lib/bpf/Build | 1 +
tools/lib/bpf/Makefile | 195 ++++++++
tools/lib/bpf/bpf.c | 85 ++++
tools/lib/bpf/bpf.h | 23 +
tools/lib/bpf/libbpf.c | 1037 +++++++++++++++++++++++++++++++++++++++
tools/lib/bpf/libbpf.h | 81 +++
tools/perf/MANIFEST | 1 +
tools/perf/tests/Build | 1 +
tools/perf/tests/builtin-test.c | 4 +
tools/perf/tests/llvm.c | 98 ++++
tools/perf/tests/tests.h | 1 +
tools/perf/util/Build | 1 +
tools/perf/util/config.c | 4 +
tools/perf/util/llvm-utils.c | 408 +++++++++++++++
tools/perf/util/llvm-utils.h | 49 ++
18 files changed, 2014 insertions(+), 1 deletion(-)
create mode 100644 tools/build/feature/test-bpf.c
create mode 100644 tools/lib/bpf/.gitignore
create mode 100644 tools/lib/bpf/Build
create mode 100644 tools/lib/bpf/Makefile
create mode 100644 tools/lib/bpf/bpf.c
create mode 100644 tools/lib/bpf/bpf.h
create mode 100644 tools/lib/bpf/libbpf.c
create mode 100644 tools/lib/bpf/libbpf.h
create mode 100644 tools/perf/tests/llvm.c
create mode 100644 tools/perf/util/llvm-utils.c
create mode 100644 tools/perf/util/llvm-utils.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/