All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v6 00/32] perf tools: filtering events using eBPF programs
@ 2015-06-09  5:50 Wang Nan
  2015-06-09  5:50 ` [RFC PATCH v6 01/32] tools build: Add feature check for eBPF API Wang Nan
                   ` (33 more replies)
  0 siblings, 34 replies; 58+ messages in thread
From: Wang Nan @ 2015-06-09  5:50 UTC (permalink / raw)
  To: acme, ast, brendan.d.gregg, daniel, namhyung,
	masami.hiramatsu.pt, paulus, a.p.zijlstra, mingo, jolsa, dsahern
  Cc: linux-kernel, lizefan, hekuang, xiakaixu, pi3orama

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

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

and

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

This patch series is based on tip/perf/core (a3d8654).

Compared with v5 patch, this series allows user to pass BPF
scriptlet source code file directly, instead of requiring user to
pre-compile it into an ELF object. Which is done mainly by patch 24/32.

In addition, to help users setup LLVM, [bpf] perf config section is
appended. 4 command line options are also appended to 'perf record'
for setting pathes and options of clang and llc. Which is done by patch
25/32 and 32/32.

Other improvements:

 1. Adjust context.

 2. Get rid of 'trailing whitespace' and 'space before tab in indent'
    problems.

 3. Error messages are improved when BPF API checking fail.

In this series:

 Patch 1/32 adds a feature check to check version of eBPF API.

 Patch 2/32 - 21/32 introduce libbpf, which first parse eBPF object
   files then load maps and programs into kernel. These patches are
   already received 'Acked-by' from Alexei Starovoitov except patch
   5/32, which enables opening a memory-based object file image using
   bpf_object__open_buffer().

 Patch 22/32 - 32/32 are perf related. Patch 24, 25 and 32 are new to
   support dynamical compiling.

Here is an example shows the using of dynamic compiling:

   # perf record --event lock_page.c ls /
   Added new event:
     perf_bpf_probe:lock_page (on __lock_page)
   
   You can now use it in all perf tools, such as:
   
   	perf record -e perf_bpf_probe:lock_page -aR sleep 1
   
   Added new event:
     perf_bpf_probe:lock_page_ret (on __lock_page%return)
   
   You can now use it in all perf tools, such as:
   
   	perf record -e perf_bpf_probe:lock_page_ret -aR sleep 1
   
   Added new event:
     perf_bpf_probe:unlock_page (on unlock_page)
   
   You can now use it in all perf tools, such as:
   
   	perf record -e perf_bpf_probe:unlock_page -aR sleep 1
   
   bin  boot  dev	etc  home  init  lib  lib64  linuxrc  media  mnt  proc	root  run  sbin  sys  tmp  usr	var
   [ perf record: Woken up 1 times to write data ]
   [ perf record: Captured and wrote 0.002 MB perf.data ]
   Removed event: perf_bpf_probe:lock_page
   Removed event: perf_bpf_probe:lock_page_ret
   Removed event: perf_bpf_probe:unlock_page

Where lock_page.c can be found from:

 http://lkml.kernel.org/r/557025A2.6090903@huawei.com 

Wang Nan (32):
  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: Read eBPF object from buffer
  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 record: Compile scriptlets if pass '.c' to --event
  perf tools: Add 'bpf.' config section to perf default config
  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
  perf record: Add LLVM options for compiling BPF scripts

 tools/build/Makefile.feature   |    6 +-
 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            |   84 ++++
 tools/lib/bpf/bpf.h            |   23 +
 tools/lib/bpf/libbpf.c         | 1037 ++++++++++++++++++++++++++++++++++++++++
 tools/lib/bpf/libbpf.h         |   85 ++++
 tools/perf/MANIFEST            |    3 +
 tools/perf/Makefile.perf       |   17 +-
 tools/perf/builtin-probe.c     |    2 +-
 tools/perf/builtin-record.c    |   40 +-
 tools/perf/config/Makefile     |   19 +-
 tools/perf/tests/make          |    4 +-
 tools/perf/util/Build          |    1 +
 tools/perf/util/bpf-loader.c   |  477 ++++++++++++++++++
 tools/perf/util/bpf-loader.h   |   54 +++
 tools/perf/util/config.c       |    3 +
 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/parse-events.c |   16 +
 tools/perf/util/parse-events.h |    2 +
 tools/perf/util/parse-events.l |    6 +
 tools/perf/util/parse-events.y |   29 +-
 tools/perf/util/probe-event.c  |   57 ++-
 tools/perf/util/probe-event.h  |    5 +-
 32 files changed, 2229 insertions(+), 39 deletions(-)
 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/util/bpf-loader.c
 create mode 100644 tools/perf/util/bpf-loader.h

-- 
1.8.3.4


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

end of thread, other threads:[~2015-06-11 17:43 UTC | newest]

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.