virtio-net: disable delayed refill when pausing rx
Subsystems (5)
v5 cover virtio-net: disable delayed refill when pausing rx
Hi everyone,
This only includes the selftest for virtio-net deadlock bug. The fix commit has been applied already.
Version 5 changes:
- Refactor the selftest
Version 4 changes:
- Add force zerocopy mode to xdp_helper
- Make virtio_net selftest use force zerocopy mode
- Move virtio_net selftest to drivers/net/hw
Version 3 changes:
- Patch 1: refactor to avoid code duplication
Version 2 changes:
- Add selftest for deadlock scenario
Thanks,
Quang Minh.
Bui Quang Minh (3):
selftests: net: move xdp_helper to net/lib
selftests: net: add flag to force zerocopy mode in xdp_helper
selftests: net: add a virtio_net deadlock selftest
tools/testing/selftests/drivers/net/Makefile | 2 -
.../testing/selftests/drivers/net/hw/Makefile | 1 +
.../selftests/drivers/net/hw/xsk_reconfig.py | 68 +++++++++++++++++++
tools/testing/selftests/drivers/net/queues.py | 4 +-
tools/testing/selftests/net/lib/.gitignore | 1 +
tools/testing/selftests/net/lib/Makefile | 1 +
.../{drivers/net => net/lib}/xdp_helper.c | 19 +++++-
7 files changed, 90 insertions(+), 6 deletions(-)
create mode 100755 tools/testing/selftests/drivers/net/hw/xsk_reconfig.py
rename tools/testing/selftests/{drivers/net => net/lib}/xdp_helper.c (90%)Signature · 1 line
2.43.0
PATCH v5 1/3 selftests: net: move xdp_helper to net/lib
Move xdp_helper to net/lib to make it easier for other selftests to use the helper.
---
tools/testing/selftests/drivers/net/Makefile | 2 --
tools/testing/selftests/drivers/net/queues.py | 4 ++--
tools/testing/selftests/net/lib/.gitignore | 1 +
tools/testing/selftests/net/lib/Makefile | 1 +
tools/testing/selftests/{drivers/net => net/lib}/xdp_helper.c | 0
5 files changed, 4 insertions(+), 4 deletions(-)
rename tools/testing/selftests/{drivers/net => net/lib}/xdp_helper.c (100%)tools/testing/selftests/drivers/net/Makefile +0 -2
@@ -6,8 +6,6 @@ TEST_INCLUDES := $(wildcard lib/py/*.py) \ ../../net/net_helper.sh \ ../../net/lib.sh \ -TEST_GEN_FILES := xdp_helper - TEST_PROGS := \ netcons_basic.sh \ netcons_fragmented_msg.sh \
tools/testing/selftests/drivers/net/queues.py +2 -2
@@ -26,13 +26,13 @@ def nl_get_queues(cfg, nl, qtype='rx'): def check_xsk(cfg, nl, xdp_queue_id=0) -> None: # Probe for support - xdp = cmd(f'{cfg.test_dir / "xdp_helper"} - -', fail=False) + xdp = cmd(f'{cfg.net_lib_dir / "xdp_helper"} - -', fail=False) if xdp.ret == 255: raise KsftSkipEx('AF_XDP unsupported') elif xdp.ret > 0: raise KsftFailEx('unable to create AF_XDP socket') - with bkg(f'{cfg.test_dir / "xdp_helper"} {cfg.ifindex} {xdp_queue_id}', + with bkg(f'{cfg.net_lib_dir / "xdp_helper"} {cfg.ifindex} {xdp_queue_id}', ksft_wait=3): rx = tx = False
tools/testing/selftests/net/lib/.gitignore +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only csum +xdp_helper
tools/testing/selftests/net/lib/Makefile +1 -0
@@ -10,6 +10,7 @@ TEST_FILES += ../../../../net/ynl TEST_GEN_FILES += csum TEST_GEN_FILES += $(patsubst %.c,%.o,$(wildcard *.bpf.c)) +TEST_GEN_FILES += xdp_helper TEST_INCLUDES := $(wildcard py/*.py sh/*.sh)
tools/testing/selftests/net/lib/xdp_helper.c renamed from tools/testing/selftests/drivers/net/xdp_helper.c +0 -0
Signature · 1 line
2.43.0
PATCH v5 2/3 selftests: net: add flag to force zerocopy mode in xdp_helper
In reply to Bui Quang MinhThis commit adds an optional -z flag to xdp_helper. When this flag is provided, the XDP socket binding is forced to be in zerocopy mode.
--- tools/testing/selftests/net/lib/xdp_helper.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
tools/testing/selftests/net/lib/xdp_helper.c +17 -2
@@ -62,6 +62,12 @@ static void ksft_wait(void)close (fd); } +static void print_usage (const char *bin) +{ +fprintf (stderr,"Usage: %s ifindex queue_id [-z]\n\n" +"where:\n\t-z: force zerocopy mode" , bin); +} +/* this is a simple helper program that creates an XDP socket and does the * minimum necessary to get bind() to succeed. *
@@ -81,8 +87,8 @@ int main(int argc, char **argv)int sock_fd;int queue; -if (argc !=3 ) { -fprintf (stderr,"Usage: %s ifindex queue_id\n" , argv[0 ]); +if (argc !=3 && argc !=4 ) { +print_usage (argv[0 ]);return 1 ; }
@@ -132,6 +138,15 @@ int main(int argc, char **argv) sxdp.sxdp_queue_id = queue; sxdp.sxdp_flags =0 ; +if (argc >3 ) { +if (!strcmp (argv[3 ],"-z" )) { + sxdp.sxdp_flags =XDP_ZEROCOPY ; + }else { +print_usage (argv[0 ]); +return 1 ; + } + } +if (bind (sock_fd, (struct sockaddr *)&sxdp,sizeof (sxdp)) !=0 ) {munmap (umem_area,UMEM_SZ );perror ("bind failed" );
Signature · 1 line
2.43.0
PATCH v5 3/3 selftests: net: add a virtio_net deadlock selftest
In reply to Bui Quang MinhThe selftest reproduces the deadlock scenario when binding/unbinding XDP program, XDP socket, rx ring resize on virtio_net interface.
--- .../testing/selftests/drivers/net/hw/Makefile | 1 + .../selftests/drivers/net/hw/xsk_reconfig.py | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100755 tools/testing/selftests/drivers/net/hw/xsk_reconfig.py
tools/testing/selftests/drivers/net/hw/Makefile +1 -0
@@ -21,6 +21,7 @@ TEST_PROGS = \ rss_ctx.py \ rss_input_xfrm.py \ tso.py \ + xsk_reconfig.py \ # TEST_FILES := \
tools/testing/selftests/drivers/net/hw/xsk_reconfig.py new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 6 lines · Bui Quang Minh
Hi everyone,
This only includes the selftest for virtio-net deadlock bug. The fix commit has been applied already.
Quoted 35 lines
Version 5 changes:
- Refactor the selftestVersion 4 changes:
- Add force zerocopy mode toxdp_helper
- Makevirtio_netselftest use force zerocopy mode
- Movevirtio_netselftest todrivers/net/hwVersion 3 changes:
- Patch 1: refactor to avoid code duplicationVersion 2 changes:
- Add selftest for deadlock scenarioThanks,
Quang Minh.Bui Quang Minh (3):
selftests: net: movexdp_helperto net/lib
selftests: net: add flag to force zerocopy mode inxdp_helper
selftests: net: add avirtio_netdeadlock selftesttools/testing/selftests/drivers/net/Makefile | 2 - .../testing/selftests/drivers/net/hw/Makefile | 1 + .../selftests/drivers/net/hw/xsk_reconfig.py | 68 +++++++++++++++++++ tools/testing/selftests/drivers/net/queues.py | 4 +- tools/testing/selftests/net/lib/.gitignore | 1 + tools/testing/selftests/net/lib/Makefile | 1 + .../{drivers/net => net/lib}/xdp_helper.c | 19 +++++- 7 files changed, 90 insertions(+), 6 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/hw/xsk_reconfig.py rename tools/testing/selftests/{drivers/net => net/lib}/xdp_helper.c (90%)Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 2 lines · On Thu, 24 Apr 2025 17:47:13 +0700 Bui Quang Minh wrote:
This only includes the selftest for virtio-net deadlock bug. The fix commit has been applied already.
This conflicts with Joe's series slightly:
https://lore.kernel.org/all/[email protected]/
Could you rebase on latest net-next and perhaps follow the comment I left on v4 ?
Signature · 1 line
pw-bot: cr
Quoted 7 lines · Jakub Kicinski
Quoted 2 lines · On Thu, 24 Apr 2025 17:47:13 +0700 Bui Quang Minh wrote:
This only includes the selftest for virtio-net deadlock bug. The fix commit has been applied already.
This conflicts with Joe's series slightly:
https://lore.kernel.org/all/[email protected]/
Could you rebase on latest net-next and perhaps follow the comment I left on v4 ?
Sure, I'll do it. Thanks for your review :)
Quang Minh.