Xen Linux PV on HVM drivers

From Xen
Revision as of 19:04, 8 November 2011 by Lars.kurth (talk | contribs) (Migrated)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Xen PVHVM drivers for Linux HVM guests

This page lists some resources about using optimized paravirtualized PVHVM drivers (also called PV-on-HVM drivers) with Xen fully virtualized HVM guests running (unmodified) Linux kernels. Xen PVHVM drivers completely bypass the Qemu emulation and provide much faster disk- and network IO performance.

Note that Xen PV (paravirtual) guests automatically use PV drivers, so there's no need for these drivers if you use PV domUs! (you're already automatically using the optimized drivers). These PVHVM drivers are only required for Xen HVM (fully virtualized) guest VMs.

Xen PVHVM Linux driver sources:

  • Easy-to-use "old unmodified_drivers" PV-on-HVM drivers patch for Linux 2.6.32 (Ubuntu 10.04 and other distros): http://lists.xensource.com/archives/html/xen-devel/2010-05/msg00392.html
  • Xen source tree contains "unmodified_drivers" directory, which has the "old" PV-on-HVM drivers. These drivers build easily with Linux 2.6.18 and 2.6.27, but require some hackery to get them build with 2.6.3x kernels (see below for help).
  • Jeremy's pvops kernel in xen.git (branch: xen/stable-2.6.32.x) contains the new PVHVM drivers. These drivers have been submitted for inclusion in upstream Linux kernel. See XenParavirtOps wiki page for more information about pvops kernels.
  • Upstream vanilla kernel.org Linux 2.6.36 kernel and later versions contain Xen PVHVM drivers out-of-the-box!

New Xen PVHVM drivers in upstream Linux kernel

Xen developers rewrote the Xen PVHVM drivers in 2010 and submitted them for inclusion in upstream Linux kernel. Xen PVHVM drivers were merged to upstream kernel.org Linux 2.6.36, and various optimizations were added in Linux 2.6.37. Today upstream Linux kernels automatically and out-of-the-box include Xen PVHVM drivers.

List of email threads and links to git branches related to the new Xen PV-on-HVM drivers for Linux:

These new Xen PVHVM drivers are also included in Jeremy's pvops kernel xen.git, in branch "xen/stable-2.6.32.x" . See XenParavirtOps wiki page for more information.

There's also a backport of the Linux 2.6.36+ Xen PVHVM drivers to Linux 2.6.32 kernel, see these links for more information:

Enable or disable Xen PVHVM drivers

In the configuration file for the Xen HVM VM ("/etc/xen/<vm>") you can control the availability of Xen Platform PCI device. Xen PVHVM drivers require that virtual PCI device to initialize and operate.

To enable Xen PVHVM drivers for the guest VM:

xen_platform_pci=1


To disable Xen PVHVM drivers for the guest VM:

xen_platform_pci=0


"xen_platform_pci" setting is available in Xen 4.x versions. It is NOT available in the stock RHEL5/CentOS5 Xen or in Xen 3.x.

Linux kernel commandline boot options for controlling Xen PVHVM drivers unplug behaviour

When using the optimized Xen PVHVM drivers with fully virtualized Linux VM there are some kernel options you can use to control the "unplug" behaviour of the Qemu emulated IDE disk and network devices. When using the optimized devices the Qemu emulated devices need to be "unplugged" in the beginning of the Linux VM boot process so there's no risk for data corruption because both the Qemu emulated device and PVHVM device being active at the same time (both provided by the same backend).

TODO: List the kernel cmdline options here.

Tips about how to build the old "unmodified_drivers" with different Linux versions

Some Linux distributions also ship Xen PVHVM drivers as binary packages

  • RHEL5 / CentOS 5
  • RHEL6
  • SLES 10
  • SLES 11
  • OpenSUSE

You might also want to check out the XenKernelFeatures wiki page.

Verifying Xen Linux PVHVM drivers are using optimizations

If you're Using at least Xen 4.0.1 hypervisor and the new upstream Linux PVHVM drivers available in Linux 2.6.36 and later versions, follow these steps:

  • Make sure you're using the PVHVM drivers.
  • Add "loglevel=9" parameter for the HVM guest Linux kernel cmdline in grub.conf.
  • Reboot the guest VM.
  • Check "dmesg" for the following text: "Xen HVM callback vector for event delivery is enabled".

Some distro kernels, or a custom kernel from xen/stable-2.6.32.x git branch might have these optimizations available aswell.