Subject: Re: [PROBLEM] seltests: net/forwarding/sch_ets.sh [HANG]

From: Petr Machata <[email-masked]>
Date: Thu, 20 Jul 2023 11:43:45 +0200

Mirsad Todorovac <[email-masked]> writes:

> Using the same config for 6.5-rc2 on Ubuntu 22.04 LTS and 22.10, the execution
> stop at the exact same line on both boxes (os I reckon it is more than an
> accident):
>
> # selftests: net/forwarding: sch_ets.sh
> # TEST: ping vlan 10                                                  [ OK ]
> # TEST: ping vlan 11                                                  [ OK ]
> # TEST: ping vlan 12                                                  [ OK ]
> # Running in priomap mode
> # Testing ets bands 3 strict 3, streams 0 1
> # TEST: band 0                                                        [ OK ]
> # INFO: Expected ratio >95% Measured ratio 100.00
> # TEST: band 1                                                        [ OK ]
> # INFO: Expected ratio <5% Measured ratio 0
> # Testing ets bands 3 strict 3, streams 1 2
> # TEST: band 1                                                        [ OK ]
> # INFO: Expected ratio >95% Measured ratio 100.00
> # TEST: band 2                                                        [ OK ]
> # INFO: Expected ratio <5% Measured ratio 0
> # Testing ets bands 4 strict 1 quanta 5000 2500 1500, streams 0 1
> # TEST: band 0                                                        [ OK ]
> # INFO: Expected ratio >95% Measured ratio 100.00
> # TEST: band 1                                                        [ OK ]
> # INFO: Expected ratio <5% Measured ratio 0
> # Testing ets bands 4 strict 1 quanta 5000 2500 1500, streams 1 2
> # TEST: bands 1:2                                                     [ OK ]
> # INFO: Expected ratio 2.00 Measured ratio 1.99
> # Testing ets bands 3 quanta 3300 3300 3300, streams 0 1 2
> # TEST: bands 0:1                                                     [ OK ]
> # INFO: Expected ratio 1.00 Measured ratio .99
> # TEST: bands 0:2                                                     [ OK ]
> # INFO: Expected ratio 1.00 Measured ratio 1.00
> # Testing ets bands 3 quanta 5000 3500 1500, streams 0 1 2
> # TEST: bands 0:1                                                     [ OK ]
> # INFO: Expected ratio 1.42 Measured ratio 1.42
> # TEST: bands 0:2                                                     [ OK ]
> # INFO: Expected ratio 3.33 Measured ratio 3.33
> # Testing ets bands 3 quanta 5000 8000 1500, streams 0 1 2
> # TEST: bands 0:1                                                     [ OK ]
> # INFO: Expected ratio 1.60 Measured ratio 1.59
> # TEST: bands 0:2                                                     [ OK ]
> # INFO: Expected ratio 3.33 Measured ratio 3.33
> # Testing ets bands 2 quanta 5000 2500, streams 0 1
> # TEST: bands 0:1                                                     [ OK ]
> # INFO: Expected ratio 2.00 Measured ratio 1.99
> # Running in classifier mode
> # Testing ets bands 3 strict 3, streams 0 1
> # TEST: band 0                                                        [ OK ]
> # INFO: Expected ratio >95% Measured ratio 100.00
> # TEST: band 1                                                        [ OK ]
> # INFO: Expected ratio <5% Measured ratio 0
> # Testing ets bands 3 strict 3, streams 1 2
> # TEST: band 1                                                        [ OK ]
> # INFO: Expected ratio >95% Measured ratio 100.00
> # TEST: band 2                                                        [ OK ]
> # INFO: Expected ratio <5% Measured ratio 0
> # Testing ets bands 4 strict 1 quanta 5000 2500 1500, streams 0 1
>
> I tried to run 'set -x' enabled version standalone, but that one finished
> correctly (?).
>
> It could be something previous scripts left, but right now I don't have a clue.
> I can attempt to rerun all tests with sch_ets.sh bash 'set -x' enabled later today.

If you run it standalone without set -x, does it finish as well? That
would imply that the reproducer needs to include the previous tests as
well.

It looks like the test is stuck in ets_test_mixed in classifier_mode.
A way to run just this test would be:

    TESTS="classifier_mode ets_test_mixed" ./sch_ets.sh

Looking at the code, the only place that I can see that waits on
anything is the "{ kill %% && wait %%; } 2>/dev/null" line in
stop_traffic() (in lib.sh). Maybe something like this would let
us see if that's the case:

modified   tools/testing/selftests/net/forwarding/lib.sh
@@ -1468,8 +1470,10 @@ start_tcp_traffic()
 
 stop_traffic()
 {
+	echo killing MZ
 	# Suppress noise from killing mausezahn.
 	{ kill %% && wait %%; } 2>/dev/null
+	echo killed MZ
 }