BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix flaky selftest lwt_redirect/lwt_reroute
Date: Mon, 05 Feb 2024 18:02:17 +0200	[thread overview]
Message-ID: <f906870c6ce92798209ccf2841a291b214acf38c.camel@gmail.com> (raw)
In-Reply-To: <20240205052914.1742687-1-yonghong.song@linux.dev>

On Sun, 2024-02-04 at 21:29 -0800, Yonghong Song wrote:
> Recently, when running './test_progs -j', I occasionally hit the
> following errors:
> 
>   test_lwt_redirect:PASS:pthread_create 0 nsec
>   test_lwt_redirect_run:FAIL:netns_create unexpected error: 256 (errno 0)
>   #142/2   lwt_redirect/lwt_redirect_normal_nomac:FAIL
>   #142     lwt_redirect:FAIL
>   test_lwt_reroute:PASS:pthread_create 0 nsec
>   test_lwt_reroute_run:FAIL:netns_create unexpected error: 256 (errno 0)
>   test_lwt_reroute:PASS:pthread_join 0 nsec
>   #143/2   lwt_reroute/lwt_reroute_qdisc_dropped:FAIL
>   #143     lwt_reroute:FAIL
> 
> The netns_create() definition looks like below:
> 
>   #define NETNS "ns_lwt"
>   static inline int netns_create(void)
>   {
>         return system("ip netns add " NETNS);
>   }
> 
> One possibility is that both lwt_redirect and lwt_reroute create
> netns with the same name "ns_lwt" which may cause conflict. I tried
> the following example:
>   $ sudo ip netns add abc
>   $ echo $?
>   0
>   $ sudo ip netns add abc
>   Cannot create namespace file "/var/run/netns/abc": File exists
>   $ echo $?
>   1
>   $
> 
> The return code for above netns_create() is 256. The internet search
> suggests that the return value for 'ip netns add ns_lwt' is 1, which
> matches the above 'sudo ip netns add abc' example.
> 
> This patch tried to use different netns names for two tests to avoid
> 'ip netns add <name>' failure.
> 
> I ran './test_progs -j' 10 times and all succeeded with
> lwt_redirect/lwt_reroute tests.
> 
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---

Tested-by: Eduard Zingerman <eddyz87@gmail.com>

Can confirm, w/o this patch tests reliably step on each others toes
when using command:

  ./test_progs -j  -a "lwt_*"
  
This patch resolves the issue.

  reply	other threads:[~2024-02-05 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  5:29 [PATCH bpf-next] selftests/bpf: Fix flaky selftest lwt_redirect/lwt_reroute Yonghong Song
2024-02-05 16:02 ` Eduard Zingerman [this message]
2024-02-05 19:20 ` patchwork-bot+netdevbpf

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=f906870c6ce92798209ccf2841a291b214acf38c.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox