linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 00/26] perf tools: Support uBPF script
@ 2016-06-26 11:20 He Kuang
  2016-06-26 11:20 ` [RFC PATCH v2 01/26] tools include: Adopt byte ordering macros from byteorder/generic.h He Kuang
                   ` (26 more replies)
  0 siblings, 27 replies; 38+ messages in thread
From: He Kuang @ 2016-06-26 11:20 UTC (permalink / raw)
  To: acme, peterz, mingo, jolsa, brendan.d.gregg, ast,
	alexander.shishkin, wangnan0, hekuang
  Cc: linux-kernel

This patchset is based on Wang Nan's v1:
     http://thread.gmane.org/gmane.linux.kernel/2203717/focus=2203707

""" 
  This patch set allows to perf invoke some user space BPF scripts on
  some point. uBPF scripts and kernel BPF scripts reside in one BPF
  object.  They communicate with each other with BPF maps. uBPF
  scripts can invoke helper functions provided by perf.
  
  At least following new features can be achieved based on uBPF
  support:
  
   1) Report statistical result:

      Like DTrace, perf print statistical report before quit. No need
      to extract data using 'perf report'. Statistical method is
      controled by user.
  
   2) Control perf's behavior:

      Dynamically adjust period of different events. Policy is defined
      by user.
"""

and modified by following the reviewers' suggestions.

v1-v2:

  - Split bpf vm part out of kernel/bpf/core.c and link to it instead
    of using ubpf library(Suggested by Alexei Starovoitov). And add
    runtime bounds check just like ubpf library does.
    
  - Introduce bpf_engine(engine-kbpf, engine-ubpf) operations and
    getting rid of the complicate macros(Suggested by Arnaldo).

  - Use void pointer to reference kbpf/ubpf entries.(Suggested by
    Arnaldo)

The test case in the v1 cover letter still works but there's a slight
problem which should be pointed out to clarify the usage of ubpf
function arguments.

-int perf_record_end(int samples)
+struct perf_record_end_ctx {
+       int samples;
+       int dummy;
+};
+int perf_record_end(struct perf_record_end_ctx *ctx)

And the argument 'samples' should be referenced as 'ctx->samples'.

Thank you.

He Kuang (17):
  bpf: extract jmp and default handler and introduce UBPF_BUILD flag
  tools include: Add (atomic|atomic64)_add implementation from the
    kernel sources
  perf bpf: Implement empty instruction handler and build bpf-vm
  perf bpf: Remove unused code in libbpf
  perf bpf: Store arbitrary entries instread fd array in bpf_program
  perf bpf: Add libbpf-internal.h header file
  perf bpf: Add abstraction for bpf program methods
  perf bpf: Add -Wextra to cflags for more warnings and fix them
  perf bpf: Introduce the entity and engine for userspace bpf
  perf bpf: Add method for fetching nth ubpf vm
  perf bpf: Add methods to set/check ubpf engine for bpf programs
  perf bpf: Add ubpf helper function slots and set/get methods
  bpf: Support bpf load/store boundary check for ubpf
  perf bpf: Implement boundary check code in ubpf
  perf record: Add uBPF hooks at beginning and end of perf record
  perf bpf: Fillup bpf jmp_call handler
  perf bpf: Implement run_ubpf_program

Wang Nan (9):
  tools include: Adopt byte ordering macros from byteorder/generic.h
  tools include: Fix wrong macro definitions for cpu_to_le* for big
    endian
  bpf: split __bpf_prog_run code into new file
  tools include: Sync math64.h and div64.h
  perf bpf: Add map related BPF helper
  perf bpf: Add UBPF flags and makefile options
  perf tools: Register basic uBPF helpers
  perf bpf: Accept uBPF programs
  perf tests: Add uBPF test case

 include/linux/filter.h                             |   1 +
 kernel/bpf/Makefile                                |   2 +-
 kernel/bpf/core.c                                  | 487 -------------------
 kernel/bpf/vm.c                                    | 517 +++++++++++++++++++++
 tools/arch/x86/include/asm/atomic.h                |  28 ++
 tools/include/asm-generic/atomic-gcc.h             |  10 +
 tools/include/asm-generic/div64.h                  | 234 ++++++++++
 tools/include/linux/byteorder/generic.h            |  48 ++
 tools/include/linux/kernel.h                       |   7 +-
 tools/include/linux/math64.h                       | 247 ++++++++++
 tools/include/linux/types.h                        |   4 +
 tools/lib/bpf/Build                                |   2 +
 tools/lib/bpf/Makefile                             |   6 +-
 tools/lib/bpf/bpf.c                                |  24 +
 tools/lib/bpf/bpf.h                                |   2 +
 tools/lib/bpf/engine-kbpf.c                        | 131 ++++++
 tools/lib/bpf/engine-ubpf.c                        | 134 ++++++
 tools/lib/bpf/libbpf-internal.h                    |  76 +++
 tools/lib/bpf/libbpf.c                             | 216 ++-------
 tools/lib/bpf/libbpf.h                             |  43 +-
 tools/perf/MANIFEST                                |   3 +
 tools/perf/Makefile.perf                           |   2 +
 tools/perf/builtin-record.c                        |   4 +
 tools/perf/config/Makefile                         |   4 +
 tools/perf/perf.c                                  |   3 +
 tools/perf/tests/Build                             |   8 +
 tools/perf/tests/bpf-script-test-ubpf.c            |  88 ++++
 tools/perf/tests/bpf.c                             |  78 +++-
 tools/perf/tests/llvm.c                            |   4 +
 tools/perf/tests/llvm.h                            |   2 +
 tools/perf/util/Build                              |   3 +
 tools/perf/util/bpf-loader.c                       |  23 +-
 tools/perf/util/bpf-vm.c                           |  89 ++++
 tools/perf/util/bpf-vm.h                           |   8 +
 tools/perf/util/intel-bts.c                        |   5 -
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   |   7 +-
 tools/perf/util/ubpf-helpers-list.h                |  11 +
 tools/perf/util/ubpf-helpers.c                     |  73 +++
 tools/perf/util/ubpf-helpers.h                     |  21 +
 tools/perf/util/ubpf-hooks-list.h                  |  34 ++
 tools/perf/util/ubpf-hooks.c                       |  81 ++++
 tools/perf/util/ubpf-hooks.h                       |  41 ++
 42 files changed, 2126 insertions(+), 685 deletions(-)
 create mode 100644 kernel/bpf/vm.c
 create mode 100644 tools/include/asm-generic/div64.h
 create mode 100644 tools/include/linux/byteorder/generic.h
 create mode 100644 tools/include/linux/math64.h
 create mode 100644 tools/lib/bpf/engine-kbpf.c
 create mode 100644 tools/lib/bpf/engine-ubpf.c
 create mode 100644 tools/lib/bpf/libbpf-internal.h
 create mode 100644 tools/perf/tests/bpf-script-test-ubpf.c
 create mode 100644 tools/perf/util/bpf-vm.c
 create mode 100644 tools/perf/util/bpf-vm.h
 create mode 100644 tools/perf/util/ubpf-helpers-list.h
 create mode 100644 tools/perf/util/ubpf-helpers.c
 create mode 100644 tools/perf/util/ubpf-helpers.h
 create mode 100644 tools/perf/util/ubpf-hooks-list.h
 create mode 100644 tools/perf/util/ubpf-hooks.c
 create mode 100644 tools/perf/util/ubpf-hooks.h

-- 
1.8.5.2

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

end of thread, other threads:[~2016-06-29 13:04 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-26 11:20 [RFC PATCH v2 00/26] perf tools: Support uBPF script He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 01/26] tools include: Adopt byte ordering macros from byteorder/generic.h He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 02/26] tools include: Fix wrong macro definitions for cpu_to_le* for big endian He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 03/26] bpf: split __bpf_prog_run code into new file He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 04/26] bpf: extract jmp and default handler and introduce UBPF_BUILD flag He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 05/26] tools include: Sync math64.h and div64.h He Kuang
2016-06-26 21:08   ` Nilay Vaish
2016-06-27  2:21     ` Hekuang
2016-06-27 18:13       ` Arnaldo Carvalho de Melo
2016-06-26 11:20 ` [RFC PATCH v2 06/26] tools include: Add (atomic|atomic64)_add implementation from the kernel sources He Kuang
2016-06-26 11:20 ` [RFC PATCH v2 07/26] perf bpf: Add map related BPF helper He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 08/26] perf bpf: Add UBPF flags and makefile options He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 09/26] perf bpf: Implement empty instruction handler and build bpf-vm He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 10/26] perf bpf: Remove unused code in libbpf He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 11/26] perf bpf: Store arbitrary entries instread fd array in bpf_program He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 12/26] perf bpf: Add libbpf-internal.h header file He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 13/26] perf bpf: Add abstraction for bpf program methods He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 14/26] perf bpf: Add -Wextra to cflags for more warnings and fix them He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 15/26] perf bpf: Introduce the entity and engine for userspace bpf He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 16/26] perf bpf: Add method for fetching nth ubpf vm He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 17/26] perf bpf: Add methods to set/check ubpf engine for bpf programs He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 18/26] perf bpf: Add ubpf helper function slots and set/get methods He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 19/26] perf tools: Register basic uBPF helpers He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 20/26] perf bpf: Accept uBPF programs He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 21/26] bpf: Support bpf load/store boundary check for ubpf He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 22/26] perf bpf: Implement boundary check code in ubpf He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 23/26] perf record: Add uBPF hooks at beginning and end of perf record He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 24/26] perf bpf: Fillup bpf jmp_call handler He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 25/26] perf bpf: Implement run_ubpf_program He Kuang
2016-06-26 11:21 ` [RFC PATCH v2 26/26] perf tests: Add uBPF test case He Kuang
2016-06-26 20:48 ` [RFC PATCH v2 00/26] perf tools: Support uBPF script Alexei Starovoitov
2016-06-27  2:10   ` Hekuang
2016-06-28 11:47   ` Hekuang
2016-06-28 14:57     ` Alexei Starovoitov
2016-06-29 10:15       ` Hekuang
2016-06-29 10:35         ` Wangnan (F)
2016-06-29 12:37           ` Alexei Starovoitov
2016-06-29 13:03             ` pi3orama

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