diff mbox series

[bpf-next,v6,13/14] selftests/bpf: increase loop count for perf_branches

Message ID 20211006185619.364369-14-fallentree@fb.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series selftests/bpf: Add parallelism to test_progs | expand

Checks

Context Check Description
netdev/cover_letter success Series has a cover letter
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: linux-kselftest@vger.kernel.org netdev@vger.kernel.org shuah@kernel.org kafai@fb.com daniel@iogearbox.net yhs@fb.com john.fastabend@gmail.com songliubraving@fb.com kpsingh@kernel.org ast@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files
bpf/vmtest-bpf-next success VM_Test
bpf/vmtest-bpf-next-PR success PR summary

Commit Message

Yucong Sun Oct. 6, 2021, 6:56 p.m. UTC
From: Yucong Sun <sunyucong@gmail.com>

This make this test more likely to succeed.

Signed-off-by: Yucong Sun <sunyucong@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/perf_branches.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrii Nakryiko Oct. 8, 2021, 10:27 p.m. UTC | #1
On Wed, Oct 6, 2021 at 11:56 AM Yucong Sun <fallentree@fb.com> wrote:
>
> From: Yucong Sun <sunyucong@gmail.com>
>
> This make this test more likely to succeed.
>
> Signed-off-by: Yucong Sun <sunyucong@gmail.com>
> ---

100 million iterations seems a bit excessive. Why one million loops
doesn't cause a single perf event? Can we make it more robust in some
other way that is not as slow? I've dropped it for now while we
discuss.


>  tools/testing/selftests/bpf/prog_tests/perf_branches.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/perf_branches.c b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> index 6b2e3dced619..d7e88b2c5f36 100644
> --- a/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> +++ b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> @@ -16,7 +16,7 @@ static void check_good_sample(struct test_perf_branches *skel)
>         int duration = 0;
>
>         if (CHECK(!skel->bss->valid, "output not valid",
> -                "no valid sample from prog"))
> +                "no valid sample from prog\n"))
>                 return;
>
>         /*
> @@ -46,7 +46,7 @@ static void check_bad_sample(struct test_perf_branches *skel)
>         int duration = 0;
>
>         if (CHECK(!skel->bss->valid, "output not valid",
> -                "no valid sample from prog"))
> +                "no valid sample from prog\n"))
>                 return;
>
>         CHECK((required_size != -EINVAL && required_size != -ENOENT),
> @@ -84,7 +84,7 @@ static void test_perf_branches_common(int perf_fd,
>         if (CHECK(err, "set_affinity", "cpu #0, err %d\n", err))
>                 goto out_destroy;
>         /* spin the loop for a while (random high number) */
> -       for (i = 0; i < 1000000; ++i)
> +       for (i = 0; i < 100000000; ++i)
>                 ++j;
>
>         test_perf_branches__detach(skel);
> --
> 2.30.2
>
sunyucong@gmail.com Oct. 8, 2021, 10:57 p.m. UTC | #2
On Fri, Oct 8, 2021 at 3:27 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Oct 6, 2021 at 11:56 AM Yucong Sun <fallentree@fb.com> wrote:
> >
> > From: Yucong Sun <sunyucong@gmail.com>
> >
> > This make this test more likely to succeed.
> >
> > Signed-off-by: Yucong Sun <sunyucong@gmail.com>
> > ---
>
> 100 million iterations seems a bit excessive. Why one million loops
> doesn't cause a single perf event? Can we make it more robust in some
> other way that is not as slow? I've dropped it for now while we
> discuss.

I don't know, without this patch the test constantly fails for me
regardless of serial or parallel mode.
I think it could be something related to compiler optimizations or hardware?

>
>
> >  tools/testing/selftests/bpf/prog_tests/perf_branches.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/perf_branches.c b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> > index 6b2e3dced619..d7e88b2c5f36 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
> > @@ -16,7 +16,7 @@ static void check_good_sample(struct test_perf_branches *skel)
> >         int duration = 0;
> >
> >         if (CHECK(!skel->bss->valid, "output not valid",
> > -                "no valid sample from prog"))
> > +                "no valid sample from prog\n"))
> >                 return;
> >
> >         /*
> > @@ -46,7 +46,7 @@ static void check_bad_sample(struct test_perf_branches *skel)
> >         int duration = 0;
> >
> >         if (CHECK(!skel->bss->valid, "output not valid",
> > -                "no valid sample from prog"))
> > +                "no valid sample from prog\n"))
> >                 return;
> >
> >         CHECK((required_size != -EINVAL && required_size != -ENOENT),
> > @@ -84,7 +84,7 @@ static void test_perf_branches_common(int perf_fd,
> >         if (CHECK(err, "set_affinity", "cpu #0, err %d\n", err))
> >                 goto out_destroy;
> >         /* spin the loop for a while (random high number) */
> > -       for (i = 0; i < 1000000; ++i)
> > +       for (i = 0; i < 100000000; ++i)
> >                 ++j;
> >
> >         test_perf_branches__detach(skel);
> > --
> > 2.30.2
> >
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/perf_branches.c b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
index 6b2e3dced619..d7e88b2c5f36 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_branches.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_branches.c
@@ -16,7 +16,7 @@  static void check_good_sample(struct test_perf_branches *skel)
 	int duration = 0;
 
 	if (CHECK(!skel->bss->valid, "output not valid",
-		 "no valid sample from prog"))
+		 "no valid sample from prog\n"))
 		return;
 
 	/*
@@ -46,7 +46,7 @@  static void check_bad_sample(struct test_perf_branches *skel)
 	int duration = 0;
 
 	if (CHECK(!skel->bss->valid, "output not valid",
-		 "no valid sample from prog"))
+		 "no valid sample from prog\n"))
 		return;
 
 	CHECK((required_size != -EINVAL && required_size != -ENOENT),
@@ -84,7 +84,7 @@  static void test_perf_branches_common(int perf_fd,
 	if (CHECK(err, "set_affinity", "cpu #0, err %d\n", err))
 		goto out_destroy;
 	/* spin the loop for a while (random high number) */
-	for (i = 0; i < 1000000; ++i)
+	for (i = 0; i < 100000000; ++i)
 		++j;
 
 	test_perf_branches__detach(skel);