BPF List
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Quentin Monnet <qmo@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Mykyta Yatsenko <yatsenko@meta.com>,
	Avinash Duduskar <avinash.duduskar@gmail.com>,
	Anton Protopopov <a.s.protopopov@gmail.com>,
	Amery Hung <ameryhung@gmail.com>, Jordan Rife <jordan@jrife.io>,
	Rong Tao <rongtao@cestc.cn>, Eyal Birger <eyal.birger@gmail.com>,
	Pu Lehui <pulehui@huawei.com>,
	Jingguo Tan <tanjingguo@huawei.com>, Lin Ma <malin89@huawei.com>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 00/13] bpf: Add tracing_multi link support for bpf progs
Date: Mon, 17 Aug 2026 14:20:17 +0800	[thread overview]
Message-ID: <0b30bc97-2ecf-46eb-a863-94e706e18c6b@linux.dev> (raw)
In-Reply-To: <CAEf4Bzam=0V6n4_vBahhYh2Qn9KfriDKXSz58L4L+teHJRWfPQ@mail.gmail.com>

On 15/8/26 04:14, Andrii Nakryiko wrote:
> On Sun, Aug 9, 2026 at 8:01 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>>
>> Similar to the tracing_multi link support for kernel functions [1], add
>> support for bpf progs.
>>
>> When attaching to bpf progs, it must attaches to the target by text poke
>> way.
>>
> 
> Please spend a bit more human effort on justification for the change
> and explaining your use case. In what case you'll be attaching to a
> large amount of BPF programs such that attachment speed-up (if there
> is any) matters.

Will update the cover letter with justification and my use case.

Here's my use case:

I'm planning to enhance the function-graph feature of bpfsnoop [1]. It
will trace all bpf progs, including their subprogs, to draw a full
function call graph including bpf prog call sites.

The attachment could speed-up when there are hundreds of targets. For
example, on high CPU core count servers, it probably runs 200 tc-bpf
progs as Kubernetes CNI, and each tc-bpf prog might have 4 subprogs.
Hence, there will be 1000 targets to trace for bpfsnoop's function-graph
feature.

With tracing_multi link support for bpf progs, bpfsnoop will be able to
attach to all targets quickly.

[1] https://github.com/bpfsnoop/bpfsnoop

> 
> Please do your homework. Generating code with AI is easy, reviewing

Sure, will do my homework.

> and making decisions about whether it's the right approach (and
> ultimately supporting it long term) is still a human process, so let's
> weigh that in.

Will keep it in mind.

Thanks,
Leon

> 
>> [1] https://lore.kernel.org/bpf/20260606123955.345967-1-jolsa@kernel.org/
>>
>> Leon Hwang (13):
>>   bpf: Initialize ftrace_managed in bpf_trampoline_get
>>   bpf: Factor out update_fentry_multi helper
>>   bpf: Drop unnecessary ftrace_location() in update_fentry_multi()
>>   bpf: Add tracing_multi link support for bpf progs
>>   libbpf: Add tracing_multi link support for bpf progs
>>   bpf: Add tracing_multi link fdinfo support for bpf progs
>>   bpf: Add tracing_multi link info support for bpf progs
>>   selftests/bpf: Add tracing_multi bpf prog attach test
>>   selftests/bpf: Add tracing_multi bpf prog attach failure tests
>>   selftests/bpf: Add tracing_multi bpf prog cookie test
>>   selftests/bpf: Add tracing_multi bpf prog rollback test
>>   selftests/bpf: Add tracing_multi bpf prog link info test
>>   selftests/bpf: Test tailcall with fentry.multi
>>
>>  include/linux/bpf.h                           |   3 +
>>  include/uapi/linux/bpf.h                      |   6 +-
>>  kernel/bpf/trampoline.c                       |  87 +++---
>>  kernel/bpf/verifier.c                         |  22 +-
>>  kernel/trace/bpf_trace.c                      | 212 ++++++++++++---
>>  tools/bpf/bpftool/link.c                      |  59 +++-
>>  tools/include/uapi/linux/bpf.h                |   6 +-
>>  tools/lib/bpf/bpf.c                           |   1 +
>>  tools/lib/bpf/bpf.h                           |   2 +
>>  tools/lib/bpf/libbpf.c                        |  39 ++-
>>  tools/lib/bpf/libbpf.h                        |   4 +-
>>  tools/lib/bpf/libbpf_internal.h               |   1 +
>>  .../selftests/bpf/prog_tests/fill_link_info.c | 170 ++++++++++--
>>  .../selftests/bpf/prog_tests/tailcalls.c      |  62 +++++
>>  .../selftests/bpf/prog_tests/tracing_multi.c  | 254 ++++++++++++++++++
>>  .../selftests/bpf/progs/tracing_multi_bpf.c   |  61 +++++
>>  16 files changed, 869 insertions(+), 120 deletions(-)
>>  create mode 100644 tools/testing/selftests/bpf/progs/tracing_multi_bpf.c
>>
>> --
>> 2.55.0


      parent reply	other threads:[~2026-08-17  6:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09 15:00 [PATCH bpf-next 00/13] bpf: Add tracing_multi link support for bpf progs Leon Hwang
2026-08-09 15:00 ` [PATCH bpf-next 01/13] bpf: Initialize ftrace_managed in bpf_trampoline_get Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 02/13] bpf: Factor out update_fentry_multi helper Leon Hwang
2026-08-09 15:14   ` sashiko-bot
2026-08-12  4:02     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 03/13] bpf: Drop unnecessary ftrace_location() in update_fentry_multi() Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 04/13] bpf: Add tracing_multi link support for bpf progs Leon Hwang
2026-08-09 15:33   ` sashiko-bot
2026-08-12  4:03     ` Leon Hwang
2026-08-10 13:13   ` Jiri Olsa
2026-08-11  6:12     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 05/13] libbpf: " Leon Hwang
2026-08-09 15:21   ` sashiko-bot
2026-08-12  4:03     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 06/13] bpf: Add tracing_multi link fdinfo " Leon Hwang
2026-08-09 16:20   ` bot+bpf-ci
2026-08-12  4:04     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 07/13] bpf: Add tracing_multi link info " Leon Hwang
2026-08-09 15:17   ` sashiko-bot
2026-08-12  4:05     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 08/13] selftests/bpf: Add tracing_multi bpf prog attach test Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 09/13] selftests/bpf: Add tracing_multi bpf prog attach failure tests Leon Hwang
2026-08-09 15:17   ` sashiko-bot
2026-08-12  4:06     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 10/13] selftests/bpf: Add tracing_multi bpf prog cookie test Leon Hwang
2026-08-09 16:20   ` bot+bpf-ci
2026-08-12  4:06     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 11/13] selftests/bpf: Add tracing_multi bpf prog rollback test Leon Hwang
2026-08-09 15:21   ` sashiko-bot
2026-08-12  4:07     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 12/13] selftests/bpf: Add tracing_multi bpf prog link info test Leon Hwang
2026-08-09 15:29   ` sashiko-bot
2026-08-12  4:08     ` Leon Hwang
2026-08-09 15:01 ` [PATCH bpf-next 13/13] selftests/bpf: Test tailcall with fentry.multi Leon Hwang
     [not found] ` <CAEf4Bzam=0V6n4_vBahhYh2Qn9KfriDKXSz58L4L+teHJRWfPQ@mail.gmail.com>
2026-08-17  6:20   ` Leon Hwang [this message]

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=0b30bc97-2ecf-46eb-a863-94e706e18c6b@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=a.s.protopopov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=avinash.duduskar@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=eyal.birger@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=jordan@jrife.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=malin89@huawei.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=pulehui@huawei.com \
    --cc=qmo@kernel.org \
    --cc=rongtao@cestc.cn \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tanjingguo@huawei.com \
    --cc=yatsenko@meta.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox