linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests/net/lib: update busywait timeout value
@ 2024-01-22  9:05 Hangbin Liu
  2024-01-23 11:20 ` Paolo Abeni
  0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2024-01-22  9:05 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Shuah Khan, David Ahern, linux-kselftest, Hangbin Liu

The busywait timeout value is a millisecond, not a second. So the
current setting 2 is meaningless. Let's copy the WAIT_TIMEOUT from
forwarding/lib.sh and set a BUSYWAIT_TIMEOUT here.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
Not sure if the default WAIT_TIMEOUT 20s is too large. But since
we usually don't need to wait for that long. I think it's OK to
stay the same value with forwarding/lib.sh. Please tell me if you
think we need to set a more proper value.

BTW, This doesn't look like a fix. But also not a feature. So I just
post it to net tree.
---
 tools/testing/selftests/net/lib.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
index dca549443801..f9fe182dfbd4 100644
--- a/tools/testing/selftests/net/lib.sh
+++ b/tools/testing/selftests/net/lib.sh
@@ -4,6 +4,9 @@
 ##############################################################################
 # Defines
 
+WAIT_TIMEOUT=${WAIT_TIMEOUT:=20}
+BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms
+
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
 # namespace list created by setup_ns
@@ -48,7 +51,7 @@ cleanup_ns()
 
 	for ns in "$@"; do
 		ip netns delete "${ns}" &> /dev/null
-		if ! busywait 2 ip netns list \| grep -vq "^$ns$" &> /dev/null; then
+		if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
 			echo "Warn: Failed to remove namespace $ns"
 			ret=1
 		fi
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] selftests/net/lib: update busywait timeout value
  2024-01-22  9:05 [PATCH net] selftests/net/lib: update busywait timeout value Hangbin Liu
@ 2024-01-23 11:20 ` Paolo Abeni
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2024-01-23 11:20 UTC (permalink / raw)
  To: Hangbin Liu, netdev
  Cc: David S. Miller, Jakub Kicinski, Eric Dumazet, Shuah Khan,
	David Ahern, linux-kselftest

On Mon, 2024-01-22 at 17:05 +0800, Hangbin Liu wrote:
> The busywait timeout value is a millisecond, not a second. So the
> current setting 2 is meaningless. Let's copy the WAIT_TIMEOUT from
> forwarding/lib.sh and set a BUSYWAIT_TIMEOUT here.
> 
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> Not sure if the default WAIT_TIMEOUT 20s is too large. But since
> we usually don't need to wait for that long. I think it's OK to
> stay the same value with forwarding/lib.sh. Please tell me if you
> think we need to set a more proper value.
> 
> BTW, This doesn't look like a fix. But also not a feature. So I just
> post it to net tree.

I think the 20s max timeout is fine.

I also think this is really a fix: on slow/busy host (or VMs) the
current timeout can expire even on "correct" execution, causing random
failures. We had a lot of similar case in the mptcp self-tests in the
past.

Could you please send a v2 with a suitable fixes tag and an update
changelog to point out the possible failures?

Thanks!

Paolo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-23 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22  9:05 [PATCH net] selftests/net/lib: update busywait timeout value Hangbin Liu
2024-01-23 11:20 ` Paolo Abeni

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).