qemu-ntb¶
A virtual PCIe NTB (Non-Transparent Bridge) for QEMU. Two VMs get what two hosts get from an NTB adapter: memory windows into each other's RAM, doorbells, scratchpads and a DMA engine. The Linux NTB stack runs on it unmodified.
docker run --rm -it --device /dev/kvm ghcr.io/oguzhankynk/qemu-ntb
Two VMs open side by side, with an IP network over the virtual NTB. No build needed; getting started has the other ways in.
flowchart LR
subgraph A["VM A"]
direction TB
a1["ntb_transport, ntb_netdev, ..."] --- a2["ntb_hw_qntb"] --- a3["qntb (PCI device)"]
end
subgraph B["VM B"]
direction TB
b1["ntb_transport, ntb_netdev, ..."] --- b2["ntb_hw_qntb"] --- b3["qntb (PCI device)"]
end
a3 <-->|UNIX socket| b3
Why¶
NTB hardware is rare and hard to share. Without it you cannot run the Linux NTB clients, test a driver, or try a transport between two hosts. With qemu-ntb you can do all of that on a laptop, in CI, and with the kernel's bug detectors switched on.
What works¶
| Linux client | Result |
|---|---|
ntb_tool |
all operations |
ntb_pingpong |
works |
ntb_transport + ntb_netdev |
ping and bulk transfers, with and without DMA |
ntb_perf |
CPU and DMA paths |
ntb_msi |
interrupts forwarded through a memory window |
tools/testing/selftests/ntb/ntb_test.sh |
passes |
Two implementations¶
| QEMU device | ntbd |
|
|---|---|---|
| What | A PCI device built into QEMU (-device qntb) |
A vfio-user server for stock QEMU |
| QEMU | 11.1.3 with a two-line build patch | stock QEMU with the vfio-user client (tested: 11.1.3) |
MSI forwarding (ntb_msi) |
yes | no |
| CPU access to the peer through a window | mapped directly (KVM, shared RAM) | one message per access |
| Live migration | blocked, as it should be | not blocked (QEMU bug) |
Both follow the same specification and pass the same tests. Use the QEMU device unless you cannot rebuild QEMU.
Next steps¶
- Getting started: build and bring up a link
- The QEMU device: how to configure it
- Performance: what to expect from each path
- ntb-lab: a tutorial with two VMs, and shared memory, doorbells and DMA from user space
- Specification: registers, interrupts and DMA as the guest sees them