BPF List
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Matt Bobrowski <mattbobrowski@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	linux-trace-kernel <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v6 1/3] bpf: Show precise link_type for {uprobe,kprobe}_multi fdinfo
Date: Wed, 2 Jul 2025 10:14:58 +0800	[thread overview]
Message-ID: <983eacae-5b5d-4d26-a3e4-3c3eb808c5f2@linux.dev> (raw)
In-Reply-To: <CAADnVQLWZH0sQk6ni-AWb+SRJ+H_sE=Gvwn3wdu+UC=mJiPPrg@mail.gmail.com>

在 2025/7/2 04:39, Alexei Starovoitov 写道:
> On Fri, Jun 27, 2025 at 1:23 AM Tao Chen <chen.dylane@linux.dev> wrote:
>>
>> Alexei suggested, 'link_type' can be more precise and differentiate
>> for human in fdinfo. In fact BPF_LINK_TYPE_KPROBE_MULTI includes
>> kretprobe_multi type, the same as BPF_LINK_TYPE_UPROBE_MULTI, so we
>> can show it more concretely.
>>
>> link_type:      kprobe_multi
>> link_id:        1
>> prog_tag:       d2b307e915f0dd37
>> ...
>> link_type:      kretprobe_multi
>> link_id:        2
>> prog_tag:       ab9ea0545870781d
>> ...
>> link_type:      uprobe_multi
>> link_id:        9
>> prog_tag:       e729f789e34a8eca
>> ...
>> link_type:      uretprobe_multi
>> link_id:        10
>> prog_tag:       7db356c03e61a4d4
>>
>> As Andrii suggested attach_type can be recorded in bpf_link, there is
>> still a 6 byte hole in bpf_link, we can fill the hole with attach_type
>> soon.
>>
>> Co-authored-by: Jiri Olsa <jolsa@kernel.org>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>>   include/linux/bpf.h      |  1 +
>>   kernel/bpf/syscall.c     |  9 ++++++++-
>>   kernel/trace/bpf_trace.c | 10 ++++------
>>   3 files changed, 13 insertions(+), 7 deletions(-)
>>
>> Change list:
>>    v5 -> v6:
>>      - Move flags into bpf_link to get retprobe info
>>        directly.(Alexei, Jiri)
>>    v5:
>>    https://lore.kernel.org/bpf/20250623134342.227347-1-chen.dylane@linux.dev
>>
>>    v4 -> v5:
>>      - Add patch1 to show precise link_type for
>>        {uprobe,kprobe}_multi.(Alexei)
>>      - patch2,3 just remove type field, which will be showed in
>>        link_type
>>    v4:
>>    https://lore.kernel.org/bpf/20250619034257.70520-1-chen.dylane@linux.dev
>>
>>    v3 -> v4:
>>      - use %pS to print func info.(Alexei)
>>    v3:
>>    https://lore.kernel.org/bpf/20250616130233.451439-1-chen.dylane@linux.dev
>>
>>    v2 -> v3:
>>      - show info in one line for multi events.(Jiri)
>>    v2:
>>    https://lore.kernel.org/bpf/20250615150514.418581-1-chen.dylane@linux.dev
>>
>>    v1 -> v2:
>>      - replace 'func_cnt' with 'uprobe_cnt'.(Andrii)
>>      - print func name is more readable and security for kprobe_multi.(Alexei)
>>    v1:
>>    https://lore.kernel.org/bpf/20250612115556.295103-1-chen.dylane@linux.dev
>>
>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> index 5b25d278409..3d8fecc9b17 100644
>> --- a/include/linux/bpf.h
>> +++ b/include/linux/bpf.h
>> @@ -1702,6 +1702,7 @@ struct bpf_link {
>>           * link's semantics is determined by target attach hook
>>           */
>>          bool sleepable;
>> +       u32 flags :8;
> 
> There is a 7-byte hole here.
> Let's use 'u32 flags' right now and optimize later if necessary.

Ok, will change it in v7.

-- 
Best Regards
Tao Chen

      reply	other threads:[~2025-07-02  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27  8:22 [PATCH bpf-next v6 1/3] bpf: Show precise link_type for {uprobe,kprobe}_multi fdinfo Tao Chen
2025-06-27  8:22 ` [PATCH bpf-next v6 2/3] bpf: Add show_fdinfo for uprobe_multi Tao Chen
2025-06-27  8:22 ` [PATCH bpf-next v6 3/3] bpf: Add show_fdinfo for kprobe_multi Tao Chen
2025-07-01 20:37   ` Andrii Nakryiko
2025-07-02  2:48     ` Tao Chen
2025-07-01 20:39 ` [PATCH bpf-next v6 1/3] bpf: Show precise link_type for {uprobe,kprobe}_multi fdinfo Alexei Starovoitov
2025-07-02  2:14   ` Tao Chen [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=983eacae-5b5d-4d26-a3e4-3c3eb808c5f2@linux.dev \
    --to=chen.dylane@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox