Title: Xen and the Art of Virtualization
1Xen and the Art of Virtualization
Paul Barham, Boris Dragovic, Keir Fraser, Steven
Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian
Pratt, Andrew Warfield
2Apology / Disclaimer
3Why Virtualise?
- Consolidate machines
- Isolate performance
- Stay flexible
4HARDWARE
5???
HARDWARE
6Linux
WinXP
???
HARDWARE
7Linux
WinXP
Mirage
???
HARDWARE
8Linux
WinXP
Mirage
Virtual Machine Monitor
HARDWARE
9How to Build a VMM 1 Emulation
EMULATOR PROCESS
Physical memory
Guest App
Guest App
Virtual MMU
Virtual System Calls
Guest Kernel
Virtual CPU
Normal OS
HARDWARE
10How to Build a VMM 2 Trap and Emulate
Guest Kernel
Guest App
EMULATOR PROCESS
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
11How to Build a VMM 2 Trap and Emulate
Guest Kernel
Guest App
EMULATOR PROCESS
add eax, ebx
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
12How to Build a VMM 2 Trap and Emulate
Guest Kernel
Guest App
EMULATOR PROCESS
outb al
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
13How to Build a VMM 2 Trap and Emulate
Guest Kernel
Guest App
EMULATOR PROCESS
outb al
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
14How to Build a VMM 2 Trap and Emulate
Guest Kernel
Guest App
EMULATOR PROCESS
handle_sysenter
sysenter
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
15How to Build a VMM 2 Trap and Emulate
- for(i 0 i lt 256 i)
- mangle_pagetable_entry(ptesi)
- 256 traps into the emulator
- Severe performance penalty
16How to Build a VMM 3 Dynamic Binary Translation
Rewritten Guest Kernel
Rewritten Guest App
TRANSLATOR PROCESS
Physical memory
Virtual MMU
Virtual System Calls
Normal OS
HARDWARE
17How to Build a VMM 3 Dynamic Binary Translation
- for(i 0 i lt 256 i)
- mangle_pagetable_entry(ptesi)
18How to Build a VMM 3 Dynamic Binary Translation
- pte_t new_ptes256
- for(i 0 i lt 256 i)
- new_ptesi mangled_entry(ptesi)
- register_new_ptes(new_ptes, 256)
- But when is this a safe alteration?
19How to Build a VMM 4 Xen
- Q. But when is this a safe alteration?
- A. Let the humans worry about that.
- Manually hack the OS paravirtualisation.
20Xen Founding Principles
- Minimally alter guest OS
- Don't disguise multiplexing
- Thusly, be faster than the competition
21VMWare Memory Management
VAS Pages
Physical frames
22VMWare Memory Management
VAS Pages
Physical frames
Page Table
23VMWare Memory Management
VAS Pages
Physical frames
Page Table (not really)
24VMWare Memory Management
VAS Pages
Physical frames
Shadow Page Table
25Xen Memory Management
VAS Pages
Physical frames
26Xen Memory Management
VAS Pages
Physical frames
Page Table
27VMWare I/O
Physical Memory
I/O Ports
NE2000 Model Rubbish NIC One op at a time Shared
buffers
Device Memory
Device Ports
28Xen I/O
Own Memory
Hypervisor
Async Queue --gt
lt-- Async Queue
Packet
29Xen I/O
Own Memory
Hypervisor
Async Queue --gt
lt-- Async Queue
Packet
30Xen I/O
Own Memory
Hypervisor
Async Queue --gt
lt-- Async Queue
Buffer
31Strawman Warning
- VMWare does that too
- Guest additions are basically paravirt
32Is it Any Good?