selftests/net: deflake GRO tests
authorKevin Krakauer <krakauer@google.com>
Wed, 26 Feb 2025 19:27:25 +0000 (11:27 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 28 Feb 2025 02:38:23 +0000 (18:38 -0800)
GRO tests are timing dependent and can easily flake. This is partially
mitigated in gro.sh by giving each subtest 3 chances to pass. However,
this still flakes on some machines. Reduce the flakiness by:

- Bumping retries to 6.
- Setting napi_defer_hard_irqs to 1 to reduce the chance that GRO is
  flushed prematurely. This also lets us reduce the gro_flush_timeout
  from 1ms to 100us.

Tested: Ran `gro.sh -t large` 1000 times. There were no failures with
this change. Ran inside strace to increase flakiness.

Signed-off-by: Kevin Krakauer <krakauer@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250226192725.621969-4-krakauer@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/gro.sh
tools/testing/selftests/net/setup_veth.sh

index aabd6e5480b8e59809711ca2d64f7df6f7f618f5..9e3f186bc2a14c7877df26fdc8f7fc59af6d86c6 100755 (executable)
@@ -18,10 +18,10 @@ run_test() {
   "--smac" "${CLIENT_MAC}" "--test" "${test}" "--verbose" )
 
   setup_ns
-  # Each test is run 3 times to deflake, because given the receive timing,
+  # Each test is run 6 times to deflake, because given the receive timing,
   # not all packets that should coalesce will be considered in the same flow
   # on every try.
-  for tries in {1..3}; do
+  for tries in {1..6}; do
     # Actual test starts here
     ip netns exec $server_ns ./gro "${ARGS[@]}" "--rx" "--iface" "server" \
       1>>log.txt &
index 1f78a87f6f37eaab8dc41850e1a906f9aef6315f..eb3182066d126f0d93b7a97644bd1d4ec44e6736 100644 (file)
@@ -11,7 +11,8 @@ setup_veth_ns() {
        local -r ns_mac="$4"
 
        [[ -e /var/run/netns/"${ns_name}" ]] || ip netns add "${ns_name}"
-       echo 1000000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
+       echo 100000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
+       echo 1 > "/sys/class/net/${ns_dev}/napi_defer_hard_irqs"
        ip link set dev "${ns_dev}" netns "${ns_name}" mtu 65535
        ip -netns "${ns_name}" link set dev "${ns_dev}" up