Intel Virtualization
Intel Virtualization
Technology
Outline
• Virtualization
• Usage models and workloads
• Challenges to virtualizing Intel architectures
• Addressing virtualization challenges in software
• VT-x architecture overview
• VT-i architecture overview
• Solving virtualization challenges with VT-x and
VT-i
Virtualization
• Make it run multiple operating systems.
...
Guest OS0 Guest OS1 Guest OSn
Guest OSn
virtual machines
Virtual Machine Monitor (VMM)
(VMs)
Platform HW
Processor/C
Memory I/O Devices
S
(b) the 0/1/3 model for ring deprivileging (c) the 0/3/3 model for ring deprivileging
• Ring deprivileging causes numerous virtualization
challenges:
• Ring aliasing- Problem when software is run at a privilege
level other than the level for which it was written.
• Example:
Software can execute the instructions that write to these
registers (LGDT, LIDT, LLDT, and LTR) only at privilege level 0.
Software can execute the instructions that read from these
registers(SGDT, SIDT, SLDT, and STR) at any privilege level.
Platform HW
Processor/C
Memory I/O Devices
S
VT-x architecture overview
• VT-x augments IA-32 with two new forms of CPU
operation:
• VMX root operation:
Fully privileged, runs for VM monitor.
• VM Exit
• Transition from guest to VMM.
• Enters VMX root operation.
VM0 VM1
• Saves guest state in VMCS. App0 App1
VM Exit VM Entry
Virtual Machine Monitor (VMM)
Platform HW
Processor/C
Memory 19
I/O Devices
S
virtual-machine control structure (VMCS)
• Guest transitions :
• Guest software cannot use the IA-32 instructions
SYSENTER and SYSEXIT if the guest OS runs outside
privilege level 0.
• With VT-x, a guest OS can run at privilege level 0, allowing
use of these instructions.
• Interrupt virtualization:
• VT-x includes an external-interrupt exiting VM
execution control. When this control is set to 1, a
VMM prevents guest control of interrupt masking.
Distributed System 26
Format of VMCS Region
• A VMCS comprises of 4 KB contiguous bytes. The
format of VMCS region is:
Byte Contents
Offset
0 VMCS revision identifier(maintains VMCS data in different formats):
-Processors that maintain VMCS data in different formats, use different VMCS
revision identifiers.
- These identifiers enable s/ws to avoid using a VMCS region formatted for one
processor on a processor that uses a different format.
4 VMX abort indicator(writes a non-zero value if abort occurs):
-Contents of these bytes do not control processor operations in any way.
-A logical processor writes a non-zero value into these bytes if a VMX abort
occurs.
-s/ws may also write into this field.
8 VMCS data(Implementation specific format: Controls VMCS non-root
operations + VMX transitions):
- Those parts of the VMCS that control VMX-non-root operation and the VMX
transitions.
Distributed System 27
Organization of VMCS Data
VMCS is organized into 6 logical groups:
– Guest State Area: Processor state is saved into this
area on VM Exits and loaded from there on VM
entries.
– Host State Area: Processor state is loaded from
the host-state area on VM exits.
– VM Execution control fields: These fields control
processor behavior in VMX non-root mode
operation. They determine in part the causes of
VM exits.
Distributed System 28
Organization of VMCS Data contd..
• VMCS is organized into 6 logical groups….:
– VM Exit control fields: Controls VM exits.
– VM Entry control fields: Controls VM entries.
– VM Exit information fields: These fields receive
information on VM exits and describe the cause
and the nature of VM exits. They are Read-Only.
Distributed System 29
Ways that a VMM can share resources
between VMs
• VMM applies all 3 sharing methods, as needed, to create illusion
of platform ownership to each guest OS.
• Time Multiplexing:
– VMs are allowed direct access to resource for a period of time before
being context switched to another VM(e.g., CPU resource)
• Resource Partitioning:
– VMMs allocates “ownership” of physical resources to VMs
– Typically involves some remapping and protection mechanisms. e.g.,
• Physical memory
• Disk partitions
• Graphical display
• Mediating h/w interfaces:
– VMM retains direct ownership of physical resource
– VMM hosts device drivers as well as a virtualized device interface
– Virtual interface can be same as or different than physical device
Distributed System 30
Some VM specific instructions
• Processors with VT have an extra instruction set called VM
Extensions or VMX
• VMX virtualization-specific instructions to the CPU
– VMPTRLD
– VMPTRST
– VMCLEAR
– VMREAD
– VMWRITE
– VMCALL
– VMLAUNCH
– VMRESUME
– VMXOFF
– VMXON
• A VMCS can be manipulated by the instructions:
– VMCLEAR
– VMPTRLD
– VMREAD
– VMWRITE
Distributed System 31