KVM can provide emulated or para-virtualized devices to the guest operating systems. Compared to
emulated devices, para-virtualized devices provide lower latency and higher throughput for I/O
operations of guest operating systems. KVM includes the VirtIO API to para-virtualize devices.
With all virtualization technologies, the hypervisor must provide the guest operating systems with
devices that the guest operating systems require to successfully run. In the simplest case, these devices
provide storage and network access. In more complicated cases, additional devices provide new functions
that use the virtualization base on which the guest operating systems run.
Typically, the hypervisor provides emulated or para-virtualized devices to the guest operating systems.
Emulated devices
Emulated devices are the most common virtualized devices. Emulated devices are a core component of
full virtualization solutions such as VMware.
When a hypervisor provides a guest operating system with an emulated device, the hypervisor creates a
software implementation of the hardware. In KVM, a modified version of QEMU in user space provides
device emulation. The hypervisor intercepts all I/O requests from the guest operating system and
emulates the operation of the real I/O hardware. The guest operating system that uses the device
interacts with the device as if it were actual hardware rather than software.
The hardware device that is emulated is usually an older, generic device that supports various drivers
across various operating systems. This broad support is the core strength of device emulation. It provides
the ability for guest operating systems to run and use emulated devices with no special drivers and with
no modification to the operating system.
While emulated solutions provide a broader compatibility level than para-virtualized solutions, the
performance of emulated solutions is lower than para-virtualized solutions.
Red Hat Enterprise Linux provides several emulated devices that support the following functions:
v Block I/O: emulated devices include IDE, Floppy, SCSI, and USB
v Networking: emulated devices include e1000, ne2k_pci, pcnet, and rtl8139
v Graphics
v Mouse input
v Serial port
v Sound cards
© Copyright IBM Corp. 2010, 2010 1
Emulated devices that support graphics, mouse input, serial port, and sound cards are meant for the
enablement of guest operating systems. These devices are not currently targeted for para-virtualized
performance improvements.
Para-virtualized devices
Para-virtualized devices are software implementations of hardware devices. You can install a
para-virtualized driver in the guest operating system. With para-virtualized devices, the hypervisor and
the guest operating system use an optimized I/O interface to communicate as quickly and efficiently as
possible.
Unlike emulation, para-virtualization requires that the guest operating system be modified to
communicate with the hypervisor. In some solutions, such as Xen, the entire guest operating system is
para-virtualized for an efficient, cooperative relationship with the hypervisor. In other solutions, such as
VMware and KVM, only the device drivers are para-virtualized.
While para-virtualized solutions typically outperform emulated solutions, the compatibility level of
para-virtualized solutions is lower than emulated solutions. The reason that para-virtualized solutions
typically outperform emulated solutions is because emulated devices must adhere to the same
requirements as the real hardware they emulate. This adherence is critical because if the emulated device
does not behave like the hardware, the device drivers in the guest operating system might not work as
intended. However, this adherence is not necessarily efficient when two pieces of software, the hypervisor
and guest operating system, must communicate. Para-virtualized devices are not burdened with this
adherence requirement. Instead, para-virtualized solutions use an API that provides high performance for
I/O operations of guest operating systems.
In addition to latency and bandwidth gains, para-virtualized devices require fewer processor resources
than emulated devices. Sometimes emulation code cannot be implemented efficiently. One possible reason
is the lack of specialized hardware assistance. This inefficient code causes high processor load when a
device is heavily used. Lower processor use is often an additional benefit of para-virtualized devices
because of the optimized nature of para-virtualized devices.
VirtIO API
The VirtIO API is a high performance API that para-virtualized devices use to gain speed and efficiency.
The VirtIO API specifies an interface between virtual machines and hypervisors that is independent of the
hypervisor. In typical situations, VirtIO para-virtualized devices provide lower latency and higher
throughput for I/O operations of guest operating systems. VirtIO para-virtualized devices are especially
useful for guest operating systems that run I/O heavy tasks and applications.
Tip: Always use devices that implement the VirtIO API if the devices are available and supported for the
guest operating system.
For a compatibility list of guest operating systems and VirtIO devices on Red Hat Enterprise Linux 5.5,
see KVM Para-virtualized Drivers.
2 Kernel Virtual Machine (KVM): Best practices for KVM
Related concepts
“Best practice: Optimize performance by using the virtio_blk and virtio_net drivers”
The virtio_blk driver uses the VirtIO API to provide high performance for storage I/O devices,
especially in large enterprise storage systems. The virtio_net driver uses the VirtIO API to provide
increased network performance.
“Best practice: Virtualize memory resources by using the virtio_balloon driver” on page 5
The virtio_balloon driver provides a communication pathway between the hypervisor and the guest
operating system. The hypervisor uses this communication pathway to over-commit memory resources.
Related tasks