From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: davem@davemloft.net
Cc: daniel@iogearbox.net, paulmck@kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH v4 bpf-next 0/5] bpf: Introduce minimal support for sleepable progs
Date: Mon, 29 Jun 2020 17:34:36 -0700 [thread overview]
Message-ID: <20200630003441.42616-1-alexei.starovoitov@gmail.com> (raw)
From: Alexei Starovoitov <ast@kernel.org>
v3->v4:
- fixed synchronize_rcu_tasks_trace() usage and accelerated with synchronize_rcu_mult().
- removed redundant synchronize_rcu(). Otherwise it won't be clear why
synchronize_rcu_tasks_trace() is not needed in free_map callbacks.
- improved test coverage.
v2->v3:
- switched to rcu_trace
- added bpf_copy_from_user
Here is 'perf report' differences:
sleepable with SRCU:
3.86% bench [k] __srcu_read_unlock
3.22% bench [k] __srcu_read_lock
0.92% bench [k] bpf_prog_740d4210cdcd99a3_bench_trigger_fentry_sleep
0.50% bench [k] bpf_trampoline_10297
0.26% bench [k] __bpf_prog_exit_sleepable
0.21% bench [k] __bpf_prog_enter_sleepable
sleepable with RCU_TRACE:
0.79% bench [k] bpf_prog_740d4210cdcd99a3_bench_trigger_fentry_sleep
0.72% bench [k] bpf_trampoline_10381
0.31% bench [k] __bpf_prog_exit_sleepable
0.29% bench [k] __bpf_prog_enter_sleepable
non-sleepable with RCU:
0.88% bench [k] bpf_prog_740d4210cdcd99a3_bench_trigger_fentry
0.84% bench [k] bpf_trampoline_10297
0.13% bench [k] __bpf_prog_enter
0.12% bench [k] __bpf_prog_exit
Happy to confirm that rcu_trace overhead is negligible.
v1->v2:
- split fmod_ret fix into separate patch
- added blacklist
v1:
This patch set introduces the minimal viable support for sleepable bpf programs.
In this patch only fentry/fexit/fmod_ret and lsm progs can be sleepable.
Only array and pre-allocated hash and lru maps allowed.
Alexei Starovoitov (5):
bpf: Remove redundant synchronize_rcu.
bpf: Introduce sleepable BPF programs
bpf: Add bpf_copy_from_user() helper.
libbpf: support sleepable progs
selftests/bpf: Add sleepable tests
arch/x86/net/bpf_jit_comp.c | 32 ++++++----
include/linux/bpf.h | 4 ++
include/uapi/linux/bpf.h | 19 +++++-
init/Kconfig | 1 +
kernel/bpf/arraymap.c | 10 +--
kernel/bpf/hashtab.c | 20 +++---
kernel/bpf/helpers.c | 22 +++++++
kernel/bpf/lpm_trie.c | 5 --
kernel/bpf/queue_stack_maps.c | 7 --
kernel/bpf/reuseport_array.c | 2 -
kernel/bpf/ringbuf.c | 7 --
kernel/bpf/stackmap.c | 3 -
kernel/bpf/syscall.c | 13 +++-
kernel/bpf/trampoline.c | 33 +++++++++-
kernel/bpf/verifier.c | 62 +++++++++++++++++-
kernel/trace/bpf_trace.c | 2 +
tools/include/uapi/linux/bpf.h | 19 +++++-
tools/lib/bpf/libbpf.c | 25 +++++++-
tools/testing/selftests/bpf/bench.c | 2 +
.../selftests/bpf/benchs/bench_trigger.c | 17 +++++
.../selftests/bpf/prog_tests/test_lsm.c | 9 +++
tools/testing/selftests/bpf/progs/lsm.c | 64 ++++++++++++++++++-
.../selftests/bpf/progs/trigger_bench.c | 7 ++
23 files changed, 318 insertions(+), 67 deletions(-)
--
2.23.0
next reply other threads:[~2020-06-30 0:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 0:34 Alexei Starovoitov [this message]
2020-06-30 0:34 ` [PATCH v4 bpf-next 1/5] bpf: Remove redundant synchronize_rcu Alexei Starovoitov
2020-06-30 0:58 ` Andrii Nakryiko
2020-06-30 1:08 ` Andrii Nakryiko
2020-06-30 2:56 ` Alexei Starovoitov
2020-06-30 3:31 ` Andrii Nakryiko
2020-06-30 0:34 ` [PATCH v4 bpf-next 2/5] bpf: Introduce sleepable BPF programs Alexei Starovoitov
2020-06-30 1:15 ` Andrii Nakryiko
2020-06-30 3:03 ` Alexei Starovoitov
2020-06-30 0:34 ` [PATCH v4 bpf-next 3/5] bpf: Add bpf_copy_from_user() helper Alexei Starovoitov
2020-06-30 1:18 ` Andrii Nakryiko
2020-06-30 0:34 ` [PATCH v4 bpf-next 4/5] libbpf: support sleepable progs Alexei Starovoitov
2020-06-30 0:34 ` [PATCH v4 bpf-next 5/5] selftests/bpf: Add sleepable tests Alexei Starovoitov
2020-06-30 1:25 ` Andrii Nakryiko
2020-06-30 3:06 ` Alexei Starovoitov
2020-06-30 3:34 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200630003441.42616-1-alexei.starovoitov@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=paulmck@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).