netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: net: reuseport_bpf_numa: skip nodes not available
@ 2021-11-01 14:53 Kleber Sacilotto de Souza
  2021-11-04 15:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Kleber Sacilotto de Souza @ 2021-11-01 14:53 UTC (permalink / raw)
  To: netdev, linux-kselftest, linux-kernel
  Cc: David S . Miller, Daniel Borkmann, Shuah Khan, Jakub Kicinski

In some platforms the numa node numbers are not necessarily consecutive,
meaning that not all nodes from 0 to the value returned by
numa_max_node() are available on the system. Using node numbers which
are not available results on errors from libnuma such as:

---- IPv4 UDP ----
send node 0, receive socket 0
libnuma: Warning: Cannot read node cpumask from sysfs
./reuseport_bpf_numa: failed to pin to node: No such file or directory

Fix it by checking if the node number bit is set on numa_nodes_ptr,
which is defined on libnuma as "Set with all nodes the kernel has
exposed to userspace".

Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 tools/testing/selftests/net/reuseport_bpf_numa.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index c9f478b40996..b2eebf669b8c 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -211,12 +211,16 @@ static void test(int *rcv_fd, int len, int family, int proto)
 
 	/* Forward iterate */
 	for (node = 0; node < len; ++node) {
+		if (!numa_bitmask_isbitset(numa_nodes_ptr, node))
+			continue;
 		send_from_node(node, family, proto);
 		receive_on_node(rcv_fd, len, epfd, node, proto);
 	}
 
 	/* Reverse iterate */
 	for (node = len - 1; node >= 0; --node) {
+		if (!numa_bitmask_isbitset(numa_nodes_ptr, node))
+			continue;
 		send_from_node(node, family, proto);
 		receive_on_node(rcv_fd, len, epfd, node, proto);
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests: net: reuseport_bpf_numa: skip nodes not available
  2021-11-01 14:53 [PATCH] selftests: net: reuseport_bpf_numa: skip nodes not available Kleber Sacilotto de Souza
@ 2021-11-04 15:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-04 15:30 UTC (permalink / raw)
  To: Kleber Sacilotto de Souza
  Cc: netdev, linux-kselftest, linux-kernel, davem, daniel, shuah, kuba

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Mon,  1 Nov 2021 15:53:17 +0100 you wrote:
> In some platforms the numa node numbers are not necessarily consecutive,
> meaning that not all nodes from 0 to the value returned by
> numa_max_node() are available on the system. Using node numbers which
> are not available results on errors from libnuma such as:
> 
> ---- IPv4 UDP ----
> send node 0, receive socket 0
> libnuma: Warning: Cannot read node cpumask from sysfs
> ./reuseport_bpf_numa: failed to pin to node: No such file or directory
> 
> [...]

Here is the summary with links:
  - selftests: net: reuseport_bpf_numa: skip nodes not available
    https://git.kernel.org/bpf/bpf/c/a38bc45a08e9

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] 2+ messages in thread

end of thread, other threads:[~2021-11-04 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-01 14:53 [PATCH] selftests: net: reuseport_bpf_numa: skip nodes not available Kleber Sacilotto de Souza
2021-11-04 15:30 ` 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;
as well as URLs for NNTP newsgroup(s).