From: Martin KaFai Lau <martin.lau@linux.dev>
To: thinker.li@gmail.com
Cc: sinquersw@gmail.com, kuifeng@meta.com, bpf@vger.kernel.org,
ast@kernel.org, song@kernel.org, kernel-team@meta.com,
andrii@kernel.org, davemarchevsky@meta.com, dvernet@meta.com
Subject: Re: [PATCH bpf-next v8 1/4] bpf: add btf pointer to struct bpf_ctx_arg_aux.
Date: Sun, 11 Feb 2024 10:59:00 -0800 [thread overview]
Message-ID: <a2f58a16-ace4-4a1f-aab0-35aeff0e77fa@linux.dev> (raw)
In-Reply-To: <20240209023750.1153905-2-thinker.li@gmail.com>
On 2/8/24 6:37 PM, thinker.li@gmail.com wrote:
> From: Kui-Feng Lee <thinker.li@gmail.com>
>
> Enable the providers to use types defined in a module instead of in the
> kernel (btf_vmlinux).
>
> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
> ---
> include/linux/bpf.h | 1 +
> kernel/bpf/btf.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 1ebbee1d648e..9a2ee9456989 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -1416,6 +1416,7 @@ struct bpf_ctx_arg_aux {
> u32 offset;
> enum bpf_reg_type reg_type;
> u32 btf_id;
> + struct btf *btf;
It will leave a 4 bytes hole. Not a big deal considering the sizeof won't change
regardless but still would be nice to avoid it.
Moving "struct btf *btf" to the top will need code churns in all the existing
bpf_iter_* because they do not use the ".offset = " and ".reg_type = " style to
initialize. I am going to move this pointer addition before the "u32 btf_id;"
instead. No need to resend.
> };
>
> struct btf_mod_pair {
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 8e06d29961f1..7c6c9fefdbd6 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6266,7 +6266,7 @@ bool btf_ctx_access(int off, int size, enum bpf_access_type type,
> }
>
> info->reg_type = ctx_arg_info->reg_type;
> - info->btf = btf_vmlinux;
> + info->btf = ctx_arg_info->btf ? ctx_arg_info->btf : btf_vmlinux;
> info->btf_id = ctx_arg_info->btf_id;
> return true;
> }
next prev parent reply other threads:[~2024-02-11 18:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 2:37 [PATCH bpf-next v8 0/4] Support PTR_MAYBE_NULL for struct_ops arguments thinker.li
2024-02-09 2:37 ` [PATCH bpf-next v8 1/4] bpf: add btf pointer to struct bpf_ctx_arg_aux thinker.li
2024-02-11 18:59 ` Martin KaFai Lau [this message]
2024-02-09 2:37 ` [PATCH bpf-next v8 2/4] bpf: Move __kfunc_param_match_suffix() to btf.c thinker.li
2024-02-09 2:37 ` [PATCH bpf-next v8 3/4] bpf: Create argument information for nullable arguments thinker.li
2024-02-11 19:49 ` Martin KaFai Lau
2024-02-12 17:09 ` Kui-Feng Lee
2024-02-12 11:45 ` Jiri Olsa
2024-02-12 17:50 ` Kui-Feng Lee
2024-02-13 23:27 ` Martin KaFai Lau
2024-02-09 2:37 ` [PATCH bpf-next v8 4/4] selftests/bpf: Test PTR_MAYBE_NULL arguments of struct_ops operators thinker.li
2024-02-13 23:30 ` [PATCH bpf-next v8 0/4] Support PTR_MAYBE_NULL for struct_ops arguments patchwork-bot+netdevbpf
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=a2f58a16-ace4-4a1f-aab0-35aeff0e77fa@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davemarchevsky@meta.com \
--cc=dvernet@meta.com \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=sinquersw@gmail.com \
--cc=song@kernel.org \
--cc=thinker.li@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.