* [PATCH net-next v3 1/2] selftests: net: pass bpftrace timeout to cmd()
2026-03-10 11:58 [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling Gal Pressman
@ 2026-03-10 11:58 ` Gal Pressman
2026-03-10 11:58 ` [PATCH net-next v3 2/2] selftests: net: fix timeout passed as positional argument to communicate() Gal Pressman
2026-03-12 2:20 ` [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Gal Pressman @ 2026-03-10 11:58 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, netdev
Cc: Simon Horman, Shuah Khan, Breno Leitao, David Wei,
linux-kselftest, Gal Pressman, Nimrod Oren
The bpftrace() helper configures an interval based exit timer but does
not propagate the timeout to the cmd object, which defaults to 5
seconds. Since the default BPFTRACE_TIMEOUT is 10 seconds, cmd.process()
always raises a TimeoutExpired exception before bpftrace has a chance to
exit gracefully.
Pass timeout+5 to cmd() to allow bpftrace to complete gracefully.
Note: this issue is masked by a bug in the way cmd() passes timeout,
this is fixed in the next commit.
Fixes: 3c561c547c39 ("selftests: drv-net: add helper/wrapper for bpftrace")
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
tools/testing/selftests/net/lib/py/utils.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 5ffd9fb2a8ce..a6d7fe15e6e4 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -258,8 +258,9 @@ def bpftrace(expr, json=None, ns=None, host=None, timeout=None):
cmd_arr += ['-f', 'json', '-q']
if timeout:
expr += ' interval:s:' + str(timeout) + ' { exit(); }'
+ timeout += 5
cmd_arr += ['-e', expr]
- cmd_obj = cmd(cmd_arr, ns=ns, host=host, shell=False)
+ cmd_obj = cmd(cmd_arr, ns=ns, host=host, shell=False, timeout=timeout)
if json:
# bpftrace prints objects as lines
ret = {}
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next v3 2/2] selftests: net: fix timeout passed as positional argument to communicate()
2026-03-10 11:58 [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling Gal Pressman
2026-03-10 11:58 ` [PATCH net-next v3 1/2] selftests: net: pass bpftrace timeout to cmd() Gal Pressman
@ 2026-03-10 11:58 ` Gal Pressman
2026-03-12 2:20 ` [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Gal Pressman @ 2026-03-10 11:58 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, netdev
Cc: Simon Horman, Shuah Khan, Breno Leitao, David Wei,
linux-kselftest, Gal Pressman, Nimrod Oren
The cited commit refactored the hardcoded timeout=5 into a parameter,
but dropped the keyword from the communicate() call.
Since Popen.communicate()'s first positional argument is 'input' (not
'timeout'), the timeout value is silently treated as stdin input and the
call never enforces a timeout.
Pass timeout as a keyword argument to restore the intended behavior.
Fixes: 1cf270424218 ("net: selftest: add test for netdev netlink queue-get API")
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
tools/testing/selftests/net/lib/py/utils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index a6d7fe15e6e4..17adc2b67ee0 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -93,7 +93,7 @@ class cmd:
def _process_terminate(self, terminate, timeout):
if terminate:
self.proc.terminate()
- stdout, stderr = self.proc.communicate(timeout)
+ stdout, stderr = self.proc.communicate(timeout=timeout)
self.stdout = stdout.decode("utf-8")
self.stderr = stderr.decode("utf-8")
self.proc.stdout.close()
--
2.52.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling
2026-03-10 11:58 [PATCH net-next v3 0/2] selftests: net: fix cmd.process() timeout handling Gal Pressman
2026-03-10 11:58 ` [PATCH net-next v3 1/2] selftests: net: pass bpftrace timeout to cmd() Gal Pressman
2026-03-10 11:58 ` [PATCH net-next v3 2/2] selftests: net: fix timeout passed as positional argument to communicate() Gal Pressman
@ 2026-03-12 2:20 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-12 2:20 UTC (permalink / raw)
To: Gal Pressman
Cc: davem, edumazet, kuba, pabeni, andrew+netdev, netdev, horms,
shuah, leitao, dw, linux-kselftest
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 10 Mar 2026 13:58:01 +0200 you wrote:
> Pass the timeout argument correctly in cmd.process().
> As Jakub noted, fixing the timeout broke the bpftrace() command in
> netpoll_basic.py, so fix it first.
>
> Changelog:
> v2->v3: https://lore.kernel.org/all/20260308192126.2490631-1-gal@nvidia.com/
> * Resubmit to net-next.
>
> [...]
Here is the summary with links:
- [net-next,v3,1/2] selftests: net: pass bpftrace timeout to cmd()
https://git.kernel.org/netdev/net-next/c/82562972b854
- [net-next,v3,2/2] selftests: net: fix timeout passed as positional argument to communicate()
https://git.kernel.org/netdev/net-next/c/f0bd19316663
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] 4+ messages in thread