320 likes | 432 Views
Xen and the Art of Virtualization. Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt, Andrew Warfield. Apology / Disclaimer. Why Virtualise?. Consolidate machines Isolate performance Stay flexible. HARDWARE. ???. HARDWARE. Linux.
E N D
Xen and the Art of Virtualization Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt, Andrew Warfield
Why Virtualise? • Consolidate machines • Isolate performance • Stay flexible
??? HARDWARE
Linux WinXP ??? HARDWARE
Linux WinXP Mirage ??? HARDWARE
Linux WinXP Mirage Virtual Machine Monitor HARDWARE
How 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
How to Build a VMM 2: Trap and Emulate Guest App Guest Kernel EMULATOR PROCESS “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 2: Trap and Emulate Guest App Guest Kernel EMULATOR PROCESS add %eax, %ebx “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 2: Trap and Emulate Guest App Guest Kernel EMULATOR PROCESS outb %al “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 2: Trap and Emulate Guest App Guest Kernel EMULATOR PROCESS outb %al “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 2: Trap and Emulate Guest App Guest Kernel EMULATOR PROCESS handle_sysenter sysenter “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 2: Trap and Emulate • for(i = 0; i < 256; i++) • mangle_pagetable_entry(&ptes[i]); • 256 traps into the emulator • Severe performance penalty
How to Build a VMM 3: Dynamic Binary Translation Rewritten Guest App Rewritten Guest Kernel TRANSLATOR PROCESS “Physical” memory Virtual MMU Virtual System Calls Normal OS HARDWARE
How to Build a VMM 3: Dynamic Binary Translation • for(i = 0; i < 256; i++) • mangle_pagetable_entry(&ptes[i]);
How to Build a VMM 3: Dynamic Binary Translation • pte_t new_ptes[256]; • for(i = 0; i < 256; i++) • new_ptes[i] = mangled_entry(&ptes[i]); • register_new_ptes(new_ptes, 256); • But when is this a safe alteration?
How 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”.
Xen: Founding Principles • Minimally alter guest OS • Don't disguise multiplexing • Thusly, be faster than the competition
VMWare Memory Management VAS Pages “Physical” frames
VMWare Memory Management VAS Pages “Physical” frames Page Table
VMWare Memory Management VAS Pages Physical frames Page Table (not really)
VMWare Memory Management VAS Pages Physical frames Shadow Page Table
Xen Memory Management VAS Pages Physical frames
Xen Memory Management VAS Pages Physical frames Page Table
VMWare I/O “Physical” Memory “I/O Ports” NE2000 Model Rubbish NIC One op at a time Shared buffers “Device” Memory “Device” Ports
Xen I/O Own Memory Hypervisor Async Queue --> <-- Async Queue Packet
Xen I/O Own Memory Hypervisor Async Queue --> <-- Async Queue Packet
Xen I/O Own Memory Hypervisor Async Queue --> <-- Async Queue Buffer
Strawman Warning • VMWare does that too • “Guest additions” are basically paravirt