netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net 0/4] selftests: net: more fixes
@ 2024-02-01 18:42 Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 1/4] selftests: net: cut more slack for gro fwd tests Paolo Abeni
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-01 18:42 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

Another small bunch of fixes, addressing issues outlined by the
netdev CI.

The first 2 patches are just rebased.

The following 2 are new fixes, for even more problems that surfaced
meanwhile.

Paolo Abeni (4):
  selftests: net: cut more slack for gro fwd tests.
  selftests: net: fix setup_ns usage in rtnetlink.sh
  selftests: net: fix tcp listener handling in pmtu.sh
  selftests: net: avoid just another constant wait

 tools/testing/selftests/net/pmtu.sh           | 23 ++++++++++++++-----
 tools/testing/selftests/net/rtnetlink.sh      |  6 ++---
 tools/testing/selftests/net/udpgro_fwd.sh     | 14 +++++++++--
 tools/testing/selftests/net/udpgso_bench_rx.c |  2 +-
 4 files changed, 32 insertions(+), 13 deletions(-)

-- 
2.43.0


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

* [PATCH v2 net 1/4] selftests: net: cut more slack for gro fwd tests.
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
@ 2024-02-01 18:42 ` Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh Paolo Abeni
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-01 18:42 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

The udpgro_fwd.sh self-tests are somewhat unstable. There are
a few timing constraints the we struggle to meet on very slow
environments.

Instead of skipping the whole tests in such envs, increase the
test resilience WRT very slow hosts: increase the inter-packets
timeouts, avoid resetting the counters every second and finally
disable reduce the background traffic noise.

Tested with:

for I in $(seq 1 100); do
	./tools/testing/selftests/kselftest_install/run_kselftest.sh \
		-t net:udpgro_fwd.sh || exit -1
done

in a slow environment.

Fixes: a062260a9d5f ("selftests: net: add UDP GRO forwarding self-tests")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/udpgro_fwd.sh     | 14 ++++++++++++--
 tools/testing/selftests/net/udpgso_bench_rx.c |  2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/udpgro_fwd.sh b/tools/testing/selftests/net/udpgro_fwd.sh
index d6b9c759043c..9cd5e885e91f 100755
--- a/tools/testing/selftests/net/udpgro_fwd.sh
+++ b/tools/testing/selftests/net/udpgro_fwd.sh
@@ -39,6 +39,10 @@ create_ns() {
 	for ns in $NS_SRC $NS_DST; do
 		ip netns add $ns
 		ip -n $ns link set dev lo up
+
+		# disable route solicitations to decrease 'noise' traffic
+		ip netns exec $ns sysctl -qw net.ipv6.conf.default.router_solicitations=0
+		ip netns exec $ns sysctl -qw net.ipv6.conf.all.router_solicitations=0
 	done
 
 	ip link add name veth$SRC type veth peer name veth$DST
@@ -80,6 +84,12 @@ create_vxlan_pair() {
 		create_vxlan_endpoint $BASE$ns veth$ns $BM_NET_V6$((3 - $ns)) vxlan6$ns 6
 		ip -n $BASE$ns addr add dev vxlan6$ns $OL_NET_V6$ns/24 nodad
 	done
+
+	# preload neighbur cache, do avoid some noisy traffic
+	local addr_dst=$(ip -j -n $BASE$DST link show dev vxlan6$DST  |jq -r '.[]["address"]')
+	local addr_src=$(ip -j -n $BASE$SRC link show dev vxlan6$SRC  |jq -r '.[]["address"]')
+	ip -n $BASE$DST neigh add dev vxlan6$DST lladdr $addr_src $OL_NET_V6$SRC
+	ip -n $BASE$SRC neigh add dev vxlan6$SRC lladdr $addr_dst $OL_NET_V6$DST
 }
 
 is_ipv6() {
@@ -119,7 +129,7 @@ run_test() {
 	# not enable GRO
 	ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 4789
 	ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
-	ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
+	ip netns exec $NS_DST ./udpgso_bench_rx -C 2000 -R 100 -n 10 -l 1300 $rx_args &
 	local spid=$!
 	wait_local_port_listen "$NS_DST" 8000 udp
 	ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
@@ -168,7 +178,7 @@ run_bench() {
 	# bind the sender and the receiver to different CPUs to try
 	# get reproducible results
 	ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
-	ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10  &
+	ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 2000 -R 100  &
 	local spid=$!
 	wait_local_port_listen "$NS_DST" 8000 udp
 	ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c
index f35a924d4a30..1cbadd267c96 100644
--- a/tools/testing/selftests/net/udpgso_bench_rx.c
+++ b/tools/testing/selftests/net/udpgso_bench_rx.c
@@ -375,7 +375,7 @@ static void do_recv(void)
 			do_flush_udp(fd);
 
 		tnow = gettimeofday_ms();
-		if (tnow > treport) {
+		if (!cfg_expected_pkt_nr && tnow > treport) {
 			if (packets)
 				fprintf(stderr,
 					"%s rx: %6lu MB/s %8lu calls/s\n",
-- 
2.43.0


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

* [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 1/4] selftests: net: cut more slack for gro fwd tests Paolo Abeni
@ 2024-02-01 18:42 ` Paolo Abeni
  2024-02-02 17:38   ` Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 3/4] selftests: net: fix tcp listener handling in pmtu.sh Paolo Abeni
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Paolo Abeni @ 2024-02-01 18:42 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

The setup_ns helper marks the testns global variable as
readonly. Later attempts to set such variable are unsuccessful,
causing a couple test failures.

Avoid completely the variable re-initialization and let the
function access the global value.

Fixes: ("selftests: rtnetlink: use setup_ns in bonding test")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/rtnetlink.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh
index 4667d74579d1..874a2952aa8e 100755
--- a/tools/testing/selftests/net/rtnetlink.sh
+++ b/tools/testing/selftests/net/rtnetlink.sh
@@ -440,7 +440,6 @@ kci_test_encap_vxlan()
 	local ret=0
 	vxlan="test-vxlan0"
 	vlan="test-vlan0"
-	testns="$1"
 	run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
 		dev "$devdummy" dstport 4789
 	if [ $? -ne 0 ]; then
@@ -485,7 +484,6 @@ kci_test_encap_fou()
 {
 	local ret=0
 	name="test-fou"
-	testns="$1"
 	run_cmd_grep 'Usage: ip fou' ip fou help
 	if [ $? -ne 0 ];then
 		end_test "SKIP: fou: iproute2 too old"
@@ -526,8 +524,8 @@ kci_test_encap()
 	run_cmd ip -netns "$testns" link set lo up
 	run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
 	run_cmd ip -netns "$testns" link set "$devdummy" up
-	run_cmd kci_test_encap_vxlan "$testns"
-	run_cmd kci_test_encap_fou "$testns"
+	run_cmd kci_test_encap_vxlan
+	run_cmd kci_test_encap_fou
 
 	ip netns del "$testns"
 	return $ret
-- 
2.43.0


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

* [PATCH v2 net 3/4] selftests: net: fix tcp listener handling in pmtu.sh
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 1/4] selftests: net: cut more slack for gro fwd tests Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh Paolo Abeni
@ 2024-02-01 18:42 ` Paolo Abeni
  2024-02-01 18:42 ` [PATCH v2 net 4/4] selftests: net: avoid just another constant wait Paolo Abeni
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-01 18:42 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

The pmtu.sh test uses a few TCP listener in a problematic way:
It hard-codes a constant timeout to wait for the listener starting-up
in background. That introduces unneeded latency and on very slow and
busy host it can fail.

Additionally the test starts again the same listener in the same
namespace on the same port, just after the previous connection
completed. Fast host can attempt starting the new server before the
old one really closed the socket.

Address the issues using the wait_local_port_listen helper and
explicitly waiting for the background listener process exit.

Fixes: 136a1b434bbb ("selftests: net: test vxlan pmtu exceptions with tcp")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/pmtu.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 3f118e3f1c66..f0febc19baae 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -199,6 +199,7 @@
 #	Same as above but with IPv6
 
 source lib.sh
+source net_helper.sh
 
 PAUSE_ON_FAIL=no
 VERBOSE=0
@@ -1336,13 +1337,15 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() {
 			TCPDST="TCP:[${dst}]:50000"
 		fi
 		${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
+		local socat_pid=$!
 
-		sleep 1
+		wait_local_port_listen ${NS_B} 50000 tcp
 
 		dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
 
 		size=$(du -sb $tmpoutfile)
 		size=${size%%/tmp/*}
+		wait ${socat_pid}
 
 		[ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
 	done
-- 
2.43.0


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

* [PATCH v2 net 4/4] selftests: net: avoid just another constant wait
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
                   ` (2 preceding siblings ...)
  2024-02-01 18:42 ` [PATCH v2 net 3/4] selftests: net: fix tcp listener handling in pmtu.sh Paolo Abeni
@ 2024-02-01 18:42 ` Paolo Abeni
  2024-02-02  2:21 ` [PATCH v2 net 0/4] selftests: net: more fixes David Ahern
  2024-02-03  5:20 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-01 18:42 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

Using hard-coded constant timeout to wait for some expected
event is deemed to fail sooner or later, especially in slow
env.

Our CI has spotted another of such race:
   # TEST: ipv6: cleanup of cached exceptions - nexthop objects          [FAIL]
   #   can't delete veth device in a timely manner, PMTU dst likely leaked

Replace the crude sleep with a loop looking for the expected condition
at low interval for a much longer range.

Fixes: b3cc4f8a8a41 ("selftests: pmtu: add explicit tests for PMTU exceptions cleanup")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/pmtu.sh | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index f0febc19baae..d65fdd407d73 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -1957,6 +1957,13 @@ check_command() {
 	return 0
 }
 
+check_running() {
+	pid=${1}
+	cmd=${2}
+
+	[ "$(cat /proc/${pid}/cmdline 2>/dev/null | tr -d '\0')" = "{cmd}" ]
+}
+
 test_cleanup_vxlanX_exception() {
 	outer="${1}"
 	encap="vxlan"
@@ -1987,11 +1994,12 @@ test_cleanup_vxlanX_exception() {
 
 	${ns_a} ip link del dev veth_A-R1 &
 	iplink_pid=$!
-	sleep 1
-	if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
-		err "  can't delete veth device in a timely manner, PMTU dst likely leaked"
-		return 1
-	fi
+	for i in $(seq 1 20); do
+		check_running ${iplink_pid} "iplinkdeldevveth_A-R1" || return 0
+		sleep 0.1
+	done
+	err "  can't delete veth device in a timely manner, PMTU dst likely leaked"
+	return 1
 }
 
 test_cleanup_ipv6_exception() {
-- 
2.43.0


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

* Re: [PATCH v2 net 0/4] selftests: net: more fixes
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
                   ` (3 preceding siblings ...)
  2024-02-01 18:42 ` [PATCH v2 net 4/4] selftests: net: avoid just another constant wait Paolo Abeni
@ 2024-02-02  2:21 ` David Ahern
  2024-02-03  5:20 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 8+ messages in thread
From: David Ahern @ 2024-02-02  2:21 UTC (permalink / raw)
  To: Paolo Abeni, netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, linux-kselftest

On 2/1/24 11:42 AM, Paolo Abeni wrote:
> Another small bunch of fixes, addressing issues outlined by the
> netdev CI.
> 
> The first 2 patches are just rebased.
> 
> The following 2 are new fixes, for even more problems that surfaced
> meanwhile.
> 
> Paolo Abeni (4):
>   selftests: net: cut more slack for gro fwd tests.
>   selftests: net: fix setup_ns usage in rtnetlink.sh
>   selftests: net: fix tcp listener handling in pmtu.sh
>   selftests: net: avoid just another constant wait
> 
>  tools/testing/selftests/net/pmtu.sh           | 23 ++++++++++++++-----
>  tools/testing/selftests/net/rtnetlink.sh      |  6 ++---
>  tools/testing/selftests/net/udpgro_fwd.sh     | 14 +++++++++--
>  tools/testing/selftests/net/udpgso_bench_rx.c |  2 +-
>  4 files changed, 32 insertions(+), 13 deletions(-)
> 

For the set:

Reviewed-by: David Ahern <dsahern@kernel.org>


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

* Re: [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh
  2024-02-01 18:42 ` [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh Paolo Abeni
@ 2024-02-02 17:38   ` Paolo Abeni
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-02 17:38 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Shuah Khan,
	Willem de Bruijn, Florian Westphal, David Ahern, linux-kselftest

On Thu, 2024-02-01 at 19:42 +0100, Paolo Abeni wrote:
> The setup_ns helper marks the testns global variable as
> readonly. Later attempts to set such variable are unsuccessful,
> causing a couple test failures.
> 
> Avoid completely the variable re-initialization and let the
> function access the global value.
> 
> Fixes: ("selftests: rtnetlink: use setup_ns in bonding test")

The above should be:

Fixes: e9ce7ededf14 ("selftests: rtnetlink: use setup_ns in bonding test")




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

* Re: [PATCH v2 net 0/4] selftests: net: more fixes
  2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
                   ` (4 preceding siblings ...)
  2024-02-02  2:21 ` [PATCH v2 net 0/4] selftests: net: more fixes David Ahern
@ 2024-02-03  5:20 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-03  5:20 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: netdev, davem, edumazet, kuba, shuah, willemb, fw, dsahern,
	linux-kselftest

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  1 Feb 2024 19:42:37 +0100 you wrote:
> Another small bunch of fixes, addressing issues outlined by the
> netdev CI.
> 
> The first 2 patches are just rebased.
> 
> The following 2 are new fixes, for even more problems that surfaced
> meanwhile.
> 
> [...]

Here is the summary with links:
  - [v2,net,1/4] selftests: net: cut more slack for gro fwd tests.
    https://git.kernel.org/netdev/net/c/cb9f4a30fb85
  - [v2,net,2/4] selftests: net: fix setup_ns usage in rtnetlink.sh
    https://git.kernel.org/netdev/net/c/d75df7526477
  - [v2,net,3/4] selftests: net: fix tcp listener handling in pmtu.sh
    https://git.kernel.org/netdev/net/c/e71e016ad0f6
  - [v2,net,4/4] selftests: net: avoid just another constant wait
    https://git.kernel.org/netdev/net/c/691bb4e49c98

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



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

end of thread, other threads:[~2024-02-03  5:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 18:42 [PATCH v2 net 0/4] selftests: net: more fixes Paolo Abeni
2024-02-01 18:42 ` [PATCH v2 net 1/4] selftests: net: cut more slack for gro fwd tests Paolo Abeni
2024-02-01 18:42 ` [PATCH v2 net 2/4] selftests: net: fix setup_ns usage in rtnetlink.sh Paolo Abeni
2024-02-02 17:38   ` Paolo Abeni
2024-02-01 18:42 ` [PATCH v2 net 3/4] selftests: net: fix tcp listener handling in pmtu.sh Paolo Abeni
2024-02-01 18:42 ` [PATCH v2 net 4/4] selftests: net: avoid just another constant wait Paolo Abeni
2024-02-02  2:21 ` [PATCH v2 net 0/4] selftests: net: more fixes David Ahern
2024-02-03  5:20 ` patchwork-bot+netdevbpf

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