diff mbox series

[net] selftests: net: let big_tcp test cope with slow env

Message ID f011968fee563eeaaa82bf94e760e9f612eee356.1706889875.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit a19747c3b9bf6476cc36d0a3a5ef0ff92999169e
Delegated to: Netdev Maintainers
Headers show
Series [net] selftests: net: let big_tcp test cope with slow env | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 2 this patch: 0
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: line length of 97 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-04--21-00 (tests: 721)

Commit Message

Paolo Abeni Feb. 2, 2024, 4:06 p.m. UTC
In very slow environments, most big TCP cases including
segmentation and reassembly of big TCP packets have a good
chance to fail: by default the TCP client uses write size
well below 64K. If the host is low enough autocorking is
unable to build real big TCP packets.

Address the issue using much larger write operations.

Note that is hard to observe the issue without an extremely
slow and/or overloaded environment; reduce the TCP transfer
time to allow for much easier/faster reproducibility.

Fixes: 6bb382bcf742 ("selftests: add a selftest for big tcp")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/big_tcp.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Eric Dumazet Feb. 2, 2024, 4:13 p.m. UTC | #1
On Fri, Feb 2, 2024 at 5:07 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> In very slow environments, most big TCP cases including
> segmentation and reassembly of big TCP packets have a good
> chance to fail: by default the TCP client uses write size
> well below 64K. If the host is low enough autocorking is
> unable to build real big TCP packets.
>
> Address the issue using much larger write operations.
>
> Note that is hard to observe the issue without an extremely
> slow and/or overloaded environment; reduce the TCP transfer
> time to allow for much easier/faster reproducibility.
>
> Fixes: 6bb382bcf742 ("selftests: add a selftest for big tcp")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
>  tools/testing/selftests/net/big_tcp.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/big_tcp.sh b/tools/testing/selftests/net/big_tcp.sh
> index cde9a91c4797..2db9d15cd45f 100755
> --- a/tools/testing/selftests/net/big_tcp.sh
> +++ b/tools/testing/selftests/net/big_tcp.sh
> @@ -122,7 +122,9 @@ do_netperf() {
>         local netns=$1
>
>         [ "$NF" = "6" ] && serip=$SERVER_IP6
> -       ip net exec $netns netperf -$NF -t TCP_STREAM -H $serip 2>&1 >/dev/null
> +
> +       # use large write to be sure to generate big tcp packets
> +       ip net exec $netns netperf -$NF -t TCP_STREAM -l 1 -H $serip -- -m 262144 2>&1 >/dev/null
>  }

Interesting.

I think we set tcp_wmem[1] to 262144 in our hosts. I think netperf
default depends on tcp_wmem[1]

Reviewed-by: Eric Dumazet <edumazet@google.com>
Xin Long Feb. 2, 2024, 4:25 p.m. UTC | #2
On Fri, Feb 2, 2024 at 11:07 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> In very slow environments, most big TCP cases including
> segmentation and reassembly of big TCP packets have a good
> chance to fail: by default the TCP client uses write size
> well below 64K. If the host is low enough autocorking is
> unable to build real big TCP packets.
>
> Address the issue using much larger write operations.
>
> Note that is hard to observe the issue without an extremely
> slow and/or overloaded environment; reduce the TCP transfer
> time to allow for much easier/faster reproducibility.
>
> Fixes: 6bb382bcf742 ("selftests: add a selftest for big tcp")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Paolo Abeni Feb. 2, 2024, 4:31 p.m. UTC | #3
On Fri, 2024-02-02 at 17:13 +0100, Eric Dumazet wrote:
> On Fri, Feb 2, 2024 at 5:07 PM Paolo Abeni <pabeni@redhat.com> wrote:
> > 
> > In very slow environments, most big TCP cases including
> > segmentation and reassembly of big TCP packets have a good
> > chance to fail: by default the TCP client uses write size
> > well below 64K. If the host is low enough autocorking is
> > unable to build real big TCP packets.
> > 
> > Address the issue using much larger write operations.
> > 
> > Note that is hard to observe the issue without an extremely
> > slow and/or overloaded environment; reduce the TCP transfer
> > time to allow for much easier/faster reproducibility.
> > 
> > Fixes: 6bb382bcf742 ("selftests: add a selftest for big tcp")
> > Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> > ---
> >  tools/testing/selftests/net/big_tcp.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/net/big_tcp.sh b/tools/testing/selftests/net/big_tcp.sh
> > index cde9a91c4797..2db9d15cd45f 100755
> > --- a/tools/testing/selftests/net/big_tcp.sh
> > +++ b/tools/testing/selftests/net/big_tcp.sh
> > @@ -122,7 +122,9 @@ do_netperf() {
> >         local netns=$1
> > 
> >         [ "$NF" = "6" ] && serip=$SERVER_IP6
> > -       ip net exec $netns netperf -$NF -t TCP_STREAM -H $serip 2>&1 >/dev/null
> > +
> > +       # use large write to be sure to generate big tcp packets
> > +       ip net exec $netns netperf -$NF -t TCP_STREAM -l 1 -H $serip -- -m 262144 2>&1 >/dev/null
> >  }
> 
> Interesting.
> 
> I think we set tcp_wmem[1] to 262144 in our hosts. I think netperf
> default depends on tcp_wmem[1]

I haven't dug into the netperf source, but the above would be
consistent with what I observe: in my VM I see 16Kb writes and
tcp_wmem[1] is 16K.

> Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks!

Paolo
patchwork-bot+netdevbpf@kernel.org Feb. 5, 2024, 12:40 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri,  2 Feb 2024 17:06:59 +0100 you wrote:
> In very slow environments, most big TCP cases including
> segmentation and reassembly of big TCP packets have a good
> chance to fail: by default the TCP client uses write size
> well below 64K. If the host is low enough autocorking is
> unable to build real big TCP packets.
> 
> Address the issue using much larger write operations.
> 
> [...]

Here is the summary with links:
  - [net] selftests: net: let big_tcp test cope with slow env
    https://git.kernel.org/netdev/net/c/a19747c3b9bf

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/big_tcp.sh b/tools/testing/selftests/net/big_tcp.sh
index cde9a91c4797..2db9d15cd45f 100755
--- a/tools/testing/selftests/net/big_tcp.sh
+++ b/tools/testing/selftests/net/big_tcp.sh
@@ -122,7 +122,9 @@  do_netperf() {
 	local netns=$1
 
 	[ "$NF" = "6" ] && serip=$SERVER_IP6
-	ip net exec $netns netperf -$NF -t TCP_STREAM -H $serip 2>&1 >/dev/null
+
+	# use large write to be sure to generate big tcp packets
+	ip net exec $netns netperf -$NF -t TCP_STREAM -l 1 -H $serip -- -m 262144 2>&1 >/dev/null
 }
 
 do_test() {