summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/stats.py
diff options
context:
space:
mode:
authorDimitri Daskalakis <dimitri.daskalakis1@gmail.com>2025-11-11 14:53:19 -0800
committerJakub Kicinski <kuba@kernel.org>2025-11-12 18:04:18 -0800
commitf766f8cdde018967e9436f7f34d09907881fa7fa (patch)
treeeb5897ab5ddaf51ef977127cf6788b5df20a87c4 /tools/testing/selftests/drivers/net/stats.py
parente949824730daf381bd0fe37e1a77458e0c26e8df (diff)
selftests: drv-net: Limit the max number of queues in procfs_downup_hammer
For NICs with a large (1024+) number of queues, this test can cause excessive memory fragmentation. This results in OOM errors, and in the worst case driver/kernel crashes. We don't need to test with the max number of queues, just enough to create a high likelihood of races between reconfiguration and stats getting read. Signed-off-by: Dimitri Daskalakis <dimitri.daskalakis1@gmail.com> Link: https://patch.msgid.link/20251111225319.3019542-1-dimitri.daskalakis1@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/drivers/net/stats.py')
-rwxr-xr-xtools/testing/selftests/drivers/net/stats.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/testing/selftests/drivers/net/stats.py b/tools/testing/selftests/drivers/net/stats.py
index 04d0a2a13e73..b08e4d48b15c 100755
--- a/tools/testing/selftests/drivers/net/stats.py
+++ b/tools/testing/selftests/drivers/net/stats.py
@@ -263,14 +263,15 @@ def procfs_downup_hammer(cfg) -> None:
Reading stats via procfs only holds the RCU lock, drivers often try
to sleep when reading the stats, or don't protect against races.
"""
- # Max out the queues, we'll flip between max and 1
+ # Set a large number of queues,
+ # we'll flip between min(max_queues, 64) and 1
channels = ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
if channels['combined-count'] == 0:
rx_type = 'rx'
else:
rx_type = 'combined'
cur_queue_cnt = channels[f'{rx_type}-count']
- max_queue_cnt = channels[f'{rx_type}-max']
+ max_queue_cnt = min(channels[f'{rx_type}-max'], 64)
cmd(f"ethtool -L {cfg.ifname} {rx_type} {max_queue_cnt}")
defer(cmd, f"ethtool -L {cfg.ifname} {rx_type} {cur_queue_cnt}")