๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25410

Re: [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test

#25410
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 18:10
129 lines
12306 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The "zerocopy" variant of tcp() in stream.py adds "--msg-
  zerocopy" and "--zerocopy-rx".
- [Low] The commit message for stream.py says it measures one TCP
  connection "with the same settings as devmem.py otherwise".

--

selftests: drv-net: add a kperf stream test

This adds stream.py, a drv-net perf selftest that uses kperf to measure
the throughput of a single TCP connection. It has two variants: plain
copy, and MSG_ZEROCOPY on the sender with TCP_ZEROCOPY_RECEIVE on the
receiver.

> Add stream.py, which measures the throughput of one TCP connection with
> kperf, with the same settings as devmem.py otherwise: once over copying
> sockets, and once with MSG_ZEROCOPY on the sender and
> TCP_ZEROCOPY_RECEIVE on the receiver.

[Severity: Low]
Is "with the same settings as devmem.py otherwise" accurate?

The two tests share the kperf client options: --time 15, the 64 MiB read
and write sizes, --pin-off 4 and --validate no.

devmem.py's kperf() also sets up the device before it measures:

tools/testing/selftests/drivers/net/perf/devmem.py:kperf() {
    ...
    _enable_hw_gro(cfg)
    ...
        "tcp-data-split": "enabled",
    ...
        config["hds-thresh"] = 0
    defer(ethnl.rings_set, restore)
    ethnl.rings_set(config)
    ...
        "--num-rx-queues", "4",
    ...
}

stream.py's tcp() does none of this, so it runs with the driver's
default GRO, HDS and RSS settings. The message only mentions the change
from 4 connections to 1.

Could the message say that the device-level setup also differs? Then the
stream.py and devmem.py numbers wouldn't be read as directly comparable.

> diff --git a/tools/testing/selftests/drivers/net/perf/stream.py b/tools/testing/selftests/drivers/net/perf/stream.py
> new file mode 100755
> index 0000000000000..4ed9d64dfa320
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/perf/stream.py
> @@ -0,0 +1,40 @@

[ ... ]

> +@ksft_variants([
> +    KsftNamedVariant("copy", []),
> +    KsftNamedVariant("zerocopy", ["--msg-zerocopy", "--zerocopy-rx"]),
> +])
> +def tcp(cfg, mode_args) -> None:
> +    """Measure the throughput of one TCP connection."""
> +    stream_args = [

[ ... ]

> +    with KperfRunner(cfg) as runner:
> +        result = runner.run(stream_args)
> +
> +    ksft_metric("throughput", result.target_throughput, goal="higher")

[Severity: Medium]
Does the zerocopy variant actually exercise TCP_ZEROCOPY_RECEIVE on a
device with default settings?

The variant only adds kperf flags. On the kernel side, can_map_frag()
only maps full-page frags at offset 0:

net/ipv4/tcp.c:can_map_frag() {
    ...
	if (skb_frag_size(frag) != PAGE_SIZE || skb_frag_off(frag))
		return false;
    ...
}

NICs normally produce frags like that only with header-data split and an
MTU large enough for page-sized payloads. stream.py sets neither.
devmem.py at least enables tcp-data-split.

With no HDS and a 1500 MTU, every payload frag fails can_map_frag().
tcp_zerocopy_receive() then maps nothing, and the receiver copies the
data instead.

Nothing here checks whether zerocopy happened. KperfRunner.parse() in
drivers/net/lib/py/kperf.py only extracts throughput, rate and latency:

        return KperfResult(sum(throughput["Source"]),
                           sum(throughput["Target"]), **rr)

tcp() then reports only the throughput metric.

Can the "zerocopy" result come from the copy receive path and still be
labelled zerocopy? If so, a loss of TCP_ZEROCOPY_RECEIVE, or a
regression in it, would not show up in this sub-case.

If kperf fails instead of falling back when nothing can be mapped,
wouldn't this variant fail on most default setups?

Would it make sense to enable HDS (and possibly raise the MTU) for this
variant? Another option is to check that pages were actually mapped, or
that SO_EE_CODE_ZEROCOPY_COPIED was not reported.

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130174609.314114-1-sdf.kernel%40gmail.com
Technical Details
Message-ID: <179614863027.3146.1700516544609872670@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375275-linux-kernel-netdev=dewy.ru
References: <20261130174609.314114-4-sdf.kernel@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375275-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 3/4] selftests: drv-net: add a kperf stream test
Date: Tue, 01 Dec 2026 18:10:30 +0000
Organization: Usenet Network
Message-ID: <179614863027.3146.1700516544609872670@kernel.org>
References: <20261130174609.314114-4-sdf.kernel@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1784821"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+Wur7NLnxuohcrEotkGosEPxIEU= sha256:5t1lylquIyiL2evE/LPyA8DgSIwa12dygqJa2jhWFog=
	sha1:26clnjBGTcJgLn8OfXklLdmUp+A= sha256:uLHumzn9SXyvBmjc8xK+OtJs9OQonRjOztUhJqLEEzw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9A970117453; Tue,  1 Dec 2026 21:10:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id KjADIStPxSwr;
	Tue,  1 Dec 2026 21:10:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-375275-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 7451D11744F; Tue,  1 Dec 2026 21:10:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id A5FBA2A64B; Tue,  1 Dec 2026 18:10:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796148632;
	b=onl0W0NHBwHUM60fsnwShazcyhcFZlovqzMk45xVcmvXL5JasKKiLS9+SszL6jmrqJpT
	 S2rmxUG2mIulLS73IiC6x05aWzSEm/AxI3+l+1LyHsMrqvNZJdw/Any7QQV9cbOhMtXqj
	 oW5CwPbfgsB7dg+1ZtP5KQaXWLpBaqxscjR0DpX+JZ+y13GbBwj3yNrUHUVCaHYw4i/t1
	 26K/Tp8eP9hnaVIjLverln7gmOYLsS9OKkyR2yFAv+G9c33CltYltHDATtgiRqZcVttvu
	 qvNUnanTSWc2oHU4JcoyaMvSlPIxZPcypiNmrWgJY/KNsIv11a7kVR6gwqcizOUKnTQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796148632;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=0MNyNtPaSVRMfD6bkPhOM2FuPmY8j2w/+NNWG7s99vo=;
	b=THt/iAwgCR5DbWYmzsx7Tr9K714KOEA8dVLl8WYGQWclNBj/nxYFIi867EIp6/+n3F1f
	 62+LgNyEsqlwgumDOtsDtDdOVBuglvhgwyTfVImtmVYE+sK59PDSO3LDEjtlazDGbbmlF
	 B3YAdPN7VKJMhfuBN4EQ3q2m+6na2cb5WBWw4QxTOB6+muxG59DUFUF96ieqwGXKKtNZw
	 XrahC8blEMh6hkXy2eivLYzO0vJMCCUtuI3OXi9AecyY/AM3ZLIRsP3cVzUFhYd6hPuOG
	 g++pEygtD877VBpcgz+1GdjXVFLyaIPY8elox88o2dO6/k90mnOagVZSIksbDQtfGUg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8ubjlaF;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DB2C606A32E;
	Tue,  1 Dec 2026 18:10:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8ubjlaF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796148631;
	b=vQa3dsp4+8z1VkIInKFQKchu/bzY+v7jRryaoD9wEcpPt3r9Jn7ry6wx1DryxE4i6K3y
	 1c/7ifVYKkckjus4uIAw45bGCi/O1fzrqc4tTghQw8UzCPbKH+mI/ZbFIkndU7cxxcVWV
	 k8V8OSjmYqoiln14jGqztHh7S/maSG2CHZeDve1pL0zxiGvpUQaXWZtOkqM3JaJuwoUAk
	 p/bHuiOgfb/86VZCvXVk5vO4cRkhDqaD3ola9sUULGKSwo0GJu0EZxuXCe+JLiN9bYzfC
	 SiCGItVZATmw53tcays0Il84+MOgoEgVgmcPgOoYbcp3nl8iqvDmym3RXMvvbfea6aw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796148631;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=0MNyNtPaSVRMfD6bkPhOM2FuPmY8j2w/+NNWG7s99vo=;
	b=xfcWMV9J5S3UgESlfFQwRdbj7tUyaWULAXic/1/+gKadxuFojDkD40OwVxZNmLITjGyg
	 ilsXRVjw33pdZfs6D3Ix6AIV0Lb/fDw19L27q+ijEfOlKQOK0NF4NoXSByD5lg00//U3c
	 /RmkRfFCYXAV4H4nAIO/8LIt7I9MUfmuDWyeYodr+G8a9DH7Y1aG0/gFBFtStqcjh6SNa
	 Vze/HeUozBfvQlvp8dY/ZblCwKCJY9uiMr69VI2drg5Rf2yaZOD3Gl9Z0AG4Iz8dv9c0y
	 f7CU9ZqC9xyxd7ZgHrvAb4wi+GjJ0uQ7JQ9Cwd3vKM/4ayC0+p8rW6JgA/bopEZa+tw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=L8ubjlaF;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A575606A335;
	Tue,  1 Dec 2026 18:10:31 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3E11F00926;
	Tue,  1 Dec 2026 18:10:30 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796148631;
	bh=0MNyNtPaSVRMfD6bkPhOM2FuPmY8j2w/+NNWG7s99vo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=L8ubjlaFg9e1T3Zh/XFLzNwCicVri8zutBsL5vXWPTQBZJOe8rVQi7mBeIdzD11sZ
	 b8UaqqjKvY/VyYr4XtB4Axu7CnAMKX8sDKsNzhZWPj1kkLqn8b+5vzoTTo+a7stHqF
	 EggFtHQWroua9afNnFO3XS95v4hI/J80QEkX+G5Jm3xDOdBwEopuuqtdK7esu9iaaw
	 UNoFK7IhfiLA3Xp9eV/kkTa2hG+1Pb2dVWIFwMSm78KqGhd9JUGvNq9ika6UHZb/wk
	 iRScAe/2zAsx2T7VZinm6MgIcss1kSkztlLMUIl/qZVwMi8s+cnjYUlzDJ8kcFoBZw
	 RC8YHl3D7wxvQ==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
 kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
 edumazet@kernel.org, shuah@kernel.org, sdf@fomichev.me, bjorn@kernel.org,
 linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261130174609.314114-4-sdf.kernel@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list