linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Clean up individual BTF_ID code
@ 2025-07-09  8:20 Feng Yang
  2025-07-09  8:58 ` Jiri Olsa
  0 siblings, 1 reply; 3+ messages in thread
From: Feng Yang @ 2025-07-09  8:20 UTC (permalink / raw)
  To: martin.lau, ast, daniel, andrii, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, mattbobrowski,
	rostedt, mhiramat
  Cc: bpf, linux-kernel, linux-trace-kernel

From: Feng Yang <yangfeng@kylinos.cn>

Use BTF_ID_LIST_SINGLE(a, b, c) instead of
BTF_ID_LIST(a)
BTF_ID(b, c)

Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
---
 kernel/bpf/btf.c         | 3 +--
 kernel/bpf/link_iter.c   | 3 +--
 kernel/bpf/prog_iter.c   | 3 +--
 kernel/trace/bpf_trace.c | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 2dd13eea7b0e..0aff814cb53a 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6200,8 +6200,7 @@ int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_ty
 	return kctx_type_id;
 }
 
-BTF_ID_LIST(bpf_ctx_convert_btf_id)
-BTF_ID(struct, bpf_ctx_convert)
+BTF_ID_LIST_SINGLE(bpf_ctx_convert_btf_id, struct, bpf_ctx_convert)
 
 static struct btf *btf_parse_base(struct btf_verifier_env *env, const char *name,
 				  void *data, unsigned int data_size)
diff --git a/kernel/bpf/link_iter.c b/kernel/bpf/link_iter.c
index fec8005a121c..8158e9c1af7b 100644
--- a/kernel/bpf/link_iter.c
+++ b/kernel/bpf/link_iter.c
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_link_seq_ops = {
 	.show	= bpf_link_seq_show,
 };
 
-BTF_ID_LIST(btf_bpf_link_id)
-BTF_ID(struct, bpf_link)
+BTF_ID_LIST_SINGLE(btf_bpf_link_id, struct, bpf_link)
 
 static const struct bpf_iter_seq_info bpf_link_seq_info = {
 	.seq_ops		= &bpf_link_seq_ops,
diff --git a/kernel/bpf/prog_iter.c b/kernel/bpf/prog_iter.c
index 53a73c841c13..85d8fcb56fb7 100644
--- a/kernel/bpf/prog_iter.c
+++ b/kernel/bpf/prog_iter.c
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_prog_seq_ops = {
 	.show	= bpf_prog_seq_show,
 };
 
-BTF_ID_LIST(btf_bpf_prog_id)
-BTF_ID(struct, bpf_prog)
+BTF_ID_LIST_SINGLE(btf_bpf_prog_id, struct, bpf_prog)
 
 static const struct bpf_iter_seq_info bpf_prog_seq_info = {
 	.seq_ops		= &bpf_prog_seq_ops,
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index e7f97a9a8bbd..c8162dc89dc3 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -781,8 +781,7 @@ BPF_CALL_1(bpf_task_pt_regs, struct task_struct *, task)
 	return (unsigned long) task_pt_regs(task);
 }
 
-BTF_ID_LIST(bpf_task_pt_regs_ids)
-BTF_ID(struct, pt_regs)
+BTF_ID_LIST_SINGLE(bpf_task_pt_regs_ids, struct, pt_regs)
 
 const struct bpf_func_proto bpf_task_pt_regs_proto = {
 	.func		= bpf_task_pt_regs,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: Clean up individual BTF_ID code
  2025-07-09  8:20 [PATCH bpf-next] bpf: Clean up individual BTF_ID code Feng Yang
@ 2025-07-09  8:58 ` Jiri Olsa
  2025-07-09  9:11   ` Feng Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Olsa @ 2025-07-09  8:58 UTC (permalink / raw)
  To: Feng Yang
  Cc: martin.lau, ast, daniel, andrii, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, mattbobrowski, rostedt,
	mhiramat, bpf, linux-kernel, linux-trace-kernel

On Wed, Jul 09, 2025 at 04:20:38PM +0800, Feng Yang wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
> 
> Use BTF_ID_LIST_SINGLE(a, b, c) instead of
> BTF_ID_LIST(a)
> BTF_ID(b, c)

there's couple more in:

net/ipv6/route.c
net/netlink/af_netlink.c
net/sched/bpf_qdisc.c

jirka


> 
> Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
> ---
>  kernel/bpf/btf.c         | 3 +--
>  kernel/bpf/link_iter.c   | 3 +--
>  kernel/bpf/prog_iter.c   | 3 +--
>  kernel/trace/bpf_trace.c | 3 +--
>  4 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 2dd13eea7b0e..0aff814cb53a 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6200,8 +6200,7 @@ int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_ty
>  	return kctx_type_id;
>  }
>  
> -BTF_ID_LIST(bpf_ctx_convert_btf_id)
> -BTF_ID(struct, bpf_ctx_convert)
> +BTF_ID_LIST_SINGLE(bpf_ctx_convert_btf_id, struct, bpf_ctx_convert)
>  
>  static struct btf *btf_parse_base(struct btf_verifier_env *env, const char *name,
>  				  void *data, unsigned int data_size)
> diff --git a/kernel/bpf/link_iter.c b/kernel/bpf/link_iter.c
> index fec8005a121c..8158e9c1af7b 100644
> --- a/kernel/bpf/link_iter.c
> +++ b/kernel/bpf/link_iter.c
> @@ -78,8 +78,7 @@ static const struct seq_operations bpf_link_seq_ops = {
>  	.show	= bpf_link_seq_show,
>  };
>  
> -BTF_ID_LIST(btf_bpf_link_id)
> -BTF_ID(struct, bpf_link)
> +BTF_ID_LIST_SINGLE(btf_bpf_link_id, struct, bpf_link)
>  
>  static const struct bpf_iter_seq_info bpf_link_seq_info = {
>  	.seq_ops		= &bpf_link_seq_ops,
> diff --git a/kernel/bpf/prog_iter.c b/kernel/bpf/prog_iter.c
> index 53a73c841c13..85d8fcb56fb7 100644
> --- a/kernel/bpf/prog_iter.c
> +++ b/kernel/bpf/prog_iter.c
> @@ -78,8 +78,7 @@ static const struct seq_operations bpf_prog_seq_ops = {
>  	.show	= bpf_prog_seq_show,
>  };
>  
> -BTF_ID_LIST(btf_bpf_prog_id)
> -BTF_ID(struct, bpf_prog)
> +BTF_ID_LIST_SINGLE(btf_bpf_prog_id, struct, bpf_prog)
>  
>  static const struct bpf_iter_seq_info bpf_prog_seq_info = {
>  	.seq_ops		= &bpf_prog_seq_ops,
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index e7f97a9a8bbd..c8162dc89dc3 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -781,8 +781,7 @@ BPF_CALL_1(bpf_task_pt_regs, struct task_struct *, task)
>  	return (unsigned long) task_pt_regs(task);
>  }
>  
> -BTF_ID_LIST(bpf_task_pt_regs_ids)
> -BTF_ID(struct, pt_regs)
> +BTF_ID_LIST_SINGLE(bpf_task_pt_regs_ids, struct, pt_regs)
>  
>  const struct bpf_func_proto bpf_task_pt_regs_proto = {
>  	.func		= bpf_task_pt_regs,
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: Clean up individual BTF_ID code
  2025-07-09  8:58 ` Jiri Olsa
@ 2025-07-09  9:11   ` Feng Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Feng Yang @ 2025-07-09  9:11 UTC (permalink / raw)
  To: olsajiri
  Cc: andrii, ast, bpf, daniel, eddyz87, haoluo, john.fastabend,
	kpsingh, linux-kernel, linux-trace-kernel, martin.lau,
	mattbobrowski, mhiramat, rostedt, sdf, song, yangfeng59949,
	yonghong.song

Date: Wed, 9 Jul 2025 10:58:28 +0200 Jiri Olsa <olsajiri@gmail.com> wrote:

> On Wed, Jul 09, 2025 at 04:20:38PM +0800, Feng Yang wrote:
> > From: Feng Yang <yangfeng@kylinos.cn>
> > 
> > Use BTF_ID_LIST_SINGLE(a, b, c) instead of
> > BTF_ID_LIST(a)
> > BTF_ID(b, c)
> 
> there's couple more in:
> 
> net/ipv6/route.c
> net/netlink/af_netlink.c
> net/sched/bpf_qdisc.c
> 
> jirka
> 

I see. Can all of these be included in one patch? 
There's also one in kernel/kallsyms.c.

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-09  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09  8:20 [PATCH bpf-next] bpf: Clean up individual BTF_ID code Feng Yang
2025-07-09  8:58 ` Jiri Olsa
2025-07-09  9:11   ` Feng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).