Skip to contentSkip to conversation

selftests/net: give more time to udpgro bg processes to complete startup

PATCH Applied Adrien Thierry 4 participants 5 messages Nov 1, 2022 – Nov 4, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/net: give more time to udpgro bg processes to complete startup

In some conditions, background processes in udpgro don't have enough time to set up the sockets. When foreground processes start, this results in the test failing with "./udpgso_bench_tx: sendmsg: Connection refused". For instance, this happens from time to time on a Qualcomm SA8540P SoC running CentOS Stream 9.

To fix this, increase the time given to background processes to complete the startup before foreground processes start.

---
This is a continuation of the hack that's present in those tests. Other ideas are welcome to fix this in a more permanent way.

 tools/testing/selftests/net/udpgro.sh         | 4 ++--
 tools/testing/selftests/net/udpgro_bench.sh   | 2 +-
 tools/testing/selftests/net/udpgro_frglist.sh | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/udpgro.sh +2 -2
index ebbd0b282432..6a443ca3cd3a 100755
@@ -50,7 +50,7 @@ run_one() {
 		echo "failed" &
 
 	# Hack: let bg programs complete the startup
-	sleep 0.1
+	sleep 0.2
 	./udpgso_bench_tx ${tx_args}
 	ret=$?
 	wait $(jobs -p)
@@ -117,7 +117,7 @@ run_one_2sock() {
 		echo "failed" &
 
 	# Hack: let bg programs complete the startup
-	sleep 0.1
+	sleep 0.2
 	./udpgso_bench_tx ${tx_args} -p 12345
 	sleep 0.1
 	# first UDP GSO socket should be closed at this point
tools/testing/selftests/net/udpgro_bench.sh +1 -1
index fad2d1a71cac..8a1109a545db 100755
@@ -39,7 +39,7 @@ run_one() {
 	ip netns exec "${PEER_NS}" ./udpgso_bench_rx -t ${rx_args} -r &
 
 	# Hack: let bg programs complete the startup
-	sleep 0.1
+	sleep 0.2
 	./udpgso_bench_tx ${tx_args}
 }
 
tools/testing/selftests/net/udpgro_frglist.sh +1 -1
index 832c738cc3c2..7fe85ba51075 100755
@@ -44,7 +44,7 @@ run_one() {
 	ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r &
 
 	# Hack: let bg programs complete the startup
-	sleep 0.1
+	sleep 0.2
 	./udpgso_bench_tx ${tx_args}
 }
 
Signature · 1 line
2.38.1
maintainer
#1 lore raw
Quoted 6 lines · On Tue, 1 Nov 2022 14:48:08 -0400 Adrien Thierry wrote:

In some conditions, background processes in udpgro don't have enough time to set up the sockets. When foreground processes start, this results in the test failing with "./udpgso_bench_tx: sendmsg: Connection refused". For instance, this happens from time to time on a Qualcomm SA8540P SoC running CentOS Stream 9.

Quoted 7 lines

To fix this, increase the time given to background processes to complete the startup before foreground processes start.

---
This is a continuation of the hack that's present in those tests. Other ideas are welcome to fix this in a more permanent way.

Perhaps we can add an option to the Rx side to daemonize itself after setting up the socket, that way the bash script will be locked until Rx is ready?

maintainer
#2 lore raw
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Tue, 1 Nov 2022 14:48:08 -0400 Adrien Thierry wrote:

In some conditions, background processes in udpgro don't have enough time to set up the sockets. When foreground processes start, this results in the test failing with "./udpgso_bench_tx: sendmsg: Connection refused". For instance, this happens from time to time on a Qualcomm SA8540P SoC running CentOS Stream 9.

To fix this, increase the time given to background processes to complete the startup before foreground processes start.

Quoted 8 lines
Quoted 4 lines

---
This is a continuation of the hack that's present in those tests. Other ideas are welcome to fix this in a more permanent way.

Perhaps we can add an option to the Rx side to daemonize itself after setting up the socket, that way the bash script will be locked until Rx is ready?

Then it will be less straigh-forward for the running shell waiting for all the running processes.

Another option would be replacing the sleep with a loop waiting for the rx UDP socket to appear in the procfs or diag interface, alike what mptcp self-tests (random example;) are doing:

https://elixir.bootlin.com/linux/v6.1-rc3/source/tools/testing/selftests/net/mptcp/mptcp_join.sh#L424

Cheers,

Paolo

maintainer
#3 lore raw
Quoted 2 lines · On Fri, 04 Nov 2022 09:54:10 +0100 Paolo Abeni wrote:

Then it will be less straigh-forward for the running shell waiting for all the running processes.

The usual solution for that is to write the pid of the daemonized process to a file, no?

Quoted 3 lines

Another option would be replacing the sleep with a loop waiting for the rx UDP socket to appear in the procfs or diag interface, alike what mptcp self-tests (random example;) are doing:

#4 lore raw
In reply to Adrien Thierry
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Tue, 1 Nov 2022 14:48:08 -0400 you wrote:

In some conditions, background processes in udpgro don't have enough time to set up the sockets. When foreground processes start, this results in the test failing with "./udpgso_bench_tx: sendmsg: Connection refused". For instance, this happens from time to time on a Qualcomm SA8540P SoC running CentOS Stream 9.

To fix this, increase the time given to background processes to complete the startup before foreground processes start.

[...]

Here is the summary with links:
- selftests/net: give more time to udpgro bg processes to complete startup

    https://git.kernel.org/netdev/net/c/cdb525ca92b1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html