linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v5 00/30] perf tools: filtering events using eBPF programs
@ 2015-06-01  7:37 Wang Nan
  2015-06-01  7:37 ` [RFC PATCH v5 01/30] perf tools: Move linux/kernel.h to tools/include Wang Nan
                   ` (30 more replies)
  0 siblings, 31 replies; 43+ messages in thread
From: Wang Nan @ 2015-06-01  7:37 UTC (permalink / raw)
  To: namhyung, alexei.starovoitov, masami.hiramatsu.pt, acme, paulus,
	a.p.zijlstra, mingo, jolsa, dsahern, daniel, brendan.d.gregg
  Cc: lizefan, hekuang, xiakaixu, linux-kernel, pi3orama

This is the 5th version of patch series which tries to introduce eBPF
programs to perf. It enables 'perf record' to filter events using eBPF
programs like:

 # perf record --event bpf-file.o sleep 1

Events are selected and filtered according to definitions in bpf-file.o.

Compare with previous v4 patch (can be found from:
http://lkml.org/lkml/2015/5/27/56), this series does following
improvements:

 1. Rebased on tip/perf/core (5c9b9bc).

 2. Length of 'version' section should be equal to sizeof(u32).

 3. Add new directories and header files into perf MAINFEST file to
    make 'make perf-targz-src-pkg' collects enough files.

 4. Add NO_LIBBPF compiling option to perf's Makefile.

    In previous version, perf decides whether to build libbpf based on
    existance of libelf. However, further patches may make libbpf to
    depend on more libraries, like LLVM. In v5, building flag of libbpf
    is separated from NO_LINELF. Corresponding testing targets are also
    added.
 
 5. Check BPF API before building libbpf.

    A new feature check is added into tools/build/features to check
    compatibility of BPF API to avoid compiling error if 'kern_version'
    not exist.

 6. Release resource after loading. See discussion in
    https://lkml.org/lkml/2015/5/27/33 .

 7. When trying to attach eBPF programs to inline functions, for
    example, dst_output_sk(), v4 only attaches the first point. This
    series solves this problem in 26/30 and 27/30, by bringing
    information in probe_trace_event to perf_probe_event and add events
    based on probe_trace_event.

 8. Coding style improvements.

 9. Pass 'make build-test' checking.

Patch 'perf probe: Fix segfault when glob matching function without
debuginfo' (lkml.org/lkml/2015/5/29/168) is required for testing.

 Patch 1/30 - 2/30 extract some headers to tools/include for compiling.

 Patch 3/30 add a feature check to check version of eBPF API.

 Patch 4/30 - 22/30 introduce libbpf, which first parse eBPF object
   files then load maps and programs into kernel.

 Patch 23-30 - 30/30 are perf side modifications, introducing
   new syntax: '--event [.*].(o|bpf)' to enable passing eBPF object
   files to 'perf record', create probing points and attach programs
   to those points.

Wang Nan (30):
  perf tools: Move linux/kernel.h to tools/include
  perf tools: Move linux/{list.h,poison.h} to tools/include
  tools build: Add feature check for eBPF API
  bpf tools: Introduce 'bpf' library to tools
  bpf tools: Allow caller to set printing function
  bpf tools: Open eBPF object file and do basic validation
  bpf tools: Check endianess 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: Introduce accessors for struct bpf_object
  bpf tools: Link all bpf objects onto a list
  perf tools: Make perf depend on libbpf
  perf record: Enable passing bpf object file to --event
  perf tools: Parse probe points of eBPF programs during preparation
  perf probe: Attach trace_probe_event with perf_probe_event
  perf record: Probe at kprobe points
  perf record: Load all eBPF object into kernel
  perf tools: Add bpf_fd field to evsel and config it
  perf tools: Attach eBPF program to perf event

 tools/build/Makefile.feature                 |   6 +-
 tools/build/feature/Makefile                 |   6 +-
 tools/build/feature/test-bpf.c               |  18 +
 tools/{perf/util => }/include/linux/kernel.h |   0
 tools/{perf/util => }/include/linux/list.h   |   6 +-
 tools/include/linux/poison.h                 |   1 +
 tools/lib/bpf/.gitignore                     |   2 +
 tools/lib/bpf/Build                          |   1 +
 tools/lib/bpf/Makefile                       | 195 ++++++
 tools/lib/bpf/bpf.c                          |  84 +++
 tools/lib/bpf/bpf.h                          |  23 +
 tools/lib/bpf/libbpf.c                       | 993 +++++++++++++++++++++++++++
 tools/lib/bpf/libbpf.h                       |  83 +++
 tools/perf/MANIFEST                          |   6 +
 tools/perf/Makefile.perf                     |  23 +-
 tools/perf/builtin-probe.c                   |   2 +-
 tools/perf/builtin-record.c                  |  32 +-
 tools/perf/config/Makefile                   |   8 +
 tools/perf/tests/make                        |   4 +-
 tools/perf/util/Build                        |   1 +
 tools/perf/util/bpf-loader.c                 | 283 ++++++++
 tools/perf/util/bpf-loader.h                 |  45 ++
 tools/perf/util/debug.c                      |   5 +
 tools/perf/util/debug.h                      |   1 +
 tools/perf/util/evlist.c                     |  51 ++
 tools/perf/util/evlist.h                     |   1 +
 tools/perf/util/evsel.c                      |  17 +
 tools/perf/util/evsel.h                      |   1 +
 tools/perf/util/include/linux/poison.h       |   1 -
 tools/perf/util/parse-events.c               |  16 +
 tools/perf/util/parse-events.h               |   2 +
 tools/perf/util/parse-events.l               |   3 +
 tools/perf/util/parse-events.y               |  18 +-
 tools/perf/util/probe-event.c                |  57 +-
 tools/perf/util/probe-event.h                |   5 +-
 35 files changed, 1958 insertions(+), 42 deletions(-)
 create mode 100644 tools/build/feature/test-bpf.c
 rename tools/{perf/util => }/include/linux/kernel.h (100%)
 rename tools/{perf/util => }/include/linux/list.h (90%)
 create mode 100644 tools/include/linux/poison.h
 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/util/bpf-loader.c
 create mode 100644 tools/perf/util/bpf-loader.h
 delete mode 100644 tools/perf/util/include/linux/poison.h

-- 
1.8.3.4


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2015-06-04 14:12 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01  7:37 [RFC PATCH v5 00/30] perf tools: filtering events using eBPF programs Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 01/30] perf tools: Move linux/kernel.h to tools/include Wang Nan
2015-06-04 14:11   ` [tip:perf/core] " tip-bot for Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 02/30] perf tools: Move linux/{list.h,poison.h} " Wang Nan
2015-06-04 14:11   ` [tip:perf/core] tools: Move tools/perf/util/include/linux/{list.h ,poison.h} " tip-bot for Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 03/30] tools build: Add feature check for eBPF API Wang Nan
2015-06-02 22:11   ` Arnaldo Carvalho de Melo
2015-06-03  1:15     ` Wangnan (F)
2015-06-03 13:47       ` Arnaldo Carvalho de Melo
2015-06-01  7:37 ` [RFC PATCH v5 04/30] bpf tools: Introduce 'bpf' library to tools Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 05/30] bpf tools: Allow caller to set printing function Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 06/30] bpf tools: Open eBPF object file and do basic validation Wang Nan
2015-06-03 21:33   ` Arnaldo Carvalho de Melo
2015-06-03 21:35     ` Arnaldo Carvalho de Melo
2015-06-04  2:18       ` Wangnan (F)
2015-06-01  7:37 ` [RFC PATCH v5 07/30] bpf tools: Check endianess and make libbpf fail early Wang Nan
2015-06-03 21:52   ` Arnaldo Carvalho de Melo
2015-06-01  7:37 ` [RFC PATCH v5 08/30] bpf tools: Iterate over ELF sections to collect information Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 09/30] bpf tools: Collect version and license from ELF sections Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 10/30] bpf tools: Collect map definitions from 'maps' section Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 11/30] bpf tools: Collect symbol table from SHT_SYMTAB section Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 12/30] bpf tools: Collect eBPF programs from their own sections Wang Nan
2015-06-01  7:37 ` [RFC PATCH v5 13/30] bpf tools: Collect relocation sections from SHT_REL sections Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 14/30] bpf tools: Record map accessing instructions for each program Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 15/30] bpf tools: Add bpf.c/h for common bpf operations Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 16/30] bpf tools: Create eBPF maps defined in an object file Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 17/30] bpf tools: Relocate eBPF programs Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 18/30] bpf tools: Introduce bpf_load_program() to bpf.c Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 19/30] bpf tools: Load eBPF programs in object files into kernel Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 20/30] bpf tools: Introduce accessors for struct bpf_program Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 21/30] bpf tools: Introduce accessors for struct bpf_object Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 22/30] bpf tools: Link all bpf objects onto a list Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 23/30] perf tools: Make perf depend on libbpf Wang Nan
2015-06-03  2:45   ` [RFC PATCH v6 " Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 24/30] perf record: Enable passing bpf object file to --event Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 25/30] perf tools: Parse probe points of eBPF programs during preparation Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 26/30] perf probe: Attach trace_probe_event with perf_probe_event Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 27/30] perf record: Probe at kprobe points Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 28/30] perf record: Load all eBPF object into kernel Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 29/30] perf tools: Add bpf_fd field to evsel and config it Wang Nan
2015-06-01  7:38 ` [RFC PATCH v5 30/30] perf tools: Attach eBPF program to perf event Wang Nan
2015-06-02  0:48 ` [RFC PATCH v5 00/30] perf tools: filtering events using eBPF programs Alexei Starovoitov
2015-06-02  1:15   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).