Chapter 11. KVM Para-virtualized Drivers
Para-virtualized drivers are available for virtualized Windows guests running on KVM hosts. These para-virtualized drivers are included in the virtio package. The virtio package supports block (storage) devices and network interface controllers.
Para-virtualized drivers enhance the performance of fully virtualized guests. With the para-virtualized drivers guest I/O latency decreases and throughput increases to near bare-metal levels. It is recommended to use the para-virtualized drivers for fully virtualized guests running I/O heavy tasks and applications.
The KVM para-virtualized drivers are automatically loaded and installed on the following:
Versions of Red Hat Enterprise Linux in the list above detect and install the drivers, additional installation steps are not required.
The following Microsoft Windows versions are expected to function normally using KVM para-virtualized drivers:
11.1. Using the para-virtualized drivers with Red Hat Enterprise Linux 3.9 guests
Para-virtualized drivers for Red Hat Enterprise Linux 3.9 consist of five kernel modules: virtio
, virtio_blk
, virtio_net
, virtio_pci
and virtio_ring
. All five modules must be loaded to use both the para-virtualized block and network devices drivers.
To use the network device driver only, load the virtio
, virtio_net
and virtio_pci
modules. To use the block device driver only, load the virtio
, virtio_ring
, virtio_blk
and virtio_pci
modules.
The
virtio package modifies the initrd RAM disk file in the
/boot
directory. The original initrd file is saved to
/boot/initrd-
kernel-version
.img.virtio.orig
. The original initrd file is replaced with a new initrd RAM disk containing the
virtio
driver modules. The initrd RAM disk is modified to allow the guest to boot from a storage device using the para-virtualized drivers. To use a different initrd file, you must ensure that drivers are loaded with the
sysinit
script (
Loading the para-virtualized drivers with the sysinit script) or when creating new initrd RAM disk (
Adding the para-virtualized drivers to the initrd RAM disk).
This procedure covers loading the para-virtualized driver modules during the boot sequence on a Red Hat Enterprise Linux 3.9 or newer guest with the sysinit
script. Note that the guest cannot use the para-virtualized drivers for the default boot disk if the modules are loaded with the sysinit
script.
The drivers must be loaded in the following order:
-
virtio
-
virtio_ring
-
virtio_blk
-
virtio_net
-
virtio_pci
Only order of virtio_net
and virtio_blk
can be change. If the drivers are loaded in a different order, drivers will not work.
Configure the modules to . Locate the following section of the /etc/rc.d/rc.sysinit
file.
if [ -f /etc/rc.modules ]; then
/etc/rc.modules
fi
Append the following lines after that section:
if [ -f /etc/rc.modules ]; then
/etc/rc.modules
fi
modprobe virtio
modprobe virtio_ring # Comment this out if you do not need block driver
modprobe virtio_blk # Comment this out if you do not need block driver
modprobe virtio_net # Comment this out if you do not need net driver
modprobe virtio_pci
Reboot the guest to load the kernel modules.
This procedure covers loading the para-virtualized driver modules with the kernel on a Red Hat Enterprise Linux 3.9 or newer guest by including the modules in the initrd RAM disk. The mkinitrd tool configures the initrd RAM disk to load the the modules. Specify the additional modules with the --with
parameter for the mkinitrd
command. Append following set of parameters, in the exact order, when using the mkinitrd
command to create a custom initrd RAM disk:
--with virtio --with virtio_ring --with virtio_blk --with virtio_net --with virtio_pci
Use the x86_64
version of the virtio package for AMD64 systems.
Use the ia32e
version of the virtio package for Intel 64 systems. Using the x86_64
version of the virtio may cause a 'Unresolved symbol
' error during the boot sequence on Intel 64 systems.
If you experience low performance with the para-virtualized network drivers, verify the setting for the GSO and TSO features on the host system. The para-virtualized network drivers require that the GSO and TSO options are disabled for optimal performance.
Verify the status of the GSO and TSO settings, use the command on the host (replacing interface
with the network interface used by the guest):
# ethtool -k interface
Disable the GSO and TSO options with the following commands on the host:
# ethtool -K interface
gso off
# ethtool -K interface
tso off
After activating the para-virtualized block device driver the swap partition may not be available. This issue is may be caused by a change in disk device name. To fix this issue, open the /etc/fstab
file and locate the lines containing swap partitions, for example:
/dev/hda3 swap swap defaults 0 0
The para-virtualized drivers use the /dev/vd*
naming convention, not the /dev/hd*
naming convention. To resolve this issue modify the incorrect swap entries in the /etc/fstab
file to use the /dev/vd*
convention, for the example above:
/dev/vda3 swap swap defaults 0 0
Save the changes and reboot the virtualized guest. The guest should now correctly have swap partitions.