lkml.org 
[lkml]   [2020]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH bpf-next 0/5] introduce BPF_PROG_TYPE_USER
Date
This set introduces a new program type BPF_PROG_TYPE_USER, or "user
program". User program is triggered from user space via
sys_bpf(BPF_PROG_TEST_RUN). User program will replace some uprobe programs.
Compared against uprobe, user program has the following advantages:

1. User programs are faster. The new selftest added in 5/5, shows that a
simple uprobe program takes 1400 nanoseconds, while user program only
takes 300 nanoseconds.
2. User can specify on which cpu the user program would run.
3. User can pass arguments to the user program.

Song Liu (5):
bpf: introduce BPF_PROG_TYPE_USER
libbpf: support BPF_PROG_TYPE_USER programs
selftests/bpf: add selftest for BPF_PROG_TYPE_USER
selftests/bpf: move two functions to test_progs.c
selftests/bpf: add benchmark for uprobe vs. user_prog

include/linux/bpf_types.h | 2 +
include/uapi/linux/bpf.h | 19 +++
kernel/bpf/syscall.c | 3 +-
kernel/trace/bpf_trace.c | 121 ++++++++++++++++++
tools/include/uapi/linux/bpf.h | 19 +++
tools/lib/bpf/bpf.c | 1 +
tools/lib/bpf/bpf.h | 3 +
tools/lib/bpf/libbpf.c | 1 +
tools/lib/bpf/libbpf_probes.c | 1 +
.../selftests/bpf/prog_tests/attach_probe.c | 21 ---
.../selftests/bpf/prog_tests/test_overhead.c | 8 --
.../bpf/prog_tests/uprobe_vs_user_prog.c | 101 +++++++++++++++
.../selftests/bpf/prog_tests/user_prog.c | 52 ++++++++
.../selftests/bpf/progs/uprobe_vs_user_prog.c | 21 +++
tools/testing/selftests/bpf/progs/user_prog.c | 56 ++++++++
tools/testing/selftests/bpf/test_progs.c | 30 +++++
tools/testing/selftests/bpf/test_progs.h | 2 +
17 files changed, 431 insertions(+), 30 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/uprobe_vs_user_prog.c
create mode 100644 tools/testing/selftests/bpf/prog_tests/user_prog.c
create mode 100644 tools/testing/selftests/bpf/progs/uprobe_vs_user_prog.c
create mode 100644 tools/testing/selftests/bpf/progs/user_prog.c

--
2.24.1

\
 
 \ /
  Last update: 2020-08-01 10:50    [W:0.159 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site