SlideShare a Scribd company logo
HARDWARE SUPPORT
FOR EFFICIENT
VIRTUALIZATION
Lennox Wu

1
Outline

• Classifications

• Processor virtualization

Two main Software-based solutions
• Challenges to virtualize Intel x86(software-only)
• Hardware-based Virtualization
•

Intel VT-x : x86
• Intel VT-I :Itanium (X)
• Intel EPT/AMD NPT
• AMD-V
• Sun SPARC (X)
• ARM Virtualization Extensions(X)
• IBM Power(X)
•

• I/O virtualization
• Intel VT-d
• AMD IOMMU(AMD-V)
• Intel VT-c
• Dose these techniques work?
2
Classifications

• VMM(virtual machine monitor) = hypervisor
• By techniques

Full Virtualization
• Paravirtualization
• Hardware Assisted Virtualization
•

• Robert P. Goldberg(Harvard University,1973)
•

Type 1/native/bare metal hypervisors
Hypervisors run directly on the host's hardware to control the hardware and to manage
guest operating systems.
• Oracle VM Server for SPARC, the Citrix XenServer, KVM, VMware ESX/ESXi, and Microsoft
Hyper-V hypervisor.
•

•

Type 2/hosted hypervisors
Hypervisors run within a conventional operating system environment.
• VMware Workstation/player, Microsoft Virtual PC and VirtualBox
•

3
TYPE1/TYPE2 hypervisors

4
PROCESSOR
VIRTUALIZATION

5
Two main Software-based
solutions(1)
• Full virtualization using binary translation
•

Transforming guest OS binaries on-the-fly
•

•

Guest applications don’t use privilege instructions

Pros
Support unmodified OSs (The only way of pure-software solutions)
• Offer best isolation and security
• Simplify migration and portability of guest OS
•

Cons: low performance
• Examples: VMware, MS Virtual PC, Virtual box
•

•

Disable HW virtualization

6
Full virtualization using binary
translation

7
•

Two main Software-based
OS assisted virtualization or paravirtualization
solutions(2) guest OSs help the VMM
OS assisted virtualization

•

•

•

paravirtualization refers to communication between the guest OS and the VMM to
improve performance and efficiency

Modify the guest OS to cooperate with the VMM
•

Modify the OS kernel to replace non-virtualizable instructions with hypercalls(the
functions provided by the VMM)

Pros: Offer higher performance
• Cons: Need the source code of an OS
• Example: Xen, KVM(*), VMware(*)
• (*) Vmware tool uses some paravirtualization techniques
•

optimize virtual device drivers
• time synchronization
• logging and guest shutdown.
• Vmxnet is a paravirtualized I/O device driver
•

8
OS assisted virtualization or
paravirtualization

9
KVM
KVM

10
Challenges to virtualize Intel
x86(software-only)(1/3)
• Ring Aliasing
•

Guest-OSes run at the Ring3
•

•

Original: OS:Ring 0, APP:Ring 3 (Ring0>ring3)

A guest OS can know its run level

• Address-Space Compression

VMM must use some of the guest’s virtual-address space to manage
transition between guest OS and VMM
• VMM’s address spaces must be protected
•

•

Guest could detect that it is running in a VM

11
Challenges to virtualize Intel
x86(software-only)(2/3)
• Non-Faulting Access to Privileged State
•

Some instructions should be intercepted by VMM do not involve faults

• Adverse Impact on Guest System Calls
•

VMM must emulate every system calls

• Interrupt Virtualization

A VMM may manage external interrupts and deny guest to control
interrupt masking
• Some OS frequently mask and unmask
•

•

VMM must process these requests.

12
Challenges to virtualize Intel
x86(software-only) (3/3)
• Ring Compression
•

Guest OS runs at the same privilege level as applications
•

The guest OS can’t protect guest applications

• Frequent Access to Privileged Resources
•

VMM should deny the accesses

• Address translation
•

Guest OS doesn’t know the physical address, so the VMM must
intercepted guest page table updates

13
Intel VT-x overview(1/4)
• VT=virtualization technology
•

Two new form of CPU operation
VMX root operation : for VMM
• VMX non-root operation: for guest-software
• Both forms of operation support all four privilege levels(Ring0~Ring3)
•

•

Guest OS can run at its intended privilege level

14
Two new form of CPU operation

15
Intel VT-x overview(2/4)
• Two new transitions
• VM entry
• VMX root operation (VMM) non-root operation(VM)
• VM exit
• VMX non-root operation (VM) root operation (VMM)

• Under VMX non-root operation, many

instructions/events cause VM exits
• configurable

16
Intel VT-x overview(3/4)
• VMCS (Virtual Machine Control Structure)

A new data structure includes guest-state area and host-state area
• VM entry: load the guest-state area and save the host-state area
• VM exit : load the host-state area and save the guest-state area
• The exiting conditions controlled by the VM-execution fields
• Switch the structure will switch the address space
•

17
Intel VT-x overview(4/4)
• VMCS supports interrupt virtualization
•

Determine the conditions of VM to cause VM exit
•
•
•
•

•

All interrupt
Whenever guest OS is ready to receive interrupts
Which exception?
Which port access attempts?
Which Model Specific Register access attempts?

18
Intel EPT / AMD NPT(1)
• EPT (Extended Page Tables)
•

•

“EPT provides performance gains of up to 48% for MMU-intensive
benchmarks and up to 600% for MMU-intensive microbenchmarks.” –
VMware
AMD’s nested page table (NPT) is similar to EPT

• A.k.a Rapid Virtualization Indexing (RVI)
•

“RVI provides performance gains of up to 42% for MMU-intensive
benchmarks and up to 500% for MMU-intensive microbenchmarks.” -VMware

19
Intel EPT / AMD NPT(2)
• Software MMU (software-only)

Hardware uses the shadow page table
• VMM must maintain the shadow page table
•

20
Intelmaintains guest page tables
EPT / AMD NPT(3)
Guest-OS

• Hardware MMU
•

VMM maintains PPN->MPN mappings in an additional level of page tables
• The hardware will find the LPN->MPN with the two pages
•

21
AMD-V(1/2)
• Tagged TLB

Add the ASID
• Hardware features that facilitate efficient switching between virtual
machines for better application responsiveness
•

•

Two new form of CPU operation
Host mode : for VMM (similar to Intel’s VMX root operation)
• Guest mode : for guest software (similar to Intel’s VMX non-root operation)
• new instructions
•

•
•
•

•

vmrun : host mode  guest mode
exit : guest mode  host mode
vmcall: it lets the operating system and VMM communicate directly

A new structure
•

Virtual Machine Control Block (VMCB)
•

Similar to Intel’s VMCS
22
AMD-V(2/2)
• Nested page table (NPT)/ Rapid Virtualization Indexing (RVI)
• VMM migration
•

Use the CPUID to identify the ability of the processor where the VMM
runs, and the VMM use the supported functions.

23
Hardware-base solution with VTx(1/2)
• Address-Space Compression
•

VM Exits / VM Entries change the linear address space

• Ring Aliasing
•

& Ring Compression

VT-x allows guest OS to run at its intended privilege level

• Nonfaulting Access to Privileged State

Either causes transition to VMM
• Or becomes unimportant to VMM
•

24
Hardware-base solution with VTx(2/2)
• Guest System Calls
•

a guest OS can run at privilege level 0

• Frequent Access to Privileged Resources
•

VT-x provides TPR shadow. VMM is only involved when the value drops
below the threshold VMM only processes the situation it cares.

25
Hardware Assisted Virtualization
of x86

26
I/O VIRTUALIZATION

27
Current I/O virtualization
techniques
• Emulation

The VMM supports virtual devices that guest OS can recognize
• The virtual device models are responsible to translate commands and data.
• Pros. No requirement to modify guest-OSs
• Cons. Low performance
•

• Paravirtualization

Modify the guest software (driver)to enhance the performance
• Pros. better performance
• Cons. Limited applicability. (modify need the source code)
•

• Direct assignment

Bind a specify device to a VM
• VMM allow the owning VM to connect directly
• Issue command (go) low overhead
• DMA? (back)
•

28
DMA on a virtualizing system
• DMA

Driver issue a packet consists of command, physical address, etc.
• DMA controller read/write data from/to the physical address
• Challenge?
•

A physical address that a Guest-OS knows is not really physical !
• The really physical address space is managed by the VMM
• The DMA controller will incorrectly write data to an address.
•

29
Intel VT-d(1/2)
• Need the support of the North bridge
• Two functions
•

Bind devices to a specify VM
•

•

DMA remapping

Interrupt virtualization
•

Interrupt remapping

• DMA remapping

DVA (DMA Virtual Address), GPA(Guest Physical Address), HPA(Host
Physical Address)
• A guest-OS issue a DMA request with DVA(=GPA)
• The VT-d hardware will translate the DVA to HPA
•

•

The concept: lookup tables

30
DMA remapping

31
Intel VT-d (2/2)
•

Interrupt Remapping
• Assign an interrupt attribute
•

•

Destination processor, vector, etc.

A VMM enables the interrupt requests from the I/O device to target the
physical CPUs running the appropriate virtual CPUs of the legacy VM

• AMD IOMMU is similar to Intel VT-d

32
Intel VT-c
• Virtualization Technology for Connectivity
•

Virtualization on devices

• A collection of technologies that improve the performance of

network I/O on a virtualized system
• VT-c is comprised of two components
•

VMDq (Virtual Machine Device Queues)
A hardware-base enhancement
• Target: throughput
•

•

VMDc (Virtual Machine Direct Connect)
Virtualizing physical I/O ports of a network controller into multiple virtual I/O
ports, and then to map the virtual ports to individual VMs
• Target :VT-x + VT-d + VT-c  nearly native performance
•

33
Why VMDq?

34
35
VMDc

36
DO THESE
TECHNIQUES WORK?

37
Ubuntu 11.10: Xen vs. KVM vs.
VirtualBox(1)

38
Ubuntu 11.10: Xen vs. KVM vs.
VirtualBox(2)

39
Ubuntu 11.10: Xen vs. KVM vs.
VirtualBox(3)

40
Ubuntu 12.10: KVM vs. Xen (1)

41
Ubuntu 12.10: KVM vs. Xen (2)

42
Ubuntu 12.10: KVM vs. Xen (3)

43
Ubuntu 12.10: KVM vs. Xen (4)

44
Ubuntu 12.04 KVM/Xen
Virtualization: Intel vs. AMD(1)
• Ubuntu 12.04 LTS, an Intel Core i7 3960X "Sandy Bridge" Extreme

Edition and AMD FX-8150 "Bulldozer" systems were used.

45
Ubuntu 12.04 KVM/Xen
Virtualization: Intel vs. AMD(2)

46
Intel Ivy Bridge Linux
Virtualization Performance(1)

47
Intel Ivy Bridge Linux
Virtualization Performance(2)

48
Summarization of Hardware
Assisted Virtualization
• Hardware provides some mechanisms to reduce overheads of

virtualization to improve performance
• Pros.

The highest performance in theory (a counter example, 2006 VMware)
• Support unmodified Oss
• Simplify the development of VMM
•

• Cons.
•

Need newer processors

• Example
•

KVM(basic requirements)

49
References
•

Performance Evaluation of Intel EPT Hardware Assist, VMware

•

I/O Virtualization and AMD's IOMMU
•

•

Processor-Based Virtualization, AMD64 Style, Part I
•

•

http://developer.amd.com/documentation/articles/pages/630200614.aspx

Processor-Based Virtualization, AMD64 Style, Part II
•

•

http://developer.amd.com/documentation/articles/pages/892006101.aspx

http://developer.amd.com/documentation/articles/pages/630200615.aspx

Intel technology Journal, vol 10, issue 3, 2006

Intel virtualization technology: Hardware Support for Efficient processor virtualization
• Intel virtualization technology for Directed I/O
•

•

ARM virtualization Extension Architecture Specification

•

A Comparison of software and hardware techniques for x86 virtualization,Vmware

•

http://www.intel.com/network/connectivity/solutions/vmdc.htm

•

http://www.intel.com/network/connectivity/solutions/vmdq.htm

•

http://software.intel.com/en-us/blogs/2009/09/30/understanding-vt-c-virtualizationtechnology-for-connectivity/

50
References
• Ubuntu 11.10: Xen vs. KVM vs. VirtualBox

http://www.phoronix.com/scan.php?page=article&item=ubuntu_11
10_xenkvm&num=1
• Ubuntu 12.04 KVM/Xen Virtualization: Intel vs. AMD

http://www.phoronix.com/scan.php?page=article&item=ubuntu_12
04_virt&num=1
• Intel Ivy Bridge Linux Virtualization Performance

http://www.phoronix.com/scan.php?page=article&item=intel_iv
y_virtualization&num=5
• http://en.wikipedia.org/wiki/Hypervisor

51
Q&A

52
THANK YOU

53

More Related Content

What's hot (20)

PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
vwchu
 
PDF
XS Oracle 2009 Error Detection
The Linux Foundation
 
PDF
XS Boston 2008 Fault Tolerance
The Linux Foundation
 
PPTX
Cloud.pptm
Mayank Chaudhari
 
PDF
Introduction - vSphere Storage Appliance
Eric Sloof
 
PDF
XS Boston 2008 OVF
The Linux Foundation
 
PPTX
FDM webinar v2.1
Jose Fernando Tucci
 
PDF
ARM Architecture-based System Virtualization: Xen ARM open source software pr...
The Linux Foundation
 
PPTX
Windows Server 2012 Virtualization: Notes from the Field
Microsoft TechNet - Belgium and Luxembourg
 
PDF
Project ACRN hypervisor introduction
Project ACRN
 
PDF
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
Project ACRN
 
PDF
XS Boston 2008 Malware & Training
The Linux Foundation
 
PPTX
Virtualization
Edris Nasihat Kon
 
PPT
Usenix Invited Talk
webhostingguy
 
PDF
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
Project ACRN
 
PDF
Hypervisors
SrikantMishra12
 
PPTX
2014.08.30 Virtual Machine Threat 세미나
용환 노
 
PDF
XPDDS18: The Evolution of Virtualization in the Arm Architecture - Julien Gra...
The Linux Foundation
 
PDF
Xen Memory Management
The Linux Foundation
 
PDF
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
vwchu
 
XS Oracle 2009 Error Detection
The Linux Foundation
 
XS Boston 2008 Fault Tolerance
The Linux Foundation
 
Cloud.pptm
Mayank Chaudhari
 
Introduction - vSphere Storage Appliance
Eric Sloof
 
XS Boston 2008 OVF
The Linux Foundation
 
FDM webinar v2.1
Jose Fernando Tucci
 
ARM Architecture-based System Virtualization: Xen ARM open source software pr...
The Linux Foundation
 
Windows Server 2012 Virtualization: Notes from the Field
Microsoft TechNet - Belgium and Luxembourg
 
Project ACRN hypervisor introduction
Project ACRN
 
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
Project ACRN
 
XS Boston 2008 Malware & Training
The Linux Foundation
 
Virtualization
Edris Nasihat Kon
 
Usenix Invited Talk
webhostingguy
 
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
Project ACRN
 
Hypervisors
SrikantMishra12
 
2014.08.30 Virtual Machine Threat 세미나
용환 노
 
XPDDS18: The Evolution of Virtualization in the Arm Architecture - Julien Gra...
The Linux Foundation
 
Xen Memory Management
The Linux Foundation
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 

Similar to Hardware support for efficient virtualization (20)

PPTX
Virtualization of computing and servers
pooranionline
 
PDF
2virtualizationtechnologyoverview 13540659831745-phpapp02-121127193019-phpapp01
Vietnam Open Infrastructure User Group
 
DOCX
Hardware Support for Efficient VirtualizationJohn Fisher-O
simisterchristen
 
PPTX
Virtualization technolegys for amdocs
Samuel Dratwa
 
PPTX
More on Virtualization 2.pptx
shruti533256
 
PPT
Virtual Pc Seminar
guest5b5549
 
PPTX
Virtualization-Presentation-with-History
Sachin Darekar
 
PDF
VSS-2.pdf
RiyaBatool
 
DOCX
Virtualization for computing servers and cloud
pooranionline
 
PPTX
003-vmm.pptx
TrongMinhHoang1
 
PPT
virtual machine.ppt
SushantShinde74
 
PPTX
Server virtualization
Kingston Smiler
 
PPTX
5. IO virtualization
Hwanju Kim
 
PPTX
Operating system Virtualization_NEW.pptx
Senthil Vit
 
PPT
CC_virtualization is in the cloud UNIT 3.1.ppt
RahulBhole12
 
PDF
Gal Diskin - Virtually Impossible
DefconRussia
 
PPTX
Module_2_Virtualisation and its concepts
NirmalaCR2
 
PDF
blah blah blah blah blah blah blah blah blah blah blah blah
ZiyanMaraikar1
 
PDF
Cloud Computing Virtualization and containers
Selvaraj Kesavan
 
PPT
Unit II.ppt
HARISHK762704
 
Virtualization of computing and servers
pooranionline
 
2virtualizationtechnologyoverview 13540659831745-phpapp02-121127193019-phpapp01
Vietnam Open Infrastructure User Group
 
Hardware Support for Efficient VirtualizationJohn Fisher-O
simisterchristen
 
Virtualization technolegys for amdocs
Samuel Dratwa
 
More on Virtualization 2.pptx
shruti533256
 
Virtual Pc Seminar
guest5b5549
 
Virtualization-Presentation-with-History
Sachin Darekar
 
VSS-2.pdf
RiyaBatool
 
Virtualization for computing servers and cloud
pooranionline
 
003-vmm.pptx
TrongMinhHoang1
 
virtual machine.ppt
SushantShinde74
 
Server virtualization
Kingston Smiler
 
5. IO virtualization
Hwanju Kim
 
Operating system Virtualization_NEW.pptx
Senthil Vit
 
CC_virtualization is in the cloud UNIT 3.1.ppt
RahulBhole12
 
Gal Diskin - Virtually Impossible
DefconRussia
 
Module_2_Virtualisation and its concepts
NirmalaCR2
 
blah blah blah blah blah blah blah blah blah blah blah blah
ZiyanMaraikar1
 
Cloud Computing Virtualization and containers
Selvaraj Kesavan
 
Unit II.ppt
HARISHK762704
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
July Patch Tuesday
Ivanti
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Ad

Hardware support for efficient virtualization

  • 2. Outline • Classifications • Processor virtualization Two main Software-based solutions • Challenges to virtualize Intel x86(software-only) • Hardware-based Virtualization • Intel VT-x : x86 • Intel VT-I :Itanium (X) • Intel EPT/AMD NPT • AMD-V • Sun SPARC (X) • ARM Virtualization Extensions(X) • IBM Power(X) • • I/O virtualization • Intel VT-d • AMD IOMMU(AMD-V) • Intel VT-c • Dose these techniques work? 2
  • 3. Classifications • VMM(virtual machine monitor) = hypervisor • By techniques Full Virtualization • Paravirtualization • Hardware Assisted Virtualization • • Robert P. Goldberg(Harvard University,1973) • Type 1/native/bare metal hypervisors Hypervisors run directly on the host's hardware to control the hardware and to manage guest operating systems. • Oracle VM Server for SPARC, the Citrix XenServer, KVM, VMware ESX/ESXi, and Microsoft Hyper-V hypervisor. • • Type 2/hosted hypervisors Hypervisors run within a conventional operating system environment. • VMware Workstation/player, Microsoft Virtual PC and VirtualBox • 3
  • 6. Two main Software-based solutions(1) • Full virtualization using binary translation • Transforming guest OS binaries on-the-fly • • Guest applications don’t use privilege instructions Pros Support unmodified OSs (The only way of pure-software solutions) • Offer best isolation and security • Simplify migration and portability of guest OS • Cons: low performance • Examples: VMware, MS Virtual PC, Virtual box • • Disable HW virtualization 6
  • 7. Full virtualization using binary translation 7
  • 8. • Two main Software-based OS assisted virtualization or paravirtualization solutions(2) guest OSs help the VMM OS assisted virtualization • • • paravirtualization refers to communication between the guest OS and the VMM to improve performance and efficiency Modify the guest OS to cooperate with the VMM • Modify the OS kernel to replace non-virtualizable instructions with hypercalls(the functions provided by the VMM) Pros: Offer higher performance • Cons: Need the source code of an OS • Example: Xen, KVM(*), VMware(*) • (*) Vmware tool uses some paravirtualization techniques • optimize virtual device drivers • time synchronization • logging and guest shutdown. • Vmxnet is a paravirtualized I/O device driver • 8
  • 9. OS assisted virtualization or paravirtualization 9
  • 11. Challenges to virtualize Intel x86(software-only)(1/3) • Ring Aliasing • Guest-OSes run at the Ring3 • • Original: OS:Ring 0, APP:Ring 3 (Ring0>ring3) A guest OS can know its run level • Address-Space Compression VMM must use some of the guest’s virtual-address space to manage transition between guest OS and VMM • VMM’s address spaces must be protected • • Guest could detect that it is running in a VM 11
  • 12. Challenges to virtualize Intel x86(software-only)(2/3) • Non-Faulting Access to Privileged State • Some instructions should be intercepted by VMM do not involve faults • Adverse Impact on Guest System Calls • VMM must emulate every system calls • Interrupt Virtualization A VMM may manage external interrupts and deny guest to control interrupt masking • Some OS frequently mask and unmask • • VMM must process these requests. 12
  • 13. Challenges to virtualize Intel x86(software-only) (3/3) • Ring Compression • Guest OS runs at the same privilege level as applications • The guest OS can’t protect guest applications • Frequent Access to Privileged Resources • VMM should deny the accesses • Address translation • Guest OS doesn’t know the physical address, so the VMM must intercepted guest page table updates 13
  • 14. Intel VT-x overview(1/4) • VT=virtualization technology • Two new form of CPU operation VMX root operation : for VMM • VMX non-root operation: for guest-software • Both forms of operation support all four privilege levels(Ring0~Ring3) • • Guest OS can run at its intended privilege level 14
  • 15. Two new form of CPU operation 15
  • 16. Intel VT-x overview(2/4) • Two new transitions • VM entry • VMX root operation (VMM) non-root operation(VM) • VM exit • VMX non-root operation (VM) root operation (VMM) • Under VMX non-root operation, many instructions/events cause VM exits • configurable 16
  • 17. Intel VT-x overview(3/4) • VMCS (Virtual Machine Control Structure) A new data structure includes guest-state area and host-state area • VM entry: load the guest-state area and save the host-state area • VM exit : load the host-state area and save the guest-state area • The exiting conditions controlled by the VM-execution fields • Switch the structure will switch the address space • 17
  • 18. Intel VT-x overview(4/4) • VMCS supports interrupt virtualization • Determine the conditions of VM to cause VM exit • • • • • All interrupt Whenever guest OS is ready to receive interrupts Which exception? Which port access attempts? Which Model Specific Register access attempts? 18
  • 19. Intel EPT / AMD NPT(1) • EPT (Extended Page Tables) • • “EPT provides performance gains of up to 48% for MMU-intensive benchmarks and up to 600% for MMU-intensive microbenchmarks.” – VMware AMD’s nested page table (NPT) is similar to EPT • A.k.a Rapid Virtualization Indexing (RVI) • “RVI provides performance gains of up to 42% for MMU-intensive benchmarks and up to 500% for MMU-intensive microbenchmarks.” -VMware 19
  • 20. Intel EPT / AMD NPT(2) • Software MMU (software-only) Hardware uses the shadow page table • VMM must maintain the shadow page table • 20
  • 21. Intelmaintains guest page tables EPT / AMD NPT(3) Guest-OS • Hardware MMU • VMM maintains PPN->MPN mappings in an additional level of page tables • The hardware will find the LPN->MPN with the two pages • 21
  • 22. AMD-V(1/2) • Tagged TLB Add the ASID • Hardware features that facilitate efficient switching between virtual machines for better application responsiveness • • Two new form of CPU operation Host mode : for VMM (similar to Intel’s VMX root operation) • Guest mode : for guest software (similar to Intel’s VMX non-root operation) • new instructions • • • • • vmrun : host mode  guest mode exit : guest mode  host mode vmcall: it lets the operating system and VMM communicate directly A new structure • Virtual Machine Control Block (VMCB) • Similar to Intel’s VMCS 22
  • 23. AMD-V(2/2) • Nested page table (NPT)/ Rapid Virtualization Indexing (RVI) • VMM migration • Use the CPUID to identify the ability of the processor where the VMM runs, and the VMM use the supported functions. 23
  • 24. Hardware-base solution with VTx(1/2) • Address-Space Compression • VM Exits / VM Entries change the linear address space • Ring Aliasing • & Ring Compression VT-x allows guest OS to run at its intended privilege level • Nonfaulting Access to Privileged State Either causes transition to VMM • Or becomes unimportant to VMM • 24
  • 25. Hardware-base solution with VTx(2/2) • Guest System Calls • a guest OS can run at privilege level 0 • Frequent Access to Privileged Resources • VT-x provides TPR shadow. VMM is only involved when the value drops below the threshold VMM only processes the situation it cares. 25
  • 28. Current I/O virtualization techniques • Emulation The VMM supports virtual devices that guest OS can recognize • The virtual device models are responsible to translate commands and data. • Pros. No requirement to modify guest-OSs • Cons. Low performance • • Paravirtualization Modify the guest software (driver)to enhance the performance • Pros. better performance • Cons. Limited applicability. (modify need the source code) • • Direct assignment Bind a specify device to a VM • VMM allow the owning VM to connect directly • Issue command (go) low overhead • DMA? (back) • 28
  • 29. DMA on a virtualizing system • DMA Driver issue a packet consists of command, physical address, etc. • DMA controller read/write data from/to the physical address • Challenge? • A physical address that a Guest-OS knows is not really physical ! • The really physical address space is managed by the VMM • The DMA controller will incorrectly write data to an address. • 29
  • 30. Intel VT-d(1/2) • Need the support of the North bridge • Two functions • Bind devices to a specify VM • • DMA remapping Interrupt virtualization • Interrupt remapping • DMA remapping DVA (DMA Virtual Address), GPA(Guest Physical Address), HPA(Host Physical Address) • A guest-OS issue a DMA request with DVA(=GPA) • The VT-d hardware will translate the DVA to HPA • • The concept: lookup tables 30
  • 32. Intel VT-d (2/2) • Interrupt Remapping • Assign an interrupt attribute • • Destination processor, vector, etc. A VMM enables the interrupt requests from the I/O device to target the physical CPUs running the appropriate virtual CPUs of the legacy VM • AMD IOMMU is similar to Intel VT-d 32
  • 33. Intel VT-c • Virtualization Technology for Connectivity • Virtualization on devices • A collection of technologies that improve the performance of network I/O on a virtualized system • VT-c is comprised of two components • VMDq (Virtual Machine Device Queues) A hardware-base enhancement • Target: throughput • • VMDc (Virtual Machine Direct Connect) Virtualizing physical I/O ports of a network controller into multiple virtual I/O ports, and then to map the virtual ports to individual VMs • Target :VT-x + VT-d + VT-c  nearly native performance • 33
  • 35. 35
  • 38. Ubuntu 11.10: Xen vs. KVM vs. VirtualBox(1) 38
  • 39. Ubuntu 11.10: Xen vs. KVM vs. VirtualBox(2) 39
  • 40. Ubuntu 11.10: Xen vs. KVM vs. VirtualBox(3) 40
  • 41. Ubuntu 12.10: KVM vs. Xen (1) 41
  • 42. Ubuntu 12.10: KVM vs. Xen (2) 42
  • 43. Ubuntu 12.10: KVM vs. Xen (3) 43
  • 44. Ubuntu 12.10: KVM vs. Xen (4) 44
  • 45. Ubuntu 12.04 KVM/Xen Virtualization: Intel vs. AMD(1) • Ubuntu 12.04 LTS, an Intel Core i7 3960X "Sandy Bridge" Extreme Edition and AMD FX-8150 "Bulldozer" systems were used. 45
  • 47. Intel Ivy Bridge Linux Virtualization Performance(1) 47
  • 48. Intel Ivy Bridge Linux Virtualization Performance(2) 48
  • 49. Summarization of Hardware Assisted Virtualization • Hardware provides some mechanisms to reduce overheads of virtualization to improve performance • Pros. The highest performance in theory (a counter example, 2006 VMware) • Support unmodified Oss • Simplify the development of VMM • • Cons. • Need newer processors • Example • KVM(basic requirements) 49
  • 50. References • Performance Evaluation of Intel EPT Hardware Assist, VMware • I/O Virtualization and AMD's IOMMU • • Processor-Based Virtualization, AMD64 Style, Part I • • http://developer.amd.com/documentation/articles/pages/630200614.aspx Processor-Based Virtualization, AMD64 Style, Part II • • http://developer.amd.com/documentation/articles/pages/892006101.aspx http://developer.amd.com/documentation/articles/pages/630200615.aspx Intel technology Journal, vol 10, issue 3, 2006 Intel virtualization technology: Hardware Support for Efficient processor virtualization • Intel virtualization technology for Directed I/O • • ARM virtualization Extension Architecture Specification • A Comparison of software and hardware techniques for x86 virtualization,Vmware • http://www.intel.com/network/connectivity/solutions/vmdc.htm • http://www.intel.com/network/connectivity/solutions/vmdq.htm • http://software.intel.com/en-us/blogs/2009/09/30/understanding-vt-c-virtualizationtechnology-for-connectivity/ 50
  • 51. References • Ubuntu 11.10: Xen vs. KVM vs. VirtualBox http://www.phoronix.com/scan.php?page=article&item=ubuntu_11 10_xenkvm&num=1 • Ubuntu 12.04 KVM/Xen Virtualization: Intel vs. AMD http://www.phoronix.com/scan.php?page=article&item=ubuntu_12 04_virt&num=1 • Intel Ivy Bridge Linux Virtualization Performance http://www.phoronix.com/scan.php?page=article&item=intel_iv y_virtualization&num=5 • http://en.wikipedia.org/wiki/Hypervisor 51

Editor's Notes

  • #8: 按照INTEL的說法GOS該放RING3比較好, Ring Compression
  • #9: Hypercalls不是硬體指令,是VMM開放出來的FUNCTION,供GOS和VMM溝通(*)採用一些優點,但CODE不用改
  • #11: Performance of HW-based is based on techniques in 2006. Now(2012) the performance is improved! Look later slides.
  • #12: Ring AliasingThe problem that arise when software is run at a privilege level other than the privilege level for which it was written
  • #13: Adverse 不利的
  • #14: Ring Compression:Ring 0-2 在記憶體方面是沒區分的,為了保護VMM,GOS也要放RING3
  • #25: Address-Space Compression -VM Exits / VM Entries -> switch VMCS->switch address space
  • #32: Device 1 is binded to domain 1
  • #46: Switching over to the computationally-intensive tests, beginning with Google's libvpx VP8 encoding test