210 likes | 360 Views
Xen and the Art of Virtualization - Focus on paravirtualization - EECS 2003-12087 Lee, Woen Chan. Contents. Introduction Xen ’ s Approach
E N D
Xen and the Art of Virtualization - Focus on paravirtualization - EECS 2003-12087 Lee, Woen Chan
Contents • Introduction • Xen’s Approach • Paravirtualized interfaces • CPU • MMU • Device I/O
Introduction • Drawbacks of full virtualization of x86 architecture • Critical instruction emulation • x86 MMU virtualization • These problems can be solved only at the cost of increased complexity and reduced performance.
Xen’s Approach • To obtain high performance, modify guest OS code. -> paravirtualization! • Make guest OS aware that VMM exists. • Do not require changes to ABI. • Cost of porting guest OS is small
Xen’s Approach • Xen architecture Xen 1.2 Architecture Xen 3.0 Architecture
Xen’s Approach • Flexibility • Separate mechanism and policy • Implement and use your own policies! • Domain0 is used for overall system management • Domain0 also do device management
Paravirtualizedinterfaces - CPU • Arch Xen/x86 • Critical instructions are replaced with Xen hypercalls • Avoid scanning/patching and fault trapping • Xen runs in ring 0 • Ring 1/2 for guest OS, 3 for user apps. • Prevent guest OS from directly executing privileged instructions • Jump to Xen in ring 0 by hepercalls • Guest OS may install ‘fast trap’ handler • Direct ring user-space to guest OS system calls
Paravirtualizedinterfaces - MMU • MMU virtualization : shadow vs. direct • Using shadow pages(in VMware)
Paravirtualizedinterfaces - MMU • Direct-mode(Xen) • Guest OSes allocate and manage own PTs • Hypercall to change PT base • Xen must validate PT update before use • Update may be queued and batch processed • Validation rules • Guest may only map pages it owns • Pagetable pages may only be mapped RO
Paravirtualizedinterfaces - MMU • Direct-mode(Xen)
Paravirtualizedinterfaces - MMU • Page fault handling
Paravirtualizedinterfaces - MMU • Page fault handling
Paravirtualizedinterfaces - MMU • Page fault handling
Paravirtualizedinterfaces - MMU • Page fault handling
1.1 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 L X V U L X V U Page fault (µs) Process fork (µs) lmbench results on Linux (L), Xen (X), VMWare Workstation (V), and UML (U) Paravirtualizedinterfaces - MMU • MMU Performance
Paravirtualizedinterfaces – I/O • Device I/O • Zero-copy data transfer • cf) traditional spooled-device emulation • Lightweight event delivery
Paravirtualizedinterfaces – I/O • Asynchronous I/O ring
Paravirtualizedinterfaces – I/O • Device channel
Paravirtualizedinterfaces – I/O • TCP results