qemu: use stream netdev with reconnect for socketVMNet networking#5027
qemu: use stream netdev with reconnect for socketVMNet networking#5027loncharles wants to merge 1 commit into
Conversation
9c8efcc to
e332301
Compare
e332301 to
42132e8
Compare
|
@unsuman @AkihiroSuda can I get a review? This provides socket vmnet reconnectivity where none existed before with the added benefit that it is 2x more performant for the same cpu usage and latency for free. Version aware with fallbacks.. I have a more involved, but related, fix for #3020 on VZ but want to make sure the effort isn't wasted. Thanks |
|
@AkihiroSuda, the VMNet and VZ tests fail identically on master (runs 26462579743 and 26384725917, same curl: (52) Empty reply from server). The failure looks pre-existing and unrelated to this change. |
|
vz is known to fail, vmnet is not |
|
It's the exact same issue, friend. VMNet tests (QEMU) passed on every master run up to and including 6d0fdd1 (May 22). It first failed on cfb9f31, the nerdctl 2.3.1 merge (PR #5024), and has failed on every master run since. Same commit that #5030 tracks for the VZ failure. Both tests show the same curl: (52) Empty reply from server symptom from the same containerd ttrpc regression you already bisected in #5049. VZ VMNet |
|
Could you try rebasing with the current master? |
Use -netdev stream instead of legacy -netdev socket for socketVMNet networking on macOS Intel (QEMU backend), with version-appropriate reconnect. Applies to all socketVMNet modes (bridged, shared, host). QEMU >= 9.2: stream with reconnect-ms=500 QEMU 8.0-9.1: stream with reconnect=1 (seconds granularity) QEMU 7.2-7.9: stream without reconnect QEMU < 7.2: fall back to socket (no stream support) The stream backend connects directly to the socket_vmnet UNIX socket, eliminating the pre-dialed fd approach. When reconnect is available, QEMU automatically re-establishes the connection after link failures, recovering VM networking without manual restart. In testing, stream netdev showed ~2x throughput improvement over legacy socket netdev (~1.84 Gbits/sec vs ~970 Mbits/sec). Feature-detected via -netdev help output; version checked for the reconnect parameter which was renamed from reconnect (8.0) to reconnect-ms (9.2) and the old form removed in 10.2. Signed-off-by: Lon C. Lundgren <lon@ocelot.net>
42132e8 to
eb4f0f0
Compare
Summary
Switch QEMU socketVMNet networking on macOS from legacy
-netdev socketwith a pre-dialed fd to-netdev streamwith built-in reconnect support. Applies to all socketVMNet modes (bridged, shared, host).-netdev helpoutput forstreamsupport; falls back tosocketif unavailablereconnect-ms=500for QEMU >= 9.2,reconnect=1for QEMU 8.0–9.1 (thereconnectparameter was renamed toreconnect-msin 9.2 and the old form removed in 10.2), no reconnect for QEMU 7.2–7.9streamandsocketnetdev use the same 4-byte big-endian length-prefixed Ethernet frame protocol that socket_vmnet usesMotivation
When the socket_vmnet daemon restarts or the UNIX socket connection breaks, the legacy
-netdev socketwith a pre-dialed fd has no way to recover — the fd is dead and the VM's network is permanently broken until manual VM restart.The
streamnetdev connects directly to the socket_vmnet UNIX socket and can automatically reconnect, recovering VM networking without restart.Performance
In testing on macOS Intel (QEMU 11.0.0, HVF, socket_vmnet bridged to a 5GbE NIC), the stream netdev showed ~2x throughput improvement over legacy socket netdev:
Host-to-host baseline on the same NIC is 4.66 Gbits/sec; the remaining gap is in the socket_vmnet relay path.
Compatibility
socketnetdev)streamnetdev (available since 7.2)reconnect-ms(millisecond granularity, 500ms)runtime.GOOS == "darwin")Test plan