summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-02-27 20:13:03 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-03 05:21:15 +0300
commit27c4ab943882c8ca7d3c56241cd969da6b5e6727 (patch)
tree778b20673b5c6153e0b2bb90642ff6bfd90baa63 /tools/testing
parent8341c989ac77d712c7d6e2bce29e8a4bcb2eeae4 (diff)
downloadlinux-27c4ab943882c8ca7d3c56241cd969da6b5e6727.tar.xz
selftests: drv-net: iou-zcrx: wait for memory provider cleanup
io_uring defers zcrx context teardown to the iou_exit workqueue. # ps aux | grep iou ... 07:58 0:00 [kworker/u19:0-iou_exit] ... 07:58 0:00 [kworker/u18:2-iou_exit] When the test's receiver process exits, bkg() returns but the memory provider may still be attached to the rx queue. The subsequent defer() that restores tcp-data-split then fails: # Exception while handling defer / cleanup (callback 3 of 3)! # Defer Exception| net.ynl.pyynl.lib.ynl.NlError: Netlink error: can't disable tcp-data-split while device has memory provider enabled: Invalid argument not ok 1 iou-zcrx.test_zcrx.single Add a helper that polls netdev queue-get until no rx queue reports the io-uring memory provider attribute. Register it as a defer() just before tcp-data-split is restored as a "barrier". Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Link: https://patch.msgid.link/20260227171305.2848240-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/drivers/net/hw/iou-zcrx.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
index c63d6d6450d2..c27c2064701d 100755
--- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
+++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
@@ -2,14 +2,27 @@
# SPDX-License-Identifier: GPL-2.0
import re
+import time
from os import path
from lib.py import ksft_run, ksft_exit, KsftSkipEx, ksft_variants, KsftNamedVariant
from lib.py import NetDrvEpEnv
from lib.py import bkg, cmd, defer, ethtool, rand_port, wait_port_listen
-from lib.py import EthtoolFamily
+from lib.py import EthtoolFamily, NetdevFamily
SKIP_CODE = 42
+
+def mp_clear_wait(cfg):
+ """Wait for io_uring memory providers to clear from all device queues."""
+ deadline = time.time() + 5
+ while time.time() < deadline:
+ queues = cfg.netnl.queue_get({'ifindex': cfg.ifindex}, dump=True)
+ if not any('io-uring' in q for q in queues):
+ return
+ time.sleep(0.1)
+ raise TimeoutError("Timed out waiting for memory provider to clear")
+
+
def create_rss_ctx(cfg):
output = ethtool(f"-X {cfg.ifname} context new start {cfg.target} equal 1").stdout
values = re.search(r'New RSS context is (\d+)', output).group(1)
@@ -46,6 +59,7 @@ def single(cfg):
'tcp-data-split': 'unknown',
'hds-thresh': hds_thresh,
'rx': rx_rings})
+ defer(mp_clear_wait, cfg)
cfg.target = channels - 1
ethtool(f"-X {cfg.ifname} equal {cfg.target}")
@@ -73,6 +87,7 @@ def rss(cfg):
'tcp-data-split': 'unknown',
'hds-thresh': hds_thresh,
'rx': rx_rings})
+ defer(mp_clear_wait, cfg)
cfg.target = channels - 1
ethtool(f"-X {cfg.ifname} equal {cfg.target}")
@@ -159,6 +174,7 @@ def main() -> None:
cfg.bin_remote = cfg.remote.deploy(cfg.bin_local)
cfg.ethnl = EthtoolFamily()
+ cfg.netnl = NetdevFamily()
cfg.port = rand_port()
ksft_run(globs=globals(), cases=[test_zcrx, test_zcrx_oneshot], args=(cfg, ))
ksft_exit()