From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next v2 4/8] bpf: Add kfunc bpf_rcu_read_lock/unlock()
Date: Tue, 8 Nov 2022 22:39:31 +0530 [thread overview]
Message-ID: <20221108170931.b75qdoy2ysjp4xwo@apollo> (raw)
In-Reply-To: <20221108074109.263773-1-yhs@fb.com>
On Tue, Nov 08, 2022 at 01:11:09PM IST, Yonghong Song wrote:
> Add two kfunc's bpf_rcu_read_lock() and bpf_rcu_read_unlock(). These two kfunc's
> can be used for all program types. A new kfunc hook type BTF_KFUNC_HOOK_GENERIC
> is added which corresponds to prog type BPF_PROG_TYPE_UNSPEC, indicating the
> kfunc intends to be used for all prog types.
>
> The kfunc bpf_rcu_read_lock() is tagged with new flag KF_RCU_LOCK and
> bpf_rcu_read_unlock() with new flag KF_RCU_UNLOCK. These two new flags
> are used by the verifier to identify these two helpers.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
> ---
> include/linux/bpf.h | 3 +++
> include/linux/btf.h | 2 ++
> kernel/bpf/btf.c | 8 ++++++++
> kernel/bpf/helpers.c | 25 ++++++++++++++++++++++++-
> 4 files changed, 37 insertions(+), 1 deletion(-)
>
> For new kfuncs, I added KF_RCU_LOCK and KF_RCU_UNLOCK flags to
> indicate a helper could be bpf_rcu_read_lock/unlock(). This could
> be a waste for kfunc flag space as the flag is used to identify
> one helper. Alternatively, we might identify kfunc based on
> btf_id. Any suggestions are welcome.
>
It can be done similar to this change:
https://lore.kernel.org/bpf/20221107230950.7117-17-memxor@gmail.com
So compare meta.func_id to special_kfunc_list[KF_bpf_rcu_read_lock].
next prev parent reply other threads:[~2022-11-08 17:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 7:40 [PATCH bpf-next v2 0/8] bpf: Add bpf_rcu_read_lock() support Yonghong Song
2022-11-08 7:40 ` [PATCH bpf-next v2 1/8] compiler_types: Define __rcu as __attribute__((btf_type_tag("rcu"))) Yonghong Song
2022-11-08 7:40 ` [PATCH bpf-next v2 2/8] bpf: Refactor btf_struct_access callback interface Yonghong Song
2022-11-08 7:41 ` [PATCH bpf-next v2 3/8] bpf: Abstract out functions to check sleepable helpers Yonghong Song
2022-11-08 10:43 ` kernel test robot
2022-11-08 14:15 ` kernel test robot
2022-11-08 7:41 ` [PATCH bpf-next v2 4/8] bpf: Add kfunc bpf_rcu_read_lock/unlock() Yonghong Song
2022-11-08 16:56 ` Alexei Starovoitov
2022-11-08 19:09 ` Yonghong Song
2022-11-08 17:09 ` Kumar Kartikeya Dwivedi [this message]
2022-11-08 19:08 ` Yonghong Song
2022-11-08 7:41 ` [PATCH bpf-next v2 5/8] bpf: Add bpf_rcu_read_lock() verifier support Yonghong Song
2022-11-08 17:04 ` Kumar Kartikeya Dwivedi
2022-11-08 20:03 ` Yonghong Song
2022-11-08 20:19 ` Kumar Kartikeya Dwivedi
2022-11-08 20:40 ` Yonghong Song
2022-11-08 7:41 ` [PATCH bpf-next v2 6/8] bpf: Enable sleeptable support for cgrp local storage Yonghong Song
2022-11-08 7:41 ` [PATCH bpf-next v2 7/8] selftests/bpf: Add tests for bpf_rcu_read_lock() Yonghong Song
2022-11-08 7:41 ` [PATCH bpf-next v2 8/8] selftests/bpf: Add rcu_read_lock test to s390x deny list Yonghong Song
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=20221108170931.b75qdoy2ysjp4xwo@apollo \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=yhs@fb.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