linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v4 00/29] perf tools: filtering events using eBPF programs
@ 2015-05-27  5:19 Wang Nan
  2015-05-27  5:19 ` [RFC PATCH v4 01/29] tools: Add __aligned_u64 to types.h Wang Nan
                   ` (28 more replies)
  0 siblings, 29 replies; 62+ messages in thread
From: Wang Nan @ 2015-05-27  5:19 UTC (permalink / raw)
  To: paulus, a.p.zijlstra, mingo, acme, namhyung, jolsa, dsahern,
	daniel, brendan.d.gregg, masami.hiramatsu.pt
  Cc: lizefan, linux-kernel, pi3orama

This is the 4th version of patch series which tries to introduce eBPF
programs to perf. Based on v4.1-rc3. This patch series improves
'perf record', enables commands like

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

to select events defined in bpf-file.o and filter those events using
bpf programs inside it.

Different from previous (perf tools: introduce 'perf bpf' command to
load eBPF programs.) version, the 4th version drops 'perf bpf'
subcommand, merges event filtering use case directly into 'perf
record'.

Other improvments including:

 1. Simply return an error if byte ordering mismatch, instead of trying
    to correct it.

 2. Introduce zfree() and zclose() to free memory and close file to
    ensure the pointers are set to NULL and fd set to -1.

 3. Use OO style naming. For example, bpf_object__open() instead of
    bpf_open_object() in v3.

 4. libbpf use linked list to link all bpf_object together. Caller
    doesn't need to store pointers of bpf_object and bpf_program.

 5. Doesn't treat 'config' section specially.

 6. Remove 'atexit' hook.

 7. Bugfix: if multiple perf events are created for one kprobe event,
    only the first try to hook eBPF program can success. Other try
    returns EEXIST. Such error should be ignored.

 8. Coding style, makefile and license correction.

Patch 1/29 - 4/29 are preparations, moves some headers from perf
    internal include directory to tools/include. libbpf will use them.

Patch 5/29 - 22/29 introduces libbpf. The design principle is similar
    to v3, except that allow caller iterate over objects using macro.

Patch 23/29 - 29/29 improve 'perf record' subcommand. In patch 24,
    event parsing syntax is improved to accept strings like
    './bpf-file.o' and 'bpf-object.bpf' to be passed by '--event'.

To make it work, following acked patches should be cherry-picked before
applying this series:

 tools: Change FEATURE_TESTS and FEATURE_DISPLAY to weak binding
 perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit
 perf/events/core: fix race in bpf program unregister

Wang Nan (29):
  tools: Add __aligned_u64 to types.h
  perf tools: Move linux/kernel.h to tools/include
  perf tools: Move linux/{list.h,poison.h} to tools/include
  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 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/{perf/util => }/include/linux/kernel.h |   0
 tools/{perf/util => }/include/linux/list.h   |   6 +-
 tools/include/linux/poison.h                 |   1 +
 tools/include/linux/types.h                  |   5 +
 tools/lib/bpf/.gitignore                     |   2 +
 tools/lib/bpf/Build                          |   1 +
 tools/lib/bpf/Makefile                       | 190 ++++++
 tools/lib/bpf/bpf.c                          |  90 +++
 tools/lib/bpf/bpf.h                          |  23 +
 tools/lib/bpf/libbpf.c                       | 969 +++++++++++++++++++++++++++
 tools/lib/bpf/libbpf.h                       |  75 +++
 tools/perf/Makefile.perf                     |  19 +-
 tools/perf/builtin-record.c                  |  32 +
 tools/perf/util/Build                        |   1 +
 tools/perf/util/bpf-loader.c                 | 284 ++++++++
 tools/perf/util/bpf-loader.h                 |  32 +
 tools/perf/util/debug.c                      |   5 +
 tools/perf/util/debug.h                      |   1 +
 tools/perf/util/evlist.c                     |  32 +
 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               |   5 +-
 tools/perf/util/parse-events.y               |  18 +-
 27 files changed, 1822 insertions(+), 7 deletions(-)
 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] 62+ messages in thread

end of thread, other threads:[~2015-06-01 13:01 UTC | newest]

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

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).