Re: [PATCH bpf-next 2/2] Added selftests to check deadlocks in queue and stack map

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

 



On Mon, 29 Apr 2024 at 13:55, Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote:
>
> On Mon, 29 Apr 2024 at 18:57, Siddharth Chintamaneni
> <sidchintamaneni@xxxxxxxxx> wrote:
> >
> > From: Siddharth Chintamaneni <sidchintamaneni@xxxxxx>
> >
> >  Added selftests to check for nested deadlocks in queue
> >  and stack maps.
> >
> > Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@xxxxxx>
> > ---
>
> Forgot to remind in the previous reply, but:
> For the patch subject, use 'bpf:' prefix for kernel patches, and
> 'selftests/bpf:' for selftests, see the commit logs in bpf-next for
> examples.

Thanks, I will do that in the revision.

>
> >  .../prog_tests/test_queue_stack_nested_map.c  | 48 ++++++++++++++
> >  .../bpf/progs/test_queue_stack_nested_map.c   | 62 +++++++++++++++++++
> >  2 files changed, 110 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/prog_tests/test_queue_stack_nested_map.c
> >  create mode 100644 tools/testing/selftests/bpf/progs/test_queue_stack_nested_map.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/test_queue_stack_nested_map.c b/tools/testing/selftests/bpf/prog_tests/test_queue_stack_nested_map.c
> > new file mode 100644
> > index 000000000000..731e958419eb
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/test_queue_stack_nested_map.c
> > @@ -0,0 +1,48 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <test_progs.h>
> > +#include <network_helpers.h>
> > +
> > +#include "test_queue_stack_nested_map.skel.h"
> > +
> > +
> > +static void test_map_queue_stack_nesting_success(bool is_map_queue)
> > +{
> > +       struct test_queue_stack_nested_map *skel;
> > +       int err;
> > +       int prog_fd;
> > +
> > +       LIBBPF_OPTS(bpf_test_run_opts, ropts);
> > +
> > +       skel = test_queue_stack_nested_map__open_and_load();
> > +       if (!ASSERT_OK_PTR(skel, "test_queue_stack_nested_map__open_and_load"))
> > +               goto out;
> > +
> > +       err = test_queue_stack_nested_map__attach(skel);
> > +       if (!ASSERT_OK(err, "test_queue_stack_nested_map__attach"))
> > +               goto out;
> > +
> > +       if (is_map_queue) {
> > +               prog_fd = bpf_program__fd(skel->progs.test_queue_nesting);
> > +               err = bpf_prog_test_run_opts(prog_fd, &ropts);
> > +               ASSERT_OK(err, "test_nested_queue_map_run");
>
> Maybe you can also check the ropts.optval to ensure we get -EBUSY?
> I.e. return the value of map push/pop from the program and then check
> it here?

make sense.I will do that.

> It can be set in a global variable from the program triggering the
> deadlock, and then you could return the value back as the return value
> of the program.
> If fentry has restrictions on the return code, you could try other
> program types which work in test_run_opts (like SEC("tc")), there are
> many examples in selftests using such programs.
>
> > [...]
> >
> >




[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