From: Willem de Bruijn <willemb@google.com>
To: Andrei Gherzan <andrei.gherzan@canonical.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Shuah Khan <shuah@kernel.org>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] selftests: net: udpgso_bench: Fix racing bug between the rx/tx programs
Date: Tue, 31 Jan 2023 08:33:23 -0500 [thread overview]
Message-ID: <CA+FuTSdtzFXWWDLk=LOdrkS00oH4HGvtoYYQh7YQd2ADsp0UbA@mail.gmail.com> (raw)
In-Reply-To: <20230131130412.432549-3-andrei.gherzan@canonical.com>
On Tue, Jan 31, 2023 at 8:06 AM Andrei Gherzan
<andrei.gherzan@canonical.com> wrote:
>
> "udpgro_bench.sh" invokes udpgso_bench_rx/udpgso_bench_tx programs
> subsequently and while doing so, there is a chance that the rx one is not
> ready to accept socket connections. This racing bug could fail the test
> with at least one of the following:
>
> ./udpgso_bench_tx: connect: Connection refused
> ./udpgso_bench_tx: sendmsg: Connection refused
> ./udpgso_bench_tx: write: Connection refused
>
> This change addresses this by making udpgro_bench.sh wait for the rx
> program to be ready before firing off the tx one - with an exponential back
> off algorithm from 1s to 10s.
>
> Signed-off-by: Andrei Gherzan <andrei.gherzan@canonical.com>
please CC: reviewers of previous revisions on new revisions
also for upcoming patches: please clearly mark net or net-next.
> ---
> tools/testing/selftests/net/udpgso_bench.sh | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/tools/testing/selftests/net/udpgso_bench.sh b/tools/testing/selftests/net/udpgso_bench.sh
> index dc932fd65363..20b5db8fcbde 100755
> --- a/tools/testing/selftests/net/udpgso_bench.sh
> +++ b/tools/testing/selftests/net/udpgso_bench.sh
> @@ -7,6 +7,7 @@ readonly GREEN='\033[0;92m'
> readonly YELLOW='\033[0;33m'
> readonly RED='\033[0;31m'
> readonly NC='\033[0m' # No Color
> +readonly TESTPORT=8000 # Keep this in sync with udpgso_bench_rx/tx
then also pass explicit -p argument to the processes to keep all three
consistent
>
> readonly KSFT_PASS=0
> readonly KSFT_FAIL=1
> @@ -56,10 +57,27 @@ trap wake_children EXIT
>
> run_one() {
> local -r args=$@
> + local -r init_delay_s=1
> + local -r max_delay_s=10
> + local delay_s=0
> + local nr_socks=0
>
> ./udpgso_bench_rx &
> ./udpgso_bench_rx -t &
>
> + # Wait for the above test program to get ready to receive connections.
> + delay_s="${init_delay_s}"
> + while [ "$delay_s" -lt "$max_delay_s" ]; do
> + nr_socks="$(ss -lnHi | grep -c "\*:${TESTPORT}")"
> + [ "$nr_socks" -eq 2 ] && break
> + sleep "$delay_s"
> + delay="$((delay*2))"
I don't think we need exponential back-off for something this simple
> + done
> + if [ "$nr_socks" -ne 2 ]; then
> + echo "timed out while waiting for udpgso_bench_rx"
> + exit 1
> + fi
> +
> ./udpgso_bench_tx ${args}
> }
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-01-31 13:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 13:04 [PATCH v2 1/4] selftests: net: udpgso_bench_rx: Fix 'used uninitialized' compiler warning Andrei Gherzan
2023-01-31 13:04 ` [PATCH v2 2/4] selftests: net: udpgso_bench_rx/tx: Stop when wrong CLI args are provided Andrei Gherzan
2023-01-31 13:35 ` Willem de Bruijn
2023-01-31 14:40 ` Andrei Gherzan
2023-01-31 13:04 ` [PATCH v2 3/4] selftests: net: udpgso_bench: Fix racing bug between the rx/tx programs Andrei Gherzan
2023-01-31 13:33 ` Willem de Bruijn [this message]
2023-01-31 14:45 ` Paolo Abeni
2023-01-31 14:56 ` Andrei Gherzan
2023-01-31 13:04 ` [PATCH v2 4/4] selftests: net: udpgso_bench_tx: Cater for pending datagrams zerocopy benchmarking Andrei Gherzan
2023-01-31 13:39 ` Willem de Bruijn
2023-01-31 14:51 ` Paolo Abeni
2023-01-31 15:08 ` Andrei Gherzan
2023-01-31 16:22 ` Paolo Abeni
2023-01-31 16:31 ` Andrei Gherzan
2023-01-31 18:26 ` Paolo Abeni
2023-01-31 20:36 ` Andrei Gherzan
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='CA+FuTSdtzFXWWDLk=LOdrkS00oH4HGvtoYYQh7YQd2ADsp0UbA@mail.gmail.com' \
--to=willemb@google.com \
--cc=andrei.gherzan@canonical.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).