Virtio On Xen: Difference between revisions

From Xen
Jump to navigationJump to search
(Created page with "<!-- MoinMoin name: VirtioOnXen --> <!-- Comment: --> <!-- WikiMedia name: VirtioOnXen --> <!-- Page revision: 00000010 --> <!-- Original date: Wed Aug 31 05:03:59 201…")
 
No edit summary
Line 7: Line 7:
__NOTOC__
__NOTOC__
= Virtio on Xen =
= Virtio on Xen =
The Virtio on Xen project is a project for Google Summer of Code 2011. It's still working in progress. But fortunately, we have a working prototype. This page is intended to guide people who might be interested in giving it a try.
The Virtio on Xen .project is a project for Google Summer of Code 2011. It's still working in progress. But fortunately, we have a working prototype. This page is intended to guide people who might be interested in giving it a try.


'''Note''':
'''Note''':
Line 16: Line 16:
In fact, there is nothing much to do.
In fact, there is nothing much to do.


* With this [[Media:VirtioOnXen$libxl-virtio-support.patch|patch]], we can enable libxl to support configuration for Virtio disk and nic.
* With this [http://downloads.xen.org/Wiki/VirtioOnXen/libxl-virtio-support.patch patch], we can enable libxl to support configuration for Virtio disk and nic.
** For disk configuration syntax, use 'vd*' as virtual identifier, see docs/misc/vbd-interface.txt for details.
** For disk configuration syntax, use 'vd*' as virtual identifier, see docs/misc/vbd-interface.txt for details.
** For nic configuration syntax, use 'model=virtio' in vif configuration. Latest QEMU may require 'model=virtio-net'. Just choose the one that works.
** For nic configuration syntax, use 'model=virtio' in vif configuration. Latest QEMU may require 'model=virtio-net'. Just choose the one that works.
Line 29: Line 29:


* QEMU
* QEMU
** [[Media:VirtioOnXen$qemu-01-xenpv-exec.patch|qemu-01-xenpv-exec.patch]]
** [http://downloads.xen.org/Wiki/VirtioOnXen/qemu-01-xenpv-exec.patch qemu-01-xenpv-exec.patch]
** [[Media:VirtioOnXen$qemu-02-virtio-for-pv.patch|qemu-02-virtio-for-pv.patch]]
** [http://downloads.xen.org/Wiki/VirtioOnXen/qemu-02-virtio-for-pv.patch qemu-02-virtio-for-pv.patch]
* Linux kernel
* Linux kernel
** [[Media:VirtioOnXen$linux-01-virtio-xenbus.patch|linux-01-virtio-xenbus.patch]]
** [http://downloads.xen.org/Wiki/VirtioOnXen/linux-01-virtio-xenbus.patch linux-01-virtio-xenbus.patch]
** [[Media:VirtioOnXen$linux-02-virtio-ring.patch|linux-02-virtio-ring.patch]]. '''N.B''' This patch breaks existing virtio ring implementation, so please compile it out of tree and load it manually.
** [http://downloads.xen.org/Wiki/VirtioOnXen/linux-02-virtio-ring.patch linux-02-virtio-ring.patch]. '''N.B''' This patch breaks existing virtio ring implementation, so please compile it out of tree and load it manually.
* VM config file
* VM config file
** Make sure you add device_model_args_pv=['-net', 'tap,vlan=0,script=no'] to make QEMU add a tap for you, or you won't be able to send packets via Virtio net.
** Make sure you add device_model_args_pv=['-net', 'tap,vlan=0,script=no'] to make QEMU add a tap for you, or you won't be able to send packets via Virtio net.

Revision as of 22:48, 1 December 2011


Virtio on Xen

The Virtio on Xen .project is a project for Google Summer of Code 2011. It's still working in progress. But fortunately, we have a working prototype. This page is intended to guide people who might be interested in giving it a try.

Note:

Virtio for HVM guest

In fact, there is nothing much to do.

  • With this patch, we can enable libxl to support configuration for Virtio disk and nic.
    • For disk configuration syntax, use 'vd*' as virtual identifier, see docs/misc/vbd-interface.txt for details.
    • For nic configuration syntax, use 'model=virtio' in vif configuration. Latest QEMU may require 'model=virtio-net'. Just choose the one that works.
  • Disable MSI in guest kernel, with 'pci=nomsi' option in guest kernel command line. Currently, MSI delivery is not supported by HVM guest (though Xen has one HVMOP to do this, QEMU is not yet ready for this).
  • Also you might want to add 'xen_emul_unplug=never' in the guest kernel command line.

Use 'xl' to start the guest, not 'xm'.

Virtio for PV guest

First of all, you need the patch in the previous section to enable libxl to support configuration syntax for Virtio disk and nic.

Then apply the following patches to upstream QEMU and Linux kernel.

Run 'xl' to startup VM, 'xm' doesn't understand virtio configuration. After the VM is up, load modified virtio_ring.ko and all the other modules manually in the following order:

  1. virtio.ko
  2. virtio_ring.ko
  3. virtio_net.ko
  4. virtio_blk.ko
  5. virtio_xenbus.ko

Hopefully you will get Virtio devices without much trouble.

TODO

  • Enable xen-mapcache for Virtio for PV, improve performance.
  • Squash two evtchns into one, hopefully we can eliminate locking in transport layer and improve performance.
  • Enable Virtio device DMA capability
  • Bug fixes, transport layer crashes sometimes under heavy workload.

Related References

For those who encounter problems, please contact Wei Liu <liuw AT liuw SPAMFREE dot name> [{Category:Project]]