bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@fomichev.me, qmo@kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/3] bpf: Add cookie to raw_tp bpf_link_info
Date: Sun, 1 Jun 2025 14:57:39 +0800	[thread overview]
Message-ID: <44c3a765-4300-44c8-a3fb-eef8f4b7c39f@linux.dev> (raw)
In-Reply-To: <aDq-F9nK4K74ubjo@krava>

在 2025/5/31 16:30, Jiri Olsa 写道:
> On Fri, May 30, 2025 at 12:57:57AM +0800, 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       | 1 +
>>   kernel/bpf/syscall.c           | 1 +
>>   tools/include/uapi/linux/bpf.h | 1 +
>>   3 files changed, 3 insertions(+)
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 07ee73cdf9..7d0ad5c2b6 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -6644,6 +6644,7 @@ 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 */
> 
> there's hole now in here, let's add something like
> 
>    __u32 reserved;
> 

Sounds good, i will add it in v2, thanks.

> jirka
> 
> 
>> +			__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..7d0ad5c2b6 100644
>> --- a/tools/include/uapi/linux/bpf.h
>> +++ b/tools/include/uapi/linux/bpf.h
>> @@ -6644,6 +6644,7 @@ 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 */
>> +			__u64 cookie;
>>   		} raw_tracepoint;
>>   		struct {
>>   			__u32 attach_type;
>> -- 
>> 2.43.0
>>


-- 
Best Regards
Tao Chen

      reply	other threads:[~2025-06-01  6:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 16:57 [PATCH bpf-next 1/3] bpf: Add cookie to raw_tp bpf_link_info Tao Chen
2025-05-29 16:57 ` [PATCH bpf-next 2/3] selftests/bpf: Add cookies check for raw_tp fill_link_info test Tao Chen
2025-05-29 16:57 ` [PATCH bpf-next 3/3] bpftool: Display cookie for raw_tp link probe Tao Chen
2025-05-29 17:11   ` Alexei Starovoitov
2025-05-29 17:50     ` Tao Chen
2025-05-31  8:30 ` [PATCH bpf-next 1/3] bpf: Add cookie to raw_tp bpf_link_info Jiri Olsa
2025-06-01  6:57   ` 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=44c3a765-4300-44c8-a3fb-eef8f4b7c39f@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=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=olsajiri@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).