[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3b326ea-8d79-47c1-82b7-a9f2f46ab0c3@kernel.org>
Date: Tue, 3 Jun 2025 10:36:46 +0100
From: Quentin Monnet <qmo@...nel.org>
To: Tao Chen <chen.dylane@...ux.dev>, 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
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.
Looks good otherwise. Thanks,
Quentin
Powered by blists - more mailing lists