All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Ratheesh Kannoth <rkannoth@marvell.com>
Cc: Jose Fernandez <josef@netflix.com>,
	Alexei Starovoitov <ast@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	 Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	 Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	 KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	 Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	 "open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	Tycho Andersen <tycho@tycho.pizza>
Subject: Re: [PATCH V2 bpf-next 2/2] selftests/bpf: add selftest for bpf_task_get_cgroup
Date: Sun, 17 Mar 2024 20:15:31 -0700	[thread overview]
Message-ID: <CAADnVQ+9s3yCR2eLL=b_Mqrv37VB_mywa9cnbE=+X_E8VcFBKA@mail.gmail.com> (raw)
In-Reply-To: <20240318031025.GA1312616@maili.marvell.com>

On Sun, Mar 17, 2024 at 8:10 PM Ratheesh Kannoth <rkannoth@marvell.com> wrote:
>
> On 2024-03-16 at 21:52:41, Jose Fernandez (josef@netflix.com) wrote:
> > This patch adds a selftest for the `bpf_task_get_cgroup` kfunc. The test
> > focuses on the use case of obtaining the cgroup ID of the previous task
> > in a `sched_switch` tracepoint.
> >
> > The selftest involves creating a test cgroup, attaching a BPF program
> > that utilizes the `bpf_task_get_cgroup` during a `sched_switch`
> > tracepoint, and validating that the obtained cgroup ID for the previous
> > task matches the expected cgroup ID.
> >
> > Signed-off-by: Jose Fernandez <josef@netflix.com>
> > Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
> > ---
> > V1 -> V2: Refactor test to work with a cgroup pointer instead of the ID
> >
> >  .../bpf/prog_tests/task_get_cgroup.c          | 58 +++++++++++++++++++
> >  .../bpf/progs/test_task_get_cgroup.c          | 37 ++++++++++++
> >  2 files changed, 95 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> >  create mode 100644 tools/testing/selftests/bpf/progs/test_task_get_cgroup.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c b/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> > new file mode 100644
> > index 000000000000..67ed65d0c461
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> > @@ -0,0 +1,58 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +// Copyright 2024 Netflix, Inc.
> > +
> > +#include <test_progs.h>
> > +#include <cgroup_helpers.h>
> > +#include "test_task_get_cgroup.skel.h"
> > +#include <unistd.h>
> > +
> > +#define TEST_CGROUP "/test-task-get-cgroup/"
> > +
> > +void test_task_get_cgroup(void)
> > +{
> > +     struct test_task_get_cgroup *skel;
> > +     int err, fd;
> > +     pid_t pid;
> > +     __u64 cgroup_id, expected_cgroup_id;
> > +     const struct timespec req = {
> > +             .tv_sec = 1,
> > +             .tv_nsec = 0,
> > +     };
> Reverse Xmas tree.

NO. We don't do it in bpf trees.

  reply	other threads:[~2024-03-18  3:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16 16:22 [PATCH V2 bpf-next 1/2] bpf: add bpf_task_get_cgroup kfunc Jose Fernandez
2024-03-16 16:22 ` [PATCH V2 bpf-next 2/2] selftests/bpf: add selftest for bpf_task_get_cgroup Jose Fernandez
2024-03-18  3:10   ` Ratheesh Kannoth
2024-03-18  3:15     ` Alexei Starovoitov [this message]
2024-03-18  9:58   ` Jiri Olsa
2024-03-19  0:30     ` Jose Fernandez
2024-03-18 15:54 ` [PATCH V2 bpf-next 1/2] bpf: add bpf_task_get_cgroup kfunc Yonghong Song
2024-03-18 16:07 ` Stanislav Fomichev

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='CAADnVQ+9s3yCR2eLL=b_Mqrv37VB_mywa9cnbE=+X_E8VcFBKA@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=josef@netflix.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=rkannoth@marvell.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tycho@tycho.pizza \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.