🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
4 messages
4 total messages Started by Jingjing Xu Tue, 10 Nov 2026 03:39
[PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
#13635
Author: Jingjing Xu
Date: Tue, 10 Nov 2026 03:39
37 lines
9820 bytes
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
Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
#13669
Author: Hangbin Liu
Date: Tue, 10 Nov 2026 06:26
41 lines
9816 bytes
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>
Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
#13838
Author: Xia Yan
Date: Tue, 10 Nov 2026 11:50
11 lines
9087 bytes
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>
Re: [PATCH net] selftests: net: udpgso_bench_tx: honor CPU zero in the affinity option
#15334
Author: patchwork-bot+netdevbpf
Date: Thu, 12 Nov 2026 17:20
29 lines
8997 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads