* [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
@ 2026-11-10 3:39 Jingjing Xu
2026-11-10 6:26 ` Hangbin Liu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jingjing Xu @ 2026-11-10 3:39 UTC (permalink / raw)
To: netdev
Cc: willemb, kuba, shuah, linux-kselftest, davem, edumazet, pabeni,
horms
The -C option accepts a CPU number, with -1 meaning that affinity was
not requested. Testing cfg_cpu > 0 ignores an explicit -C 0, so the
benchmark can run on other CPUs despite the requested pinning.
Accept zero as well, keeping the negative default unchanged.
Discovered by Codex-assisted code inspection. Validated before and after
the fix with loopback UDP traffic, inheriting CPUs 0 and 1 and reading
the process affinity with sched_getaffinity(). Before the fix, -C 0
retains both CPUs; after it, only CPU 0 is allowed. The default and -C 1
cases retain their expected masks. Built with GCC using -Wall -Werror.
No kernel instrumentation or fault injection was used.
Fixes: 3a687bef148d ("selftests: udp gso benchmark")
Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
---
tools/testing/selftests/net/udpgso_bench_tx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
index 86d80cce55b4..797c8d6800f0 100644
--- a/tools/testing/selftests/net/udpgso_bench_tx.c
+++ b/tools/testing/selftests/net/udpgso_bench_tx.c
@@ -642,7 +642,7 @@ int main(int argc, char **argv)
parse_opts(argc, argv);
- if (cfg_cpu > 0)
+ if (cfg_cpu >= 0)
set_cpu(cfg_cpu);
for (i = 0; i < sizeof(buf[0]); i++)
base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
2026-11-10 3:39 [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option Jingjing Xu
@ 2026-11-10 6:26 ` Hangbin Liu
2026-11-10 11:50 ` Xia Yan
2026-11-12 17:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2026-11-10 6:26 UTC (permalink / raw)
To: Jingjing Xu
Cc: netdev, willemb, kuba, shuah, linux-kselftest, davem, edumazet,
pabeni, horms
On Tue, Nov 10, 2026 at 03:39:20AM +0000, Jingjing Xu wrote:
> The -C option accepts a CPU number, with -1 meaning that affinity was
> not requested. Testing cfg_cpu > 0 ignores an explicit -C 0, so the
> benchmark can run on other CPUs despite the requested pinning.
>
> Accept zero as well, keeping the negative default unchanged.
>
> Discovered by Codex-assisted code inspection. Validated before and after
> the fix with loopback UDP traffic, inheriting CPUs 0 and 1 and reading
> the process affinity with sched_getaffinity(). Before the fix, -C 0
> retains both CPUs; after it, only CPU 0 is allowed. The default and -C 1
> cases retain their expected masks. Built with GCC using -Wall -Werror.
>
> No kernel instrumentation or fault injection was used.
>
> Fixes: 3a687bef148d ("selftests: udp gso benchmark")
> Signed-off-by: Jingjing Xu <xujingjing@cmss.chinamobile.com>
> ---
> tools/testing/selftests/net/udpgso_bench_tx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/udpgso_bench_tx.c b/tools/testing/selftests/net/udpgso_bench_tx.c
> index 86d80cce55b4..797c8d6800f0 100644
> --- a/tools/testing/selftests/net/udpgso_bench_tx.c
> +++ b/tools/testing/selftests/net/udpgso_bench_tx.c
> @@ -642,7 +642,7 @@ int main(int argc, char **argv)
>
> parse_opts(argc, argv);
>
> - if (cfg_cpu > 0)
> + if (cfg_cpu >= 0)
> set_cpu(cfg_cpu);
>
> for (i = 0; i < sizeof(buf[0]); i++)
> base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
> --
> 2.53.0
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
2026-11-10 3:39 [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option Jingjing Xu
2026-11-10 6:26 ` Hangbin Liu
@ 2026-11-10 11:50 ` Xia Yan
2026-11-12 17:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Xia Yan @ 2026-11-10 11:50 UTC (permalink / raw)
To: Jingjing Xu, netdev
Cc: willemb, kuba, shuah, linux-kselftest, davem, edumazet, pabeni,
horms, yana06070
On 11/10/26 03:39, Jingjing Xu wrote:
> Testing cfg_cpu > 0 ignores an explicit -C 0, so the
> benchmark can run on other CPUs despite the requested pinning.
Looks right. cfg_cpu defaults to -1 and set_cpu() treats 0 like any
other CPU number, so ">= 0" honors -C 0 without changing the
default. 3a687bef148d added the option and the "> 0" test together,
so the Fixes tag is accurate.
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
2026-11-10 3:39 [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option Jingjing Xu
2026-11-10 6:26 ` Hangbin Liu
2026-11-10 11:50 ` Xia Yan
@ 2026-11-12 17:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-12 17:20 UTC (permalink / raw)
To: Jingjing Xu
Cc: netdev, willemb, kuba, shuah, linux-kselftest, davem, edumazet,
pabeni, horms
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 10 Nov 2026 03:39:20 +0000 you wrote:
> The -C option accepts a CPU number, with -1 meaning that affinity was
> not requested. Testing cfg_cpu > 0 ignores an explicit -C 0, so the
> benchmark can run on other CPUs despite the requested pinning.
>
> Accept zero as well, keeping the negative default unchanged.
>
> Discovered by Codex-assisted code inspection. Validated before and after
> the fix with loopback UDP traffic, inheriting CPUs 0 and 1 and reading
> the process affinity with sched_getaffinity(). Before the fix, -C 0
> retains both CPUs; after it, only CPU 0 is allowed. The default and -C 1
> cases retain their expected masks. Built with GCC using -Wall -Werror.
>
> [...]
Here is the summary with links:
- [net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
https://git.kernel.org/netdev/net-next/c/c2d5ef7e600b
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] 4+ messages in thread
end of thread, other threads:[~2026-11-12 17:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 3:39 [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option Jingjing Xu
2026-11-10 6:26 ` Hangbin Liu
2026-11-10 11:50 ` Xia Yan
2026-11-12 17: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