2012年9月27日 星期四

Xen Paravirtualization

This article is based on “Xen and the Art of Virtualization,” from SOSP'03. It's the first paper for paravirtualization.

Virtual Machine Interface

CPU Privilege Level

There are four privilege level in x86 architecture, but most of OSes use only two privilege level. Therefore we can modify OSes to run in ring 1 and preserve ring 0 for Xen hypervisor.  So that privilege instruction will trap to hypervisor for updating and validating.

Exception

Guest OSes can register exception handler table to Xen Hypervisor . If the handler's code segment is not run in ring 0,  Xen create a copy of exception stack frame on guest OS then transfer control to appropriate handler.
Due to observe that system call is one of most frequently happened exception, improving system call's performance can largely effect overall system.To improve system call performance, Xen can check if any code segment of handler is in ring 0 when guest register exception handler. If there are no code segment in ring 0, guest OSes can directly execute the system call handler.

Memory Management

There are two TLB mechanism apply to Xen, that is software-managed TLB and tagged TLB. With  software-managed TLB , Xen can manage TLB directly. Tagged TLB associate each TLB entry with an address-specific identifier so that hypervisor and each guest can maintain their TLB in the same time.
There two principal in Xen's memory management. First , guest is response for allocating hardware page table. Second, Xen located in first 64 MB of every address space.

Device I/O

Different to other full virtualization system, which emulate each device I/O, Xen use an device abstract for device. Every device I/O will be transfer from it's domain to hypervisor by a shared-memory, asynchronous buffer- descriptor rings. In additional, Xen use event-delivery mechanism send back notification to each domain.

Mechanism Design

Control Transfer

Hypercall

To perform privilege instruction, domain U will trigger a software trap and send a hypercal to make Xen perform corresponding action.   

2012年9月19日 星期三

XEN Basic

Xen Virtualization Introduction

Virtualization is one of most important technique in nowaday computer system.With virtualization mechanism , services such as cloud computing, application mobility and co-location facility can be implement.

Xen is the virtual machine monitor that first proposed in SOSP'03 by University of Cambridge. Xen is aim to provide high performance resource management. In the other hand , Xen hypervisor must isolate each virtual machine from others.Finally Xen must support wide range of  heterogeneity operating system.

http://www.cl.cam.ac.uk/research/srg/netos/papers/2003-xensosp.pdf

Virtualization type

In 2003 , Xen was first proposed with paravirtualization architecture. Just after Intel proposed VT-x in 2005 , Xen release version 3.04 which support hvm client.  Figure 1 show both two type's architecture. 
Figure 1 : Xen Architecture

Paravirtualization 

Compare to full virtualization used by VMware's ESX server which not need to modify guest OSes, Xen employ paravirtualization that need to make some minor change to guest OSes. After modification, Xen can offer the same abstraction between virtual machine and underlying hardware ,so that performance can be improved.   

Hardware-assisted Virtualization

After VT-x published, consistent view between sensitive instruction and privilege instruction let full virtualization easily.That is , all the sensitive instruction execute in guest will cause a trap to VMM. With the power of VT-x, Xen are modify to support HVM which has no need to modify guest OSes.  Latter in 2006, "Extending Xen with Intel Virtualization Technology" was published in Intel Technology Journal .This article states changes for Xen to support HVM.

Xen Basic installation

Reference

  1. “Extending Xen* with Intel® Virtualization Technology,” Intel Technology Journal vol. 10, no. 03. 2006.
  2. P. Barham, B. Dragovic, K. Fraser, S. Hand, T. Harris, A. Ho, R. Neugebauer, I. Pratt, and A. Warfield, “Xen and the Art of Virtualization Categories and Subject Descriptors,” SOSP'03.
  3. Xen official website, http://www.xen.org/download/index_3.4.4.html
  4. WikiPedia ,  http://en.wikipedia.org/wiki/Xen