Beruflich Dokumente
Kultur Dokumente
What is Virtualization?
Examples
Network Virtual LAN (VLAN), Virtual Private Network (VPN) Storage Storage Area Network (SAN), LUN Computer Virtual Machine (VM), simulator
Overview
Virtual Machines Virtualization Approaches Processor Virtualization Additional Topics
Software
Tightly coupled to hardware Single active OS image OS controls hardware
Virtualization Software
Extra level of indirection decouples hardware and OS Multiplexes physical hardware across multiple guest VMs Strong isolation between VMs Manages physical resources, improves utilization
VM Isolation
Secure Multiplexing
Run multiple VMs on single physical host Processor hardware isolates VMs, e.g. MMU
Strong Guarantees
Software bugs, crashes, viruses within one VM cannot affect other VMs
Performance Isolation
Partition system resources Example: VMware controls for reservation, limit, shares
VM Encapsulation
Entire VM is a File
OS, applications, data Memory and device state
VM Compatibility
Hardware-Independent
Physical hardware hidden by virtualization layer Standard virtual hardware exposed to VM
Legacy VMs
Run ancient OS on new platform E.g. DOS VM drives virtual IDE and vLance devices, mapped to modern SAN and GigE hardware
Server Consolidation and Containment Eliminate server sprawl by deploying systems into virtual machines that can run safely and move transparently across shared hardware Business Continuity Reduce cost and complexity by encapsulating entire systems into single files that can be replicated and restored onto any target server
Enterprise Desktop Secure unmanaged PCs without compromising end-user autonomy by layering a security policy in software around desktop virtual machines
Overview
Virtual Machines Virtualization Approaches
Virtual machine monitors (VMMs) Virtualization platform types Alternative system virtualizations
10
An Old Concept
Classic definition from Popek & Goldberg 74 IBM mainframes since 60s
VMM Characteristics
Fidelity Performance Isolation / Safety
11
VMM Technology
So this is just like Java, right?
No, a Java VM is very different from the physical machine that runs it A hardware-level VM reflects underlying processor architecture
12
VMMs Past
An Old Idea
Hardware-level VMs since 60s IBM S/360, IBM VM/370 mainframe systems Timeshare multiple single-user OS instances on expensive hardware
Classical VMM
Run VM directly on hardware
From IBM VM/370 product announcement, ca. 1972
Trap and emulate model for privileged instructions Vendors had vertical control over proprietary hardware, operating systems, VMM
13
VMMs Present
Renewed Interest
Academic research since 90s VMs for commodity systems Server consolidation
Run unmodified commodity guest operating systems Significant challenges, e.g. non-virtualizable instructions Pioneered by VMware in 98
14
Bare-Metal Architecture
Hypervisor installs directly on hardware Acknowledged as preferred architecture for high-end servers Examples: VMware ESX Server, Xen, Microsoft Viridian (2008)
15
Language Level
OS Level
Hardware Level
16
Bare-Metal/ Hypervisor
Hosted
Microsoft Virtual Server Microsoft Virtual PC Parallels Desktop VMware Player VMware Workstation VMware Server
OS Level
Emulators
Para-virtualization
FreeBSD Jail HP Secure Resource Partitions Sun Solaris Zones SWsoft Virtuozzo User-Mode Linux
17
Overview
Virtual Machines Virtualization Approaches Processor Virtualization
Classical techniques Software x86 VMM Hardware-assisted x86 VMM Para-virtualization
Additional Topics
18
Implementation Technique
This is just one technique Popek and Goldberg criteria permit others
19
VPN
guest
PPN
VMM
hardware TLB
MPN
For ordinary memory references Hardware maps VPN to MPN Cached by physical TLB
20
Memory Traces
Shadow Page Table
Derived from primary page table in guest VMM must keep primary and shadow coherent
21
Trap Sources
Most frequent: Guest page table traces Privileged instructions Memory-mapped device traces
22
23
Code Patching
Problem not transparent Guest can inspect its own code
24
25
26
BT Mechanics
Input: BB
55 ff 33 c7 03 ...
Output: CCF
55 ff 33 c7 03 ...
27
%ebp (%ebx) (%ebx), ffffffff %edx, %esp %esp, 81c(%ebx) %edx %ebp, %eax 80460ba4
BB
25555b0 25555b1 25555b3 25555b9 25555bb 25555c1 25555c2 25555c4 25555c9 25555cb
push %ebp push (%ebx) mov (%ebx), ffffffff mov %edx, %esp mov %esp, 81c(%ebx) push %edx mov %ebp, %eax push 80403a82 int 3a data: 80460ba4
CCF
25555c4: push return address 25555c9: invoke translator on callee
28
Adaptive BT
Translation Cache
!*!
29
Faster resumption
Faster Traces
10x performance improvement Adapts to runtime behavior
Invoke Translator
30
Costs
Running translator Path lengthening System call slowdown Complexity
31
Hardware-Assisted VMM
Recent x86 Extension
1998 2005: Software-only VMMs using binary translation 2005: Intel and AMD start extending x86 to support virtualization
First-Generation Hardware
Enables classical trap-and-emulate VMMs Intel VT, aka Vanderpool Technology AMD SVM, aka Pacifica
Performance
VT/SVM help avoid BT, but not MMU ops (actually slower!) Main problem is efficient virtualization of MMU and I/O, Not executing the virtual instruction stream
32
VT/SVM Architecture
Diagram
CPL 3 CPL 3
CPL 2
CPL 2
Guest Mode
Runs unmodified OS Sensitive operations exit (trap out) to host mode
CPL 1
CPL 1
VMCB
CPL 0 Host CPL 0 Guest
33
Hardware-Assisted VMM
Guest mode
Resume Guest
34
Costs
Exits: 1000s of cycles for traces and I/O No adaptation or software flexibility Stateless model
Future
Hardware support for fast MMU virtualization Intel EPT, AMD NPT
35
What is Paravirtualization?
Full Virtualization
No modifications to guest OS Excellent compatibility, good performance, but complex
36
Guest OS
Guest OS
Hypercalls (GOOD)
Hypervisor Hardware
Hypervisor Hardware
NOT GOOD!
Full Virtualization
Copyright 2007 VMware, Inc. All rights reserved.
Paravirtualization
37
Dom0
Xeno Linux
VMI Linux
Windows
38
Further Reading
VMware Publications
www.vmware.com/academic/resources.html A Comparison of Software and Hardware Techniques for x86 Virtualization (ASPLOS 06) Fast Transparent Migration for Virtual Machines (USENIX 05) Memory Resource Management in VMware ESX Server (OSDI 02) Virtualizing I/O Devices on VMware Workstations Hosted VMM (USENIX 01)
39
Additional Topics
I/O Virtualization Memory Management
40
Virtual Device
Model existing device, e.g. e1000 Model an idealized device, e.g. vmxnet
Virtualization Layer
Device Emulation I/O Stack Device Driver
Emulates the virtual device Remaps guest and real I/O addresses Multiplexes and drives physical device Provides additional features, e.g. transparent NIC teaming
Real Device
Physical hardware, e.g. bcm5700 Likely to be different than virtual device
Copyright 2007 VMware, Inc. All rights reserved.
41
Passthrough I/O
Guest OS
Device Driver
Hypervisor Direct
Guest OS
Device Driver
VMware Workstation, VMware Server, VMware ESX Server (for slow devices), Xen, Microsoft Viridian, Virtual Server
42
Guest OS
Device Driver
Guest OS
Device Driver
Enabled by HW Assists
Virtualization Layer I/O MMU Device Manager
I/O-MMU for DMA isolation e.g. Intel VT-d, AMD IOMMU Partitionable I/O device e.g. PCI-SIG IOV spec
VF
VF
VF
Challenges
Hardware independence Migration, suspend/resume Memory overcommitment
I/O Device
PF
43
Additional Topics
I/O Virtualization Memory Management
44
Memory Management
Desirable capabilities
Efficient memory overcommitment Accurate resource controls Exploit sharing opportunities
Challenges
Allocations should reflect both importance and working set Best data to guide decisions known only to guest OS Guest and meta-level policies may clash
45
Allocation policies
Proportional sharing revoke memory from VM with minimum shares-per-page ratio Idle memory tax charge VM more for idle pages than for active pages to prevent unproductive hoarding
46
Ballooning
inflate balloon (+ pressure) may page out to virtual disk
Guest OS
balloon
Guest OS
balloon
guest OS manages memory implicit cooperation may page in from virtual disk
Guest OS
47
Page Sharing
Motivation
Multiple VMs running same OS, apps Collapse redundant copies of code, data, zeros
Content-based sharing
General-purpose, no guest OS changes Background activity saves memory over time
48
2bd806af
VM 1
VM 2
VM 3
hash table
49
VM 1
VM 2
VM 3
hash table
50