From: Jiri Olsa <olsajiri@gmail.com>
To: Tao Chen <chen.dylane@linux.dev>
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 v2 2/3] selftests/bpf: Add cookies check for raw_tp fill_link_info test
Date: Tue, 3 Jun 2025 14:19:26 +0200 [thread overview]
Message-ID: <aD7oTouJgXoOru_g@krava> (raw)
In-Reply-To: <20250603022610.3005963-2-chen.dylane@linux.dev>
On Tue, Jun 03, 2025 at 10:26:09AM +0800, Tao Chen wrote:
> Adding tests for getting cookie with fill_link_info for raw_tp.
>
> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
> ---
> .../selftests/bpf/prog_tests/bpf_cookie.c | 26 ++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> index 6befa87043..0774ae6c1b 100644
> --- a/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_cookie.c
> @@ -635,10 +635,29 @@ static void tp_btf_subtest(struct test_bpf_cookie *skel)
> bpf_link__destroy(link);
> }
>
> +static int verify_raw_tp_link_info(int fd, u64 cookie)
> +{
> + struct bpf_link_info info;
> + int err;
> + u32 len = sizeof(info);
> +
> + memset(&info, 0, sizeof(info));
> + err = bpf_link_get_info_by_fd(fd, &info, &len);
> + if (!ASSERT_OK(err, "get_link_info"))
> + return -1;
> +
> + if (!ASSERT_EQ(info.type, BPF_LINK_TYPE_RAW_TRACEPOINT, "link_type"))
> + return -1;
> +
> + ASSERT_EQ(info.raw_tracepoint.cookie, cookie, "raw_tp_cookie");
> +
> + return 0;
> +}
> +
> static void raw_tp_subtest(struct test_bpf_cookie *skel)
> {
> __u64 cookie;
> - int prog_fd, link_fd = -1;
> + int err, prog_fd, link_fd = -1;
> struct bpf_link *link = NULL;
> LIBBPF_OPTS(bpf_raw_tp_opts, raw_tp_opts);
> LIBBPF_OPTS(bpf_raw_tracepoint_opts, opts);
> @@ -656,6 +675,11 @@ static void raw_tp_subtest(struct test_bpf_cookie *skel)
> goto cleanup;
>
> usleep(1); /* trigger */
> +
> + err = verify_raw_tp_link_info(link_fd, cookie);
> + if (!ASSERT_OK(err, "verify_raw_tp_link_info"))
> + goto cleanup;
> +
> close(link_fd); /* detach */
> link_fd = -1;
>
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2025-06-03 12:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 2:26 [PATCH bpf-next v2 1/3] bpf: Add cookie to raw_tp bpf_link_info 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 [this message]
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
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=aD7oTouJgXoOru_g@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chen.dylane@linux.dev \
--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=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