CPU Virtualization
CPU Virtualization
CPU Virtualization
What is it?.
Virtualization
is the pooling and abstraction of
resources and services in a way that
masks the physical nature and
boundaries of those resources and
services from their users
http://www.gartner.com/DisplayDocument?id=399577
Virtualization is … well, not exactly new
Nothing new! Concept known to mainframes back in the ’70s
Virtualization is not a new concept
Mainframe of the ‘70s were underutilized and over-engineered
http://www-07.ibm.com/systems/my/z/about/timeline/1970/
Mainframe Virtualization:
Concept: split the computer into multiple virtual machines so different “tasks” can
be run separately and independently on the same mainframe.
If one virtual machine or “task” fails, other virtual machines are unaffected
VM #1 VM #2 VM #3 VM #4 VM #5 VM #6 VM #7
Task A Task B Task C Task D Task E Task F Task G
File File
File Web Server Web Domain Server
Server Server Server Server
DNS Each Server Running
App
Server Server 1 Application
IT Challenges
Server Sprawl
Power, space and cooling: one of the largest IT budget line items
One-application-per-server: high costs (equipment and
administration)
Low Server and Infrastructure Utilization Rates
Result in excessive acquisition and maintenance costs
High business continuity costs
HA & DR solutions built around hardware are very expensive
Ability to respond to business needs is hampered
Provisioning new applications often a tedious process
Securing environments
Security often accomplished through physical isolation: costly
Virtualization is the Key
Apply Mainframe Virtualization Concepts to x86 Servers:
Use virtualization software to partition an Intel / AMD server to
work with several operating system and application “instances”
Database Web Application Servers Email File Print DNS LDAP
Operational Flexibility
Other Significant Virtualization Benefits
Some key benefits:
Ability to quickly spawn test and development environments
Provides failover capabilities to applications that can’t do it natively
Maximizes utilization of resources (compute & I/O capacity)
Server portability (migrate a server from one host to the other)
What is a hypervisor?
A hypervisor, also called a virtual machine manager (VMM), is a
program that allows multiple operating systems to share a single
hardware host. Each operating system appears to have the host's
processor, memory, and other resources all to itself. However, the
hypervisor is actually controlling the host processor and resources,
allocating what is needed to each operating system in turn and
making sure that the guest operating systems (called virtual
machines) cannot disrupt each other.
It's all about Rings
x86 CPUs provide a range of protection levels also known as rings in
which code can execute. Ring 0 has the highest level privilege and is
where the operating system kernel normally runs. Code executing in
Ring 0 is said to be running in system space, kernel mode or supervisor
mode. All other code such as applications running on the operating
system operate in less privileged rings, typically Ring 3.
Rings in virtualization
Traditional systems
Operating system runs in privileged mode in Ring 0 and
owns the hardware
Applications run in Ring 3 with less privileges
Virtualized systems
VMM runs in privileged mode in Ring 0
Guest OS inside VMs are fooled into thinking they are
running in Ring 0, privileged instructions are trapped and
emulated by the VMM
Newer CPUs (AMD-V/Intel-VT) use a new privilege level
called Ring -1 for the VMM to reside allowing for better
performance as the VMM no longer needs to fool the Guest
OS that it is running in Ring 0.
Typical Virtualization Architectures
Hardware Partitioning Dedicated Hypervisor Hosted Hypervisor
Adjustable
partitions Hypervisor
Partition Hypervisor
Controller Host OS
Server is subdivided into fractions Hypervisor provides fine-grained Hypervisor uses OS services to
each of which can run an OS timesharing of all resources do timesharing of all resources
Monitor supports:
•BT (Binary Translation)
Monitor Monitor (BT, HW, PV)
•HW (Hardware Assist)
Virtual NIC Virtual SCSI
•PV (Paravirtualization)
Memory
Scheduler Allocator
Virtual Switch File System
http://www.vmware.com/products/vsphere/
Xen 3.0 Architecture
http://www.citrix.com/English/ps2/products/feature.asp?contentID=1686939
Evolution of Virtualization
X86 X86
X86 X86
Windows Windows
Suse Red Hat
XP 2003
Guest OS
http://portal.acm.org/citation.cfm?doid=361011.361073
x86 Virtualization Challenges
Paravirtualization
Xen, [Microsoft Hyper-V], some VMware
ESX device drivers
Hardware
Applications/users see container VM as a
virtual host/server
VMs can be booted/shut down like regular OS
Systems
Linux VServer, OpenVZ
Host-Based Virtualization (Type-2)
Systems
Microsoft Virtual Server, VMware Workstation & Server
Host OS: XP, 2003, Linux
Guest OS: NT, 2000, 2003, Linux
Para-Virtualization
Systems Disk
CPU Memory IO
Xen Hardware
Guest OS unmodified
VMs: Guest OS+Applications run
under the control of VMM
Examples
VMware ESX, Microsoft Hyper-V
IBM z/VM
Linux KVM (Kernel VM)
A Closer Look at VMware’s ESX™
Full virtualization
Runs on bare metal
Referred to as ‘Type-1 Hypervisor’
VMMs
(virtual hardware)
ESX Kernel
© http://www.vmware.com
Privileged Instruction Execution
Guest OS
Guest OS 1 Guest OS n
Ring 1 or 3
Keep Shadow copies of Guest LGDT 0x00007002
Hardware
http://communities.vmware.com/docs/DOC-9150
http://www.vmware.com/files/pdf/vsphere_performance_wp.pdf
What About Networking?
Users naturally expect VMs to have access to network
VMs don’t directly control networking hardware
x86 hw designed to be handled by only one device driver!
Physical switch
Physical link
Hypervisor
VM A VM B
MAC address A MAC address B