Virtio Virtqueues and vhost-net
Definition
Virtio standardizes interfaces for paravirtualized devices. A guest frontend cooperates with a host backend rather than requiring full emulation of a physical device’s behavior.
The lecture gives examples including network, block, serial, and balloon drivers. The guest interface can remain consistent while backend implementations differ.
Virtqueues and scatter-gather buffers
A virtqueue communicates buffers between the guest and backend. Buffers can reference several separate memory regions through scatter-gather descriptors; their meaning depends on the device.
The lecture’s network model uses TX and RX queues with an optional control queue. The control queue handles features such as promiscuous mode and checksum settings. The guest/backend exchange notifications when work or completion needs attention.
Study intuition: a packet can be represented by references to its pieces rather than first placing all data into one contiguous buffer. The writev example on page 94 illustrates vectored I/O with an array of iovec entries; it does not itself implement a virtqueue.
QEMU backend versus vhost-net
QEMU data path: guest Virtio -> QEMU userspace -> host kernel / TAP
vhost-net path: guest Virtio -> host kernel vhost-net -> TAPvhost-net moves the packet data path into the kernel, reducing userspace handling. QEMU remains responsible for setup, control, and feature negotiation. The guest still sees a Virtio device.
TX and RX notifications in the slides
- TX: the guest queues buffers and kicks the backend. KVM’s
ioeventfdconnects the relevant I/O notification to an eventfd watched by the backend. - RX: the worker receives a packet from TAP, fills the guest’s receive buffers, and notifies the guest through an interrupt path supported by
irqfd. - The deck describes an event-driven worker per virtual NIC; this is its illustrated implementation model, not an exhaustive version-independent threading rule.
Important rules
- Virtio defines the guest-facing protocol; vhost-net is a host implementation for network processing.
- Moving the data path does not eliminate the management/control path.
- A PV driver can coexist with hardware-assisted CPU virtualization.
- The reported 2-3× network performance advantage and displayed PCI IDs belong to the lecture’s examples, not a current universal benchmark or complete device catalog.
Common mistakes
- Assuming vhost-net removes QEMU entirely.
- Confusing
ioeventfdnotifications toward the backend withirqfdinterrupt delivery toward the guest. - Treating scatter-gather as a guarantee that all copying disappears.
Related: I-O Virtualization - Emulation PV and Passthrough, Paravirtualization and Hypercalls, QEMU and KVM, Memory Ballooning.
Source
Lecture 03 PDF pages 91-100 (printed slides 97-106). Context: Lecture 03 - Computing Virtualization Technologies and Tools. Simplified paths, intuition, and cautions are study explanations.