From: Jiri Olsa <olsajiri@gmail.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: martin.lau@linux.dev, andrii@kernel.org, daniel@iogearbox.net,
ast@kernel.org, alexei.starovoitov@gmail.com, olsajiri@gmail.com,
quentin@isovalent.com, alan.maguire@oracle.com, memxor@gmail.com,
song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: btf: Support optional flags for BTF_SET8 sets
Date: Thu, 4 Jan 2024 12:23:03 +0100 [thread overview]
Message-ID: <ZZaVFxMvmMjbOlra@krava> (raw)
In-Reply-To: <29644dc7906c7c0e6843d8acf92c3e29089845d0.1704324602.git.dxu@dxuuu.xyz>
On Wed, Jan 03, 2024 at 04:31:55PM -0700, Daniel Xu wrote:
> This commit adds support for optional flags on BTF_SET8s.
> struct btf_id_set8 already supported 32 bits worth of flags, but was
> only used for alignment purposes before.
>
> We now use these bits to encode flags. The next commit will tag all
> kfunc sets with a flag so that pahole can recognize which
> BTF_ID_FLAGS(func, ..) are actual kfuncs.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
> include/linux/btf_ids.h | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
> index a9cb10b0e2e9..88f914579fa1 100644
> --- a/include/linux/btf_ids.h
> +++ b/include/linux/btf_ids.h
> @@ -183,17 +183,21 @@ extern struct btf_id_set name;
> * .word (1 << 3) | (1 << 1) | (1 << 2)
> *
> */
> -#define __BTF_SET8_START(name, scope) \
> +#define ___BTF_SET8_START(name, scope, flags) \
> asm( \
> ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
> "." #scope " __BTF_ID__set8__" #name "; \n" \
> "__BTF_ID__set8__" #name ":; \n" \
> -".zero 8 \n" \
> +".zero 4 \n" \
> +".long " #flags "\n" \
> ".popsection; \n");
>
> -#define BTF_SET8_START(name) \
> +#define __BTF_SET8_START(name, scope, flags, ...) \
> +___BTF_SET8_START(name, scope, flags)
> +
> +#define BTF_SET8_START(name, ...) \
> __BTF_ID_LIST(name, local) \
> -__BTF_SET8_START(name, local)
> +__BTF_SET8_START(name, local, ##__VA_ARGS__, 0)
I think it'd better to use something like:
BTF_SET8_KFUNCS_START(fsverity_set_ids)
instead of:
BTF_SET8_START(fsverity_set_ids, BTF_SET8_KFUNC)
and to keep current BTF_SET8_START without flags argument, like:
#define BTF_SET8_START(name) \
__BTF_SET8_START(... , 0, ...
#define BTF_SET8_KFUNCS_START(name) \
__BTF_SET8_START(... , BTF_SET8_KFUNC, ...
also I'd rename BTF_SET8_KFUNC to BTF_SET8_KFUNCS (with S)
do you have the pahole changes somewhere? would be great to
see all the related changes and try the whole thing
jirka
>
> #define BTF_SET8_END(name) \
> asm( \
> @@ -214,7 +218,7 @@ extern struct btf_id_set8 name;
> #define BTF_SET_START(name) static struct btf_id_set __maybe_unused name = { 0 };
> #define BTF_SET_START_GLOBAL(name) static struct btf_id_set __maybe_unused name = { 0 };
> #define BTF_SET_END(name)
> -#define BTF_SET8_START(name) static struct btf_id_set8 __maybe_unused name = { 0 };
> +#define BTF_SET8_START(name, ...) static struct btf_id_set8 __maybe_unused name = { 0 };
> #define BTF_SET8_END(name)
>
> #endif /* CONFIG_DEBUG_INFO_BTF */
> --
> 2.42.1
>
next prev parent reply other threads:[~2024-01-04 11:23 UTC|newest]
Thread overview: 10+ 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 ` Daniel Xu
2024-01-03 23:31 ` [PATCH bpf-next 1/2] bpf: btf: Support optional flags for BTF_SET8 sets Daniel Xu
2024-01-04 11:23 ` Jiri Olsa [this message]
2024-01-04 17:11 ` Alexei Starovoitov
2024-01-05 1:23 ` 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
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=ZZaVFxMvmMjbOlra@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=quentin@isovalent.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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.