mbox series

[v3,bpf-next,0/3] enable BPF_PROG_TEST_RUN for raw_tp

Message ID 20200923213337.3432472-1-songliubraving@fb.com
Headers show
Series enable BPF_PROG_TEST_RUN for raw_tp | expand

Message

Song Liu Sept. 23, 2020, 9:33 p.m. UTC
This set enables BPF_PROG_TEST_RUN for raw_tracepoint type programs. This
set also enables running the raw_tp program on a specific CPU. This feature
can be used by user space to trigger programs that access percpu resources,
e.g. perf_event, percpu variables.

Changes v2 => v3:
1. Fix memory leak in the selftest. (Andrii)
2. Use __u64 instead of unsigned long long. (Andrii)

Changes v1 => v2:
1. More checks for retval in the selftest. (John)
2. Remove unnecessary goto in bpf_prog_test_run_raw_tp. (John)

Song Liu (3):
  bpf: enable BPF_PROG_TEST_RUN for raw_tracepoint
  libbpf: introduce bpf_prog_test_run_xattr_opts
  selftests/bpf: add raw_tp_test_run

 include/linux/bpf.h                           |  3 +
 include/uapi/linux/bpf.h                      |  5 ++
 kernel/bpf/syscall.c                          |  2 +-
 kernel/trace/bpf_trace.c                      |  1 +
 net/bpf/test_run.c                            | 88 +++++++++++++++++++
 tools/include/uapi/linux/bpf.h                |  5 ++
 tools/lib/bpf/bpf.c                           | 13 ++-
 tools/lib/bpf/bpf.h                           | 11 +++
 tools/lib/bpf/libbpf.map                      |  1 +
 .../bpf/prog_tests/raw_tp_test_run.c          | 75 ++++++++++++++++
 .../bpf/progs/test_raw_tp_test_run.c          | 25 ++++++
 11 files changed, 227 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/raw_tp_test_run.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_raw_tp_test_run.c

--
2.24.1

Comments

Song Liu Sept. 23, 2020, 9:50 p.m. UTC | #1
> On Sep 23, 2020, at 2:33 PM, Song Liu <songliubraving@fb.com> wrote:
> 
> This set enables BPF_PROG_TEST_RUN for raw_tracepoint type programs. This
> set also enables running the raw_tp program on a specific CPU. This feature
> can be used by user space to trigger programs that access percpu resources,
> e.g. perf_event, percpu variables.
> 
> Changes v2 => v3:
> 1. Fix memory leak in the selftest. (Andrii)
> 2. Use __u64 instead of unsigned long long. (Andrii)
> 
> Changes v1 => v2:
> 1. More checks for retval in the selftest. (John)
> 2. Remove unnecessary goto in bpf_prog_test_run_raw_tp. (John)

I somehow missed Andrii's other comments and sent v3 too fast. 

Please ignore this version.