Xen Linux PV on HVM drivers: Difference between revisions
Lars.kurth (talk | contribs) m (moved XenLinuxPVonHVMdrivers to Xen Linux PV on HVM drivers) |
No edit summary |
||
Line 36: | Line 36: | ||
* http://lists.xensource.com/archives/html/xen-devel/2010-10/msg00017.html |
* http://lists.xensource.com/archives/html/xen-devel/2010-10/msg00017.html |
||
* and the git branch: http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.32-pvhvm . |
* and the git branch: http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.32-pvhvm . |
||
== Xen PVHVM drivers configuration example == |
|||
In dom0 in the "/etc/xen/<vm>" configuration file use the following syntax: |
|||
<pre> |
|||
vif = [ 'mac=00:16:5e:02:07:45, bridge=xenbr0, model=e1000' ] |
|||
disk = [ 'phy:/dev/vg01/vm01-disk0,hda,w', ',hdc:cdrom,r' ] |
|||
xen_platform_pci=1 |
|||
</pre> |
|||
With this example configuration when "xen_platform_pci" is enabled ("1"), the guest VM can use optimized PVHVM drivers: xen-blkfront for disk, and xen-netfront for network. When "xen_platform_pci" is disabled ("0"), the guest VM will use Xen Qemu-dm emulated devices: emulated IDE disk and emulated intel e1000 nic. |
|||
NOTE! If you have "type=ioemu" specified for the "vif"-line, PVHVM drivers WILL NOT work! Don't specify "type" parameter for the vif. (with type=ioemu the pvhvm nic in the VM will have mac address full of zeroes - and thus won't work!). |
|||
== Enable or disable Xen PVHVM drivers == |
== Enable or disable Xen PVHVM drivers == |
Revision as of 16:59, 29 January 2012
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:
- http://lists.xensource.com/archives/html/xen-devel/2010-06/msg01215.html
- http://lists.xensource.com/archives/html/xen-devel/2010-08/msg00271.html
- http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git
- http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.35-rc5-pvhvm-v6
- http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.35-rc5-pvhvm-v7
- http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.36-rc6-pvhvm-v8
- http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/stefano/2.6.32-pvhvm
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:
- http://lists.xensource.com/archives/html/xen-devel/2010-10/msg00017.html
- and the git branch: http://xenbits.xen.org/gitweb?p=people/sstabellini/linux-pvhvm.git;a=shortlog;h=refs/heads/2.6.32-pvhvm .
Xen PVHVM drivers configuration example
In dom0 in the "/etc/xen/<vm>" configuration file use the following syntax:
vif = [ 'mac=00:16:5e:02:07:45, bridge=xenbr0, model=e1000' ] disk = [ 'phy:/dev/vg01/vm01-disk0,hda,w', ',hdc:cdrom,r' ] xen_platform_pci=1
With this example configuration when "xen_platform_pci" is enabled ("1"), the guest VM can use optimized PVHVM drivers: xen-blkfront for disk, and xen-netfront for network. When "xen_platform_pci" is disabled ("0"), the guest VM will use Xen Qemu-dm emulated devices: emulated IDE disk and emulated intel e1000 nic.
NOTE! If you have "type=ioemu" specified for the "vif"-line, PVHVM drivers WILL NOT work! Don't specify "type" parameter for the vif. (with type=ioemu the pvhvm nic in the VM will have mac address full of zeroes - and thus won't work!).
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
- With Linux 2.6.32: http://lists.xensource.com/archives/html/xen-devel/2010-04/msg00502.html
- With Linux 2.6.27: http://wp.colliertech.org/cj/?p=653
- With arbitrary kernel version (custom patch): http://blog.alex.org.uk/2010/05/09/linux-pv-drivers-for-xen-hvm-building-normally-within-an-arbitrary-kernel-tree/
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.