[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f41a74e-06a6-4dc3-806b-a88783d26c8f@linux.dev>
Date: Tue, 3 Jun 2025 20:05:51 +0800
From: Tao Chen <chen.dylane@...ux.dev>
To: Quentin Monnet <qmo@...nel.org>, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
yonghong.song@...ux.dev, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...ichev.me, jolsa@...nel.org
Cc: bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 3/3] bpftool: Display cookie for raw_tp link
probe
在 2025/6/3 17:36, Quentin Monnet 写道:
> On 03/06/2025 03:26, Tao Chen wrote:
>> Display cookie for raw_tp link probe, in plain mode:
>>
>> #bpftool link
>>
>> 22: raw_tracepoint prog 14
>> tp 'sys_enter' cookie 23925373020405760
>> pids test_progs(176)
>>
>> And in json mode:
>>
>> #bpftool link -j | jq
>>
>> [
>> {
>> "id": 47,
>> "type": "raw_tracepoint",
>> "prog_id": 79,
>> "tp_name": "sys_enter",
>> "cookie": 23925373020405760,
>> "pids": [
>> {
>> "pid": 274,
>> "comm": "test_progs"
>> }
>> ]
>> }
>> ]
>>
>> Signed-off-by: Tao Chen <chen.dylane@...ux.dev>
>> ---
>> tools/bpf/bpftool/link.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
>> index 52fd2c9fac..bd37f364be 100644
>> --- a/tools/bpf/bpftool/link.c
>> +++ b/tools/bpf/bpftool/link.c
>> @@ -484,6 +484,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
>> case BPF_LINK_TYPE_RAW_TRACEPOINT:
>> jsonw_string_field(json_wtr, "tp_name",
>> u64_to_ptr(info->raw_tracepoint.tp_name));
>> + jsonw_lluint_field(json_wtr, "cookie", info->raw_tracepoint.cookie);
>> break;
>> case BPF_LINK_TYPE_TRACING:
>> err = get_prog_info(info->prog_id, &prog_info);
>> @@ -876,6 +877,8 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
>> case BPF_LINK_TYPE_RAW_TRACEPOINT:
>> printf("\n\ttp '%s' ",
>
>
> Nit: See how we use a double space at the end of the string here, to
> separate the different fields in the plain output...
>
>
>> (const char *)u64_to_ptr(info->raw_tracepoint.tp_name));
>> + if (info->raw_tracepoint.cookie)
>> + printf("cookie %llu ", info->raw_tracepoint.cookie);
>
>
> ... Please use a double space here in a similar way, at the end of your
> "cookie %llu " format string.
>
Will fix it in v3, thanks.
> Looks good otherwise. Thanks,
> Quentin
--
Best Regards
Tao Chen
Powered by blists - more mailing lists