On Wed, 9 Oct 2024 11:07:07 +0200 Laurent Vivier <lvivier(a)redhat.com> wrote:This series of patches adds vhost-user support to passt and then allows passt to connect to QEMU network backend using virtqueue rather than a socket. With QEMU, rather than using to connect: -netdev stream,id=s,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket we will use: -chardev socket,id=chr0,path=/tmp/passt_1.socket -netdev vhost-user,id=netdev0,chardev=chr0 -device virtio-net,netdev=netdev0 -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE -numa node,memdev=memfd0 The memory backend is needed to share data between passt and QEMU.I just got the tests from 8/8 hanging like this (display with >= 212 columns): guest$ socat -u TCP6-LISTEN:10001 OPEN:test_big.bin,create,trunc │Starting test: TCP/IPv6: host to ns: small transfer guest$ cmp test_big.bin /root/big.bin │? cmp /tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_ns_small.bin /home/sbrivio/passt/test/small.bin guest$ socat -u TCP6-LISTEN:10001 OPEN:test_big.bin,create,trunc │...passed. guest$ cmp test_big.bin /root/big.bin │ guest$ socat -u TCP6-LISTEN:10001 OPEN:test_small.bin,create,trunc │Starting test: TCP/IPv6: guest to host: small transfer guest$ cmp test_small.bin /root/small.bin │? cmp /tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin /home/sbrivio/passt/test/small.bin guest$ socat -u OPEN:/root/small.bin TCP6:[2001:db8:9a55::1]:10003 │...passed. guest$ socat -u OPEN:/root/small.bin TCP6:[2001:db8:9a55::2]:10002 │ guest$ socat -u TCP6-LISTEN:10001 OPEN:test_small.bin,create,trunc │Starting test: TCP/IPv6: guest to ns: small transfer guest$ cmp test_small.bin /root/small.bin │? cmp /tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_ns_small.bin /home/sbrivio/passt/test/small.bin guest$ socat -u TCP6-LISTEN:10001 OPEN:test_small.bin,create,trunc │...passed. guest$ cmp test_small.bin /root/small.bin │ guest$ which socat ip jq >/dev/null │Starting test: TCP/IPv6: ns to host (spliced): small transfer guest$ socat -u UDP4-LISTEN:10001,null-eof OPEN:test.bin,create,trunc │? cmp /tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin /home/sbrivio/passt/test/small.bin │...passed. ──guest──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ ns$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP6:[2001:db8:9a55::1]:10003 │Starting test: TCP/IPv6: ns to host (via tap): small transfer ns$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP6:[::1]:10001 │? cmp /tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin /home/sbrivio/passt/test/small.bin ns$ ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname' │...passed. enp9s0 │ ns$ ip -j -6 addr show|jq -rM '.[] | select(.ifname == "enp9s0").addr_info[0].local' │Starting test: TCP/IPv6: ns to guest (using loopback address): small transfer 2a01:4f8:222:904::2 │...passed. ns$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP6:[2a01:4f8:222:904::2]:10001 │ ns$ socat -u TCP6-LISTEN:10002 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_ns_small.bin,create,trunc │Starting test: TCP/IPv6: ns to guest (using namespace address): small transfer ns$ socat -u TCP6-LISTEN:10002 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_ns_small.bin │...passed. ns$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[::1]:10003 │ ns$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[2001:db8:9a55::1]:10003 │================================================================================================================== ns$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[::1]:10001 │Starting tests in file: passt_vu_in_ns/udp ns$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[2a01:4f8:222:904::2]:10001 │ ns$ which socat ip jq >/dev/null │Starting test: UDP/IPv4: host to guest ns$ │ ──namespace─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────┴──passt_vu_in_ns/udp [1/16] - UDP/IPv4: host to guest───────────────────────────────────────────────────────────── host$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP4:127.0.0.1:10001 │NDP/DHCPv6: host$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP4:127.0.0.1:10002 │ assign: 2a01:4f8:222:904::2 host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │ router: fe80::1 host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │ our link-local: fe80::1 host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │DNS: host$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP4:127.0.0.1:10001 │ 2a01:4ff:ff00::add:2 host$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP4:127.0.0.1:10002 │ 2a01:4ff:ff00::add:1 host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │You can start qemu with: host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │ kvm ... -chardev socket,id=chr0,path=/tmp/passt-tests-KLvyGO/passt_in_ns/passt.socket -netdev vhost-user,id=netdev0,chardev=chr0 -d host$ socat -u TCP4-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │evice virtio-net,netdev=netdev0 -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE -numa node,memdev=memfd0 host$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP6:[::1]:10001 │ host$ socat -u OPEN:/home/sbrivio/passt/test/big.bin TCP6:[::1]:10002 │accepted connection from PID 4848 host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │==4846== Warning: set address range perms: large range [0x59c8f000, 0x119c8f000) (defined) host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │==4846== Warning: set address range perms: large range [0x119c8f000, 0x519c8f000) (defined) host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_big.bin,create,trunc │NDP: received RS, sending RA host$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[::1]:10001 │DHCP: offer to discover host$ socat -u OPEN:/home/sbrivio/passt/test/small.bin TCP6:[::1]:10002 │ from 52:54:00:12:34:56 host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │DHCP: ack to request host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │ from 52:54:00:12:34:56 host$ socat -u TCP6-LISTEN:10003 OPEN:/tmp/passt-tests-KLvyGO/passt_vu_in_ns/tcp/test_small.bin,create,trunc │DHCPv6: received SOLICIT, sending ADVERTISE host$ which socat ip jq >/dev/null │DHCPv6: received REQUEST/RENEW/CONFIRM, sending REPLY host$ socat -u OPEN:/home/sbrivio/passt/test/medium.bin UDP4:127.0.0.1:10001,shut-null │NDP: received NS, sending NA host$ │ ──host──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──passt in pasta (namespace)─────────────────────────────────────────────────────────────────────────────────────────────────────────── Testing commit: 529d9fd test: Add tests for passt in vhost-user mode PASS: 192 | FAIL: 0 | 2024-10-09T12:39:37+00:00 ...that is, in passt_vu_in_ns/udp, on the basic "UDP/IPv4: host to guest" test, the client is already done, but the server gets nothing. It doesn't look like a race condition in the test itself, because if I re-run the client manually the server is still stuck, but I didn't really investigate, yet. The server is just waiting for data: $ ssh -F /tmp/passt-tests-KLvyGO/passt_in_ns/context_guest.ssh guest sh cd /proc cat 562/cmdline socat-uUDP6-LISTEN:10001,null-eofOPEN:test.bin,create,trunc strace -p 562 strace: Process 562 attached pselect6(6, [5], [], [], NULL, NULL -- Stefano