Re: [PATCH bpf-next 2/2] selftests/bpf: Add selftest for sleepable bpf_task_under_cgroup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 6, 2023 at 1:13 AM Stanislav Fomichev <sdf@xxxxxxxxxx> wrote:
>
> On 10/05, Yafang Shao wrote:
> > The result as follows,
> >
> >   $ tools/testing/selftests/bpf/test_progs --name=task_under_cgroup
> >   #237     task_under_cgroup:OK
> >   Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
> >
> > And no error messages in dmesg.
> >
> > Without the prev patch, there will be RCU warnings in dmesg.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> > ---
> >  .../selftests/bpf/prog_tests/task_under_cgroup.c   |  8 +++++--
> >  .../selftests/bpf/progs/test_task_under_cgroup.c   | 28 +++++++++++++++++++++-
> >  2 files changed, 33 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c b/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> > index 4224727..d1a5a5c 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> > @@ -30,8 +30,12 @@ void test_task_under_cgroup(void)
> >       if (!ASSERT_OK(ret, "test_task_under_cgroup__load"))
> >               goto cleanup;
> >
> > -     ret = test_task_under_cgroup__attach(skel);
> > -     if (!ASSERT_OK(ret, "test_task_under_cgroup__attach"))
> > +     skel->links.lsm_run = bpf_program__attach_lsm(skel->progs.lsm_run);
> > +     if (!ASSERT_OK_PTR(skel->links.lsm_run, "attach_lsm"))
> > +             goto cleanup;
> > +
>
> So we rely on the second attach here to trigger the program above?

Right.

> Maybe add a comment? Otherwise we might risk loosing this dependency
> after some refactoring...

Sure. will add a comment.

>
> Other than that, both patches look good to me, feel free to use for both
> if/when you resend:
>
> Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>

Thanks for your review.

-- 
Regards
Yafang





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux