From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: davem@davemloft.net
Cc: daniel@iogearbox.net, andrii@kernel.org, martin.lau@kernel.org,
void@manifault.com, davemarchevsky@meta.com, tj@kernel.org,
memxor@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@fb.com
Subject: [PATCH bpf-next 0/4] bpf: Introduce kptr_rcu.
Date: Tue, 14 Feb 2023 22:58:08 -0800 [thread overview]
Message-ID: <20230215065812.7551-1-alexei.starovoitov@gmail.com> (raw)
From: Alexei Starovoitov <ast@kernel.org>
The __kptr_ref turned out to be too limited, since any "trusted" pointer access
requires bpf_kptr_xchg() which is impractical when the same pointer needs
to be dereferenced by multiple cpus.
The __kptr "untrusted" only access isn't very useful in practice.
Rename __kptr to __kptr_untrusted with eventual goal to deprecate it,
and rename __kptr_ref to __kptr, since that looks to be more common use of kptrs.
Introduce __kptr_rcu that can be directly dereferenced and used similar
to native kernel C code.
Once bpf_cpumask and task_struct kfuncs are converted to observe RCU GP
when refcnt goes to zero, both __kptr and __kptr_untrusted can be deprecated
and __kptr_rcu can become the only __kptr tag.
Alexei Starovoitov (4):
bpf: Rename __kptr_ref -> __kptr and __kptr -> __kptr_untrusted.
bpf: Introduce kptr_rcu.
selftests/bpf: Add a test case for kptr_rcu.
selftests/bpf: Tweak cgroup kfunc test.
Documentation/bpf/bpf_design_QA.rst | 4 +--
Documentation/bpf/cpumasks.rst | 4 +--
Documentation/bpf/kfuncs.rst | 2 +-
include/linux/bpf.h | 15 ++++++---
include/linux/bpf_verifier.h | 2 +-
kernel/bpf/btf.c | 26 +++++++++++++--
kernel/bpf/syscall.c | 4 +++
kernel/bpf/verifier.c | 33 ++++++++++++-------
tools/lib/bpf/bpf_helpers.h | 3 +-
tools/testing/selftests/bpf/progs/cb_refs.c | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_common.h | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_failure.c | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_success.c | 9 ++++-
.../selftests/bpf/progs/cpumask_common.h | 2 +-
.../selftests/bpf/progs/jit_probe_mem.c | 2 +-
tools/testing/selftests/bpf/progs/lru_bug.c | 2 +-
tools/testing/selftests/bpf/progs/map_kptr.c | 15 +++++++--
.../selftests/bpf/progs/map_kptr_fail.c | 6 ++--
.../selftests/bpf/progs/task_kfunc_common.h | 2 +-
tools/testing/selftests/bpf/test_verifier.c | 22 ++++++-------
20 files changed, 109 insertions(+), 50 deletions(-)
--
2.30.2
next reply other threads:[~2023-02-15 6:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 6:58 Alexei Starovoitov [this message]
2023-02-15 6:58 ` [PATCH bpf-next 1/4] bpf: Rename __kptr_ref -> __kptr and __kptr -> __kptr_untrusted Alexei Starovoitov
2023-02-15 6:58 ` [PATCH bpf-next 2/4] bpf: Introduce kptr_rcu Alexei Starovoitov
2023-02-15 10:48 ` Kumar Kartikeya Dwivedi
2023-02-15 22:23 ` Alexei Starovoitov
2023-02-15 6:58 ` [PATCH bpf-next 3/4] selftests/bpf: Add a test case for kptr_rcu Alexei Starovoitov
2023-02-15 6:58 ` [PATCH bpf-next 4/4] selftests/bpf: Tweak cgroup kfunc test Alexei Starovoitov
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=20230215065812.7551-1-alexei.starovoitov@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=davemarchevsky@meta.com \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/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