Add vhost-user path and borrowed-FD constructors to NetDevice for Linux NET builds with a local MAC and one RX/TX queue pair. Reuse the vhost-user frontend and request shared guest RAM and kernel mappings through device requirements while preserving device ordering.
Filter network features, gate CONFIG and MQ requests on negotiated protocol support, and pass eventfds without transferring ownership. Include API/protocol tests, passt TCP/UDP integration tests, iperf test entries, generated bindings and usage documentation. Reject TEE and Nitro configurations.
Assisted-by: Codex: GPT-6
The idea was when I realized both passt socket and TSI are suffering from some strange performance issue, and a test with qemu showed significant better network performance so I wanted to try the same for libkrun.
performance test (unit in Gbps):
- 7.2.7-300.fc45.x86_64 host kernel
- 13700H CPU
- 1 vCPU, 512 MiB RAM, one TCP stream per direction, 2-second warmup followed by 10 seconds of measurement,
- TX/RX are from the guest's perspective
| Backend | TX only | RX only | Bidir TX | Bidir RX | Bidir total |
|---|---|---|---|---|---|
| passt vhost-user | 23.49 | 79.30 | 18.48 | 39.42 | 57.91 |
| passt socket | 23.59 | 14.36 | 0.00* | 12.23 | 12.23 |
| TSI | 29.48 | Timeout* | 17.18 | 17.60 | 34.81 |
(note that when running bidir mode original options, incl. passt socket and TSI both have problem in sending)
Opening as draft RFC.
Activity
7Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Copilot review overview
🔵 Needs a closer look
CI enables passt tests without installing a passt build with vhost-user support, so the tests may be silently skipped.
Review effort: Lite
Findings: None
So the vhost-user-net passt is already supported without doing any changes to the builtin virtio-net backend you can just use the builtin vhost device. We may make it more user friendly but I would rather add a simplified constructor to VhostDevice rather than changing the net device.
I have a draft opened for adding the test: https://github.com/libkrun/libkrun/pull/784 but the feature already works on main branch.
Copilot review overview
🔵 Needs a closer look
Broad, platform-specific vhost-user networking and memory changes require final human review.
Review effort: Lite
Findings: None
What changed in this PR
Adds Linux
passtvhost-user networking with shared guest memory, borrowed-FD/path APIs, protocol negotiation, tests, and documentation.Changes:
tests/test_cases/src/test_net/passt_vhost_user.rstests/test_cases/src/test_net/mod.rstests/test_cases/src/test_net_perf.rstests/test_cases/src/lib.rstests/test_cases/src/common.rstests/Cargo.locksrc/libkrun/src/vmm/builder.rssrc/libkrun/src/api/device_builders.rssrc/devices/src/virtio/vhost_user/device.rssrc/devices/src/virtio/mod.rssrc/devices/Cargo.tomlREADME.mdinclude/libkrun.hCargo.lockbindings/libkrun-via-cdylib-weak/ffier-krun.json💡 Add a
code-reviewagent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.