diff mbox series

selftests: net: reuseport_bpf_numa: skip nodes not available

Message ID 20211101145317.286118-1-kleber.souza@canonical.com (mailing list archive)
State Accepted
Commit a38bc45a08e9759f04d61669f45941d6624d173c
Delegated to: BPF
Headers show
Series selftests: net: reuseport_bpf_numa: skip nodes not available | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 8 maintainers not CCed: john.fastabend@gmail.com yhs@fb.com songliubraving@fb.com bpf@vger.kernel.org kafai@fb.com kpsingh@kernel.org ast@kernel.org andrii@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files
bpf/vmtest-bpf-PR success PR summary
bpf/vmtest-bpf success VM_Test
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next fail VM_Test
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Kleber Sacilotto de Souza Nov. 1, 2021, 2:53 p.m. UTC
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(+)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 4, 2021, 3:30 p.m. UTC | #1
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!
diff mbox series

Patch

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);
 	}