diff mbox series

[bpf-next] selftests/bpf: adding delay in socketmap_listen to reduce flakyness

Message ID 20210819163609.2583758-1-fallentree@fb.com (mailing list archive)
State Accepted
Commit 3666b167ea68997b73dd5b78678a1c3f0d6730bb
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: adding delay in socketmap_listen to reduce flakyness | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 13 maintainers not CCed: songliubraving@fb.com jakub@cloudflare.com shuah@kernel.org cong.wang@bytedance.com daniel@iogearbox.net kafai@fb.com netdev@vger.kernel.org ast@kernel.org john.fastabend@gmail.com linux-kselftest@vger.kernel.org jiang.wang@bytedance.com kpsingh@kernel.org yhs@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
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 Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 33 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yucong Sun Aug. 19, 2021, 4:36 p.m. UTC
This patch adds a 1ms delay to reduce flakyness of the test.

Signed-off-by: Yucong Sun <fallentree@fb.com>
---
 .../selftests/bpf/prog_tests/sockmap_listen.c        | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Andrii Nakryiko Aug. 19, 2021, 6:44 p.m. UTC | #1
On Thu, Aug 19, 2021 at 9:36 AM Yucong Sun <fallentree@fb.com> wrote:
>
> This patch adds a 1ms delay to reduce flakyness of the test.
>
> Signed-off-by: Yucong Sun <fallentree@fb.com>
> ---

Any reasons to not implement exponential back-off, like we did for test_maps?

>  .../selftests/bpf/prog_tests/sockmap_listen.c        | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> index afa14fb66f08..6a5df28f9a3d 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> @@ -1603,8 +1603,10 @@ static void unix_redir_to_connected(int sotype, int sock_mapfd,
>  again:
>         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
>         if (n < 0) {
> -               if (errno == EAGAIN && retries--)
> +               if (errno == EAGAIN && retries--) {
> +                       usleep(1000);
>                         goto again;
> +               }
>                 FAIL_ERRNO("%s: read", log_prefix);
>         }
>         if (n == 0)
> @@ -1776,8 +1778,10 @@ static void udp_redir_to_connected(int family, int sock_mapfd, int verd_mapfd,
>  again:
>         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
>         if (n < 0) {
> -               if (errno == EAGAIN && retries--)
> +               if (errno == EAGAIN && retries--) {
> +                       usleep(1000);
>                         goto again;
> +               }
>                 FAIL_ERRNO("%s: read", log_prefix);
>         }
>         if (n == 0)
> @@ -1869,8 +1873,10 @@ static void inet_unix_redir_to_connected(int family, int type, int sock_mapfd,
>  again:
>         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
>         if (n < 0) {
> -               if (errno == EAGAIN && retries--)
> +               if (errno == EAGAIN && retries--) {
> +                       usleep(1000);
>                         goto again;
> +               }
>                 FAIL_ERRNO("%s: read", log_prefix);
>         }
>         if (n == 0)
> --
> 2.30.2
>
sunyucong@gmail.com Aug. 19, 2021, 7:15 p.m. UTC | #2
On Thu, Aug 19, 2021 at 11:45 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Thu, Aug 19, 2021 at 9:36 AM Yucong Sun <fallentree@fb.com> wrote:
> >
> > This patch adds a 1ms delay to reduce flakyness of the test.
> >
> > Signed-off-by: Yucong Sun <fallentree@fb.com>
> > ---
>
> Any reasons to not implement exponential back-off, like we did for test_maps?

for simplicity, since there are no contention involved here I figured
we don’t need random delay and back-offs.

(sorry for resending, I was fooled by the mobile gmail client that it
doesn't do plain text).


>
> >  .../selftests/bpf/prog_tests/sockmap_listen.c        | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > index afa14fb66f08..6a5df28f9a3d 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > @@ -1603,8 +1603,10 @@ static void unix_redir_to_connected(int sotype, int sock_mapfd,
> >  again:
> >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> >         if (n < 0) {
> > -               if (errno == EAGAIN && retries--)
> > +               if (errno == EAGAIN && retries--) {
> > +                       usleep(1000);
> >                         goto again;
> > +               }
> >                 FAIL_ERRNO("%s: read", log_prefix);
> >         }
> >         if (n == 0)
> > @@ -1776,8 +1778,10 @@ static void udp_redir_to_connected(int family, int sock_mapfd, int verd_mapfd,
> >  again:
> >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> >         if (n < 0) {
> > -               if (errno == EAGAIN && retries--)
> > +               if (errno == EAGAIN && retries--) {
> > +                       usleep(1000);
> >                         goto again;
> > +               }
> >                 FAIL_ERRNO("%s: read", log_prefix);
> >         }
> >         if (n == 0)
> > @@ -1869,8 +1873,10 @@ static void inet_unix_redir_to_connected(int family, int type, int sock_mapfd,
> >  again:
> >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> >         if (n < 0) {
> > -               if (errno == EAGAIN && retries--)
> > +               if (errno == EAGAIN && retries--) {
> > +                       usleep(1000);
> >                         goto again;
> > +               }
> >                 FAIL_ERRNO("%s: read", log_prefix);
> >         }
> >         if (n == 0)
> > --
> > 2.30.2
> >
Andrii Nakryiko Aug. 19, 2021, 7:29 p.m. UTC | #3
On Thu, Aug 19, 2021 at 12:16 PM sunyucong@gmail.com
<sunyucong@gmail.com> wrote:
>
> On Thu, Aug 19, 2021 at 11:45 AM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Thu, Aug 19, 2021 at 9:36 AM Yucong Sun <fallentree@fb.com> wrote:
> > >
> > > This patch adds a 1ms delay to reduce flakyness of the test.
> > >
> > > Signed-off-by: Yucong Sun <fallentree@fb.com>
> > > ---
> >
> > Any reasons to not implement exponential back-off, like we did for test_maps?
>
> for simplicity, since there are no contention involved here I figured
> we don’t need random delay and back-offs.

Alright, it's an improvement anyways. Let's see if it still causes
problem. Applied to bpf-next, thanks!

>
> (sorry for resending, I was fooled by the mobile gmail client that it
> doesn't do plain text).
>

AFAIK, mobile client doesn't support plain text

>
> >
> > >  .../selftests/bpf/prog_tests/sockmap_listen.c        | 12 +++++++++---
> > >  1 file changed, 9 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > > index afa14fb66f08..6a5df28f9a3d 100644
> > > --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > > +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> > > @@ -1603,8 +1603,10 @@ static void unix_redir_to_connected(int sotype, int sock_mapfd,
> > >  again:
> > >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> > >         if (n < 0) {
> > > -               if (errno == EAGAIN && retries--)
> > > +               if (errno == EAGAIN && retries--) {
> > > +                       usleep(1000);
> > >                         goto again;
> > > +               }
> > >                 FAIL_ERRNO("%s: read", log_prefix);
> > >         }
> > >         if (n == 0)
> > > @@ -1776,8 +1778,10 @@ static void udp_redir_to_connected(int family, int sock_mapfd, int verd_mapfd,
> > >  again:
> > >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> > >         if (n < 0) {
> > > -               if (errno == EAGAIN && retries--)
> > > +               if (errno == EAGAIN && retries--) {
> > > +                       usleep(1000);
> > >                         goto again;
> > > +               }
> > >                 FAIL_ERRNO("%s: read", log_prefix);
> > >         }
> > >         if (n == 0)
> > > @@ -1869,8 +1873,10 @@ static void inet_unix_redir_to_connected(int family, int type, int sock_mapfd,
> > >  again:
> > >         n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
> > >         if (n < 0) {
> > > -               if (errno == EAGAIN && retries--)
> > > +               if (errno == EAGAIN && retries--) {
> > > +                       usleep(1000);
> > >                         goto again;
> > > +               }
> > >                 FAIL_ERRNO("%s: read", log_prefix);
> > >         }
> > >         if (n == 0)
> > > --
> > > 2.30.2
> > >
patchwork-bot+netdevbpf@kernel.org Aug. 19, 2021, 7:30 p.m. UTC | #4
Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

On Thu, 19 Aug 2021 09:36:09 -0700 you wrote:
> This patch adds a 1ms delay to reduce flakyness of the test.
> 
> Signed-off-by: Yucong Sun <fallentree@fb.com>
> ---
>  .../selftests/bpf/prog_tests/sockmap_listen.c        | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [bpf-next] selftests/bpf: adding delay in socketmap_listen to reduce flakyness
    https://git.kernel.org/bpf/bpf-next/c/3666b167ea68

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
index afa14fb66f08..6a5df28f9a3d 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
@@ -1603,8 +1603,10 @@  static void unix_redir_to_connected(int sotype, int sock_mapfd,
 again:
 	n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
 	if (n < 0) {
-		if (errno == EAGAIN && retries--)
+		if (errno == EAGAIN && retries--) {
+			usleep(1000);
 			goto again;
+		}
 		FAIL_ERRNO("%s: read", log_prefix);
 	}
 	if (n == 0)
@@ -1776,8 +1778,10 @@  static void udp_redir_to_connected(int family, int sock_mapfd, int verd_mapfd,
 again:
 	n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
 	if (n < 0) {
-		if (errno == EAGAIN && retries--)
+		if (errno == EAGAIN && retries--) {
+			usleep(1000);
 			goto again;
+		}
 		FAIL_ERRNO("%s: read", log_prefix);
 	}
 	if (n == 0)
@@ -1869,8 +1873,10 @@  static void inet_unix_redir_to_connected(int family, int type, int sock_mapfd,
 again:
 	n = read(mode == REDIR_INGRESS ? p0 : c0, &b, 1);
 	if (n < 0) {
-		if (errno == EAGAIN && retries--)
+		if (errno == EAGAIN && retries--) {
+			usleep(1000);
 			goto again;
+		}
 		FAIL_ERRNO("%s: read", log_prefix);
 	}
 	if (n == 0)