Skip to contentSkip to conversation

selftests: drv-net: netpoll_basic: xfail if no hits

PATCH Applied Matthieu Baerts (NGI0) 3 participants 3 messages Nov 19 – Nov 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: drv-net: netpoll_basic: xfail if no hits

When netpoll_poll_dev() is not called during the test, bpftrace doesn't print the '@hits' map, because it is empty. The test then fails instead of reporting the expected XFAIL:

net.lib.py.ksft.KsftFailEx: bpftrace failed to run!?: {}

This has been observed regularly in the netdev CI with netdevsim, since a recent switch to Fedora 45: hitting this function depends on timings.

Fixes b3019343e4bd ("selftests: net: add netpoll basic functionality test")

---
I added the Fixes tag to help people validating this on stable kernel, but feel free to remove it if you prefer not to.
Note that the test is currently ignored on NIPA.

---
 tools/testing/selftests/drivers/net/netpoll_basic.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/netpoll_basic.py +2 -1
index 408bd54d6779..a4dc68c828cf 100755
@@ -236,7 +236,8 @@ def bpftrace_call() -> None:
     global MAPS  # pylint: disable=W0603
 
     # This will be passed to bpftrace as in bpftrace -e "expr"
-    expr = "kprobe:netpoll_poll_dev { @hits = count(); }"
+    # Init @hits: bpftrace doesn't print empty maps
+    expr = "BEGIN { @hits = 0; } kprobe:netpoll_poll_dev { @hits++; }"
 
     MAPS = bpftrace(expr, timeout=BPFTRACE_TIMEOUT, json=True)
     logging.debug("BPFtrace output: %s", MAPS)

---
base-commit: ac9dfaeb9cd9ab731c14d202a2f00098f0417766
change-id: 20261119-net-next-netpoll-basic-xfail-7da4cdeca5b9

Best regards,

Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Thu, Nov 19, 2026 at 11:52:01AM +0100, Matthieu Baerts (NGI0) wrote:

When netpoll_poll_dev() is not called during the test, bpftrace doesn't print the '@hits' map, because it is empty. The test then fails instead of reporting the expected XFAIL:

net.lib.py.ksft.KsftFailEx: bpftrace failed to run!?: {}

This has been observed regularly in the netdev CI with netdevsim, since a recent switch to Fedora 45: hitting this function depends on timings.

Fixes b3019343e4bd ("selftests: net: add netpoll basic functionality test")
#2 lore raw
In reply to Matthieu Baerts (NGI0)
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 19 Nov 2026 11:52:01 +0100 you wrote:

When netpoll_poll_dev() is not called during the test, bpftrace doesn't print the '@hits' map, because it is empty. The test then fails instead of reporting the expected XFAIL:

net.lib.py.ksft.KsftFailEx: bpftrace failed to run!?: {}

This has been observed regularly in the netdev CI with netdevsim, since a recent switch to Fedora 45: hitting this function depends on timings.

[...]

Here is the summary with links:
- [net-next] selftests: drv-net: netpoll_basic: xfail if no hits

    https://git.kernel.org/netdev/net-next/c/fd5f80a8a427

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html