* [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node
@ 2026-08-03 1:42 Feng Tang
2026-08-04 1:42 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Feng Tang @ 2026-08-03 1:42 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Shuah Khan, Andi Kleen, netdev, linux-kselftest,
linux-kernel, bpf
Cc: Feng Tang
reuseport_bpf_numa case failed when testing on a platform with CXL
memory:
#./reuseport_bpf_numa
---- IPv4 UDP ----
send node 0, receive socket 0
./reuseport_bpf_numa: failed to pin to node: Invalid argument
The root cause is that the platform has 2 numa nodes: node 0 has
both cpu and memory, while node 1 is a CXL node which only has
memory, and caused numa_run_on_node() to fail.
Add sanity check to skip cpuless numa node for the numa binding test.
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
Changlog:
since v1:
* address comments from Sashiko bot
https://lore.kernel.org/all/20260730113738.41C901F000E9@smtp.kernel.org/
* lift the cpuless node out of send_from_node()
.../selftests/net/reuseport_bpf_numa.c | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index 8ec52fc5ef41..b5fb576fa61a 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -104,6 +104,26 @@ static void attach_bpf(int fd)
close(bpf_fd);
}
+/*
+ * Return true if it is a cpuless node. Return false if it isn't or any
+ * error (very unlikeyly) happens during the libnuma calls.
+ */
+static inline bool is_cpuless_node(int node_id)
+{
+ struct bitmask *cpumask;
+ bool ret = false;
+
+ cpumask = numa_allocate_cpumask();
+ if (!cpumask)
+ return ret;
+
+ if (!numa_node_to_cpus(node_id, cpumask) && !numa_bitmask_weight(cpumask))
+ ret = true;
+
+ numa_bitmask_free(cpumask);
+ return ret;
+}
+
static void send_from_node(int node_id, int family, int proto)
{
struct sockaddr_storage saddr, daddr;
@@ -213,6 +233,8 @@ static void test(int *rcv_fd, int len, int family, int proto)
for (node = 0; node < len; ++node) {
if (!numa_bitmask_isbitset(numa_nodes_ptr, node))
continue;
+ if (is_cpuless_node(node))
+ continue;
send_from_node(node, family, proto);
receive_on_node(rcv_fd, len, epfd, node, proto);
}
@@ -221,6 +243,8 @@ static void test(int *rcv_fd, int len, int family, int proto)
for (node = len - 1; node >= 0; --node) {
if (!numa_bitmask_isbitset(numa_nodes_ptr, node))
continue;
+ if (is_cpuless_node(node))
+ continue;
send_from_node(node, family, proto);
receive_on_node(rcv_fd, len, epfd, node, proto);
}
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node
2026-08-03 1:42 [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node Feng Tang
@ 2026-08-04 1:42 ` sashiko-bot
2026-08-06 15:51 ` Jakub Kicinski
2026-08-06 15:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-04 1:42 UTC (permalink / raw)
To: Feng Tang; +Cc: bpf
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Spelling mistake in newly added comment: 'unlikeyly' instead of 'unlikely'.
--
--- Patch [1]: [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node ---
commit 4e53579a82f841c838d35fa42c245feb267f6bcb
Author: Feng Tang <feng.tang@linux.alibaba.com>
selftests: net: reuseport_bpf_numa: consider cpuless numa node
This commit fixes a test failure on platforms with CXL memory where a NUMA
node might only have memory and no CPUs. It adds a sanity check to skip
cpuless NUMA nodes during the NUMA binding test to prevent
numa_run_on_node() from failing.
> diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
> index 8ec52fc5ef41b..b5fb576fa61af 100644
> --- a/tools/testing/selftests/net/reuseport_bpf_numa.c
> +++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
[ ... ]
> +/*
> + * Return true if it is a cpuless node. Return false if it isn't or any
> + * error (very unlikeyly) happens during the libnuma calls.
[Severity: Low]
This isn't a bug, but there is a typo here: "unlikeyly" instead of
"unlikely".
> + */
> +static inline bool is_cpuless_node(int node_id)
> +{
> + struct bitmask *cpumask;
> + bool ret = false;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803014214.80748-1-feng.tang@linux.alibaba.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node
2026-08-03 1:42 [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node Feng Tang
2026-08-04 1:42 ` sashiko-bot
@ 2026-08-06 15:51 ` Jakub Kicinski
2026-08-06 15:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-08-06 15:51 UTC (permalink / raw)
To: Feng Tang
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Andi Kleen, netdev, linux-kselftest, linux-kernel,
bpf
On Mon, 3 Aug 2026 09:42:14 +0800 Feng Tang wrote:
> + * error (very unlikeyly) happens during the libnuma calls.
spelling - "unlikeyly" instead of "unlikely"
when you repost please tag as net-next, rather than net
--
pw-bot: cr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node
2026-08-03 1:42 [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node Feng Tang
2026-08-04 1:42 ` sashiko-bot
2026-08-06 15:51 ` Jakub Kicinski
@ 2026-08-06 15:52 ` Jakub Kicinski
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2026-08-06 15:52 UTC (permalink / raw)
To: Feng Tang
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Shuah Khan, Andi Kleen, netdev, linux-kselftest, linux-kernel,
bpf
On Mon, 3 Aug 2026 09:42:14 +0800 Feng Tang wrote:
> +static inline bool is_cpuless_node(int node_id)
Also - why is this "inline" ? It's a test.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-06 15:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 1:42 [PATCH net v2] selftests: net: reuseport_bpf_numa: consider cpuless numa node Feng Tang
2026-08-04 1:42 ` sashiko-bot
2026-08-06 15:51 ` Jakub Kicinski
2026-08-06 15:52 ` Jakub Kicinski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.