From: Jiri Olsa <olsajiri@gmail•com>
To: Daniel Xu <dxu@dxuuu•xyz>
Cc: benjamin.tissoires@redhat•com, hawk@kernel•org,
edumazet@google•com, alexandre.torgue@foss•st.com,
ebiggers@kernel•org, tj@kernel•org, rostedt@goodmis•org,
shuah@kernel•org, martin.lau@linux•dev, ast@kernel•org,
fw@strlen•de, kuba@kernel•org, pablo@netfilter•org,
jikos@kernel•org, john.fastabend@gmail•com,
mcoquelin.stm32@gmail•com, mhiramat@kernel•org,
yonghong.song@linux•dev, Herbert Xu <herbert@gondor•apana.org.au>,
dsahern@kernel•org, hannes@cmpxchg•org, lizefan.x@bytedance•com,
pabeni@redhat•com, steffen.klassert@secunet•com,
daniel@iogearbox•net, tytso@mit•edu, andrii@kernel•org,
davem@davemloft•net, kadlec@netfilter•org, song@kernel•org,
alexei.starovoitov@gmail•com, olsajiri@gmail•com,
quentin@isovalent•com, alan.maguire@oracle•com, memxor@gmail•com,
kpsingh@kernel•org, sdf@google•com, haoluo@google•com,
mathieu.desnoyers@efficios•com, mykolal@fb•com,
linux-input@vger•kernel.org, linux-kernel@vger•kernel.org,
fsverity@lists•linux.dev, bpf@vger•kernel.org,
cgroups@vger•kernel.org, linux-trace-kernel@vger•kernel.org,
netdev@vger•kernel.org, netfilter-devel@vger•kernel.org,
coreteam@netfilter•org, linux-kselftest@vger•kernel.org,
linux-stm32@st-md-mailman•stormreply.com,
linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH bpf-next 2/2] bpf: treewide: Annotate BPF kfuncs in BTF
Date: Thu, 4 Jan 2024 12:41:51 +0100 [thread overview]
Message-ID: <ZZaZf_8RuX2xqZGf@krava> (raw)
In-Reply-To: <68d5598e5708dfe3370406cd5c946565ca4b50f1.1704324602.git.dxu@dxuuu.xyz>
On Wed, Jan 03, 2024 at 04:31:56PM -0700, Daniel Xu wrote:
SNIP
> diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
> index 88f914579fa1..771e29762a2d 100644
> --- a/include/linux/btf_ids.h
> +++ b/include/linux/btf_ids.h
> @@ -8,6 +8,9 @@ struct btf_id_set {
> u32 ids[];
> };
>
> +/* This flag implies BTF_SET8 holds kfunc(s) */
> +#define BTF_SET8_KFUNC (1 << 0)
> +
> struct btf_id_set8 {
> u32 cnt;
> u32 flags;
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 51e8b4bee0c8..b8ba00a4179f 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -7769,6 +7769,9 @@ static int __register_btf_kfunc_id_set(enum btf_kfunc_hook hook,
> struct btf *btf;
> int ret, i;
>
> + /* All kfuncs need to be tagged as such in BTF */
> + WARN_ON(!(kset->set->flags & BTF_SET8_KFUNC));
__register_btf_kfunc_id_set gets called also from the 'hooks' path:
bpf_mptcp_kfunc_init
register_btf_fmodret_id_set
__register_btf_kfunc_id_set
so it will hit the warn.. it should be probably in the register_btf_kfunc_id_set ?
also given that we can have modules calling register_btf_kfunc_id_set,
should we just return error instead of the warn?
SNIP
> diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> index 91907b321f91..32972334cd50 100644
> --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
> @@ -341,7 +341,7 @@ static struct bin_attribute bin_attr_bpf_testmod_file __ro_after_init = {
> .write = bpf_testmod_test_write,
> };
>
> -BTF_SET8_START(bpf_testmod_common_kfunc_ids)
> +BTF_SET8_START(bpf_testmod_common_kfunc_ids, BTF_SET8_KFUNC)
> BTF_ID_FLAGS(func, bpf_iter_testmod_seq_new, KF_ITER_NEW)
> BTF_ID_FLAGS(func, bpf_iter_testmod_seq_next, KF_ITER_NEXT | KF_RET_NULL)
> BTF_ID_FLAGS(func, bpf_iter_testmod_seq_destroy, KF_ITER_DESTROY)
we need to change also bpf_testmod_check_kfunc_ids set
jirka
> --
> 2.42.1
>
next prev parent reply other threads:[~2024-01-04 11:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-03 23:31 [PATCH bpf-next 0/2] Annotate kfuncs in .BTF_ids section Daniel Xu
2024-01-03 23:31 ` [PATCH bpf-next 2/2] bpf: treewide: Annotate BPF kfuncs in BTF Daniel Xu
2024-01-04 11:41 ` Jiri Olsa [this message]
2024-01-05 1:17 ` Daniel Xu
2024-01-05 2:37 ` Daniel Xu
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=ZZaZf_8RuX2xqZGf@krava \
--to=olsajiri@gmail$(echo .)com \
--cc=alan.maguire@oracle$(echo .)com \
--cc=alexandre.torgue@foss$(echo .)st.com \
--cc=alexei.starovoitov@gmail$(echo .)com \
--cc=andrii@kernel$(echo .)org \
--cc=ast@kernel$(echo .)org \
--cc=benjamin.tissoires@redhat$(echo .)com \
--cc=bpf@vger$(echo .)kernel.org \
--cc=cgroups@vger$(echo .)kernel.org \
--cc=coreteam@netfilter$(echo .)org \
--cc=daniel@iogearbox$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=dsahern@kernel$(echo .)org \
--cc=dxu@dxuuu$(echo .)xyz \
--cc=ebiggers@kernel$(echo .)org \
--cc=edumazet@google$(echo .)com \
--cc=fsverity@lists$(echo .)linux.dev \
--cc=fw@strlen$(echo .)de \
--cc=hannes@cmpxchg$(echo .)org \
--cc=haoluo@google$(echo .)com \
--cc=hawk@kernel$(echo .)org \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=jikos@kernel$(echo .)org \
--cc=john.fastabend@gmail$(echo .)com \
--cc=kadlec@netfilter$(echo .)org \
--cc=kpsingh@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-input@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-kselftest@vger$(echo .)kernel.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=linux-trace-kernel@vger$(echo .)kernel.org \
--cc=lizefan.x@bytedance$(echo .)com \
--cc=martin.lau@linux$(echo .)dev \
--cc=mathieu.desnoyers@efficios$(echo .)com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=memxor@gmail$(echo .)com \
--cc=mhiramat@kernel$(echo .)org \
--cc=mykolal@fb$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=pablo@netfilter$(echo .)org \
--cc=quentin@isovalent$(echo .)com \
--cc=rostedt@goodmis$(echo .)org \
--cc=sdf@google$(echo .)com \
--cc=shuah@kernel$(echo .)org \
--cc=song@kernel$(echo .)org \
--cc=steffen.klassert@secunet$(echo .)com \
--cc=tj@kernel$(echo .)org \
--cc=tytso@mit$(echo .)edu \
--cc=yonghong.song@linux$(echo .)dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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