mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Yonghong Song <yonghong.song@linux.dev>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	qmo@kernel.org, jolsa@kernel.org
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Add cookie to raw_tp bpf_link_info
Date: Tue, 3 Jun 2025 23:07:03 +0800	[thread overview]
Message-ID: <029e657a-cbf5-4db1-9ddb-5fbf75ea8f4e@linux.dev> (raw)
In-Reply-To: <48e85d82-e5c7-463a-aef3-f1ecbe863524@linux.dev>

在 2025/6/3 22:52, Yonghong Song 写道:
> 
> 
> On 6/2/25 7:26 PM, Tao Chen wrote:
>> After commit 68ca5d4eebb8 ("bpf: support BPF cookie in raw tracepoint
>> (raw_tp, tp_btf) programs"), we can show the cookie in bpf_link_info
>> like kprobe etc.
>>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>>   include/uapi/linux/bpf.h       | 2 ++
>>   kernel/bpf/syscall.c           | 1 +
>>   tools/include/uapi/linux/bpf.h | 2 ++
>>   3 files changed, 5 insertions(+)
>>
>> Change list:
>> - v1 -> v2:
>>      - fill the hole in bpf_link_info.(Jiri)
>> - v1:
>>      https://lore.kernel.org/bpf/20250529165759.2536245-1- 
>> chen.dylane@linux.dev
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 07ee73cdf9..f3e2aae302 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -6644,6 +6644,8 @@ struct bpf_link_info {
>>           struct {
>>               __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
>>               __u32 tp_name_len;     /* in/out: tp_name buffer len */
>> +            __u32 reserved; /* just fill the hole */
> 
> See various examples in uapi/linux/bpf.h, '__u32 :32;' is the preferred
> apporach to fill the hole.

Well, it looks better, will change it in v3, thanks.

> 
>> +            __u64 cookie;
>>           } raw_tracepoint;
>>           struct {
>>               __u32 attach_type;
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index 9794446bc8..1c3dbe44ac 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -3687,6 +3687,7 @@ static int bpf_raw_tp_link_fill_link_info(const 
>> struct bpf_link *link,
>>           return -EINVAL;
>>       info->raw_tracepoint.tp_name_len = tp_len + 1;
>> +    info->raw_tracepoint.cookie = raw_tp_link->cookie;
>>       if (!ubuf)
>>           return 0;
>> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/ 
>> linux/bpf.h
>> index 07ee73cdf9..f3e2aae302 100644
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -6644,6 +6644,8 @@ struct bpf_link_info {
>>           struct {
>>               __aligned_u64 tp_name; /* in/out: tp_name buffer ptr */
>>               __u32 tp_name_len;     /* in/out: tp_name buffer len */
>> +            __u32 reserved; /* just fill the hole */
>> +            __u64 cookie;
>>           } raw_tracepoint;
>>           struct {
>>               __u32 attach_type;
> 


-- 
Best Regards
Tao Chen

  reply	other threads:[~2025-06-03 15:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03  2:26 Tao Chen
2025-06-03  2:26 ` [PATCH bpf-next v2 2/3] selftests/bpf: Add cookies check for raw_tp fill_link_info test Tao Chen
2025-06-03 12:19   ` Jiri Olsa
2025-06-03  2:26 ` [PATCH bpf-next v2 3/3] bpftool: Display cookie for raw_tp link probe Tao Chen
2025-06-03  9:36   ` Quentin Monnet
2025-06-03 12:05     ` Tao Chen
2025-06-03 12:19 ` [PATCH bpf-next v2 1/3] bpf: Add cookie to raw_tp bpf_link_info Jiri Olsa
2025-06-03 14:52 ` Yonghong Song
2025-06-03 15:07   ` Tao Chen [this message]
2025-06-03 16:12     ` Jiri Olsa

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=029e657a-cbf5-4db1-9ddb-5fbf75ea8f4e@linux.dev \
    --to=chen.dylane@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=qmo@kernel.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

all inboxes | Powered by JetHome®