Hardware-assisted Virtualization

Slides:



Advertisements
Similar presentations
Chapter 1 The Study of Body Function Image PowerPoint
Advertisements

1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Virtual Memory Basics.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
So far Binary numbers Logic gates Digital circuits process data using gates – Half and full adder Data storage – Electronic memory – Magnetic memory –
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
SE-292 High Performance Computing
Chapter 5 : Memory Management
Debugging operating systems with time-traveling virtual machines Sam King George Dunlap Peter Chen CoVirt Project, University of Michigan.
CS136, Advanced Architecture
Redesigning Xen Memory Sharing (Grant) Mechanism Kaushik Kumar Ram (Rice University) Jose Renato Santos (HP Labs) Yoshio Turner (HP Labs) Alan L. Cox (Rice.
Chapter 4 Memory Management Basic memory management Swapping
Project 5: Virtual Memory
Memory.
虛擬化技術 Virtualization Technique
Memory Management Unit
1 Overview Assignment 4: hints Memory management Assignment 3: solution.
Chapter 3 Memory Management
Chapter 10: Virtual Memory
Memory Management.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a cache for secondary (disk) storage – Managed jointly.
© 2010 VMware Inc. All rights reserved Application-level mobile virtualization Harvey Tuch, Staff Engineer, Mobile Virtualization Platform January 25 th.
Virtualization Technology
EUROSEC 2011 Gábor Pék, Boldizsár Bencsáth and Levente Buttyán Laboratory of Cryptography and Systems Security Budapest University of Technology and Economics.
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Squares and Square Root WALK. Solve each problem REVIEW:
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
© 2012 National Heart Foundation of Australia. Slide 2.
Chapter 5 Test Review Sections 5-1 through 5-4.
25 seconds left…...
SE-292 High Performance Computing
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
SE-292 High Performance Computing Memory Hierarchy R. Govindarajan
PSSA Preparation.
Hardware Assisted Virtualization
E Virtual Machines Lecture 3 Memory Virtualization
Disco Running Commodity Operating Systems on Scalable Multiprocessors.
Translation Buffers (TLB’s)
Xen and the Art of Virtualization. Introduction  Challenges to build virtual machines Performance isolation  Scheduling priority  Memory demand  Network.
虛擬化技術 Virtualization and Virtual Machines
© 2010 VMware Inc. All rights reserved Virtualization Based on materials from: Introduction to Virtual Machines by Carl Waldspurger Understanding Intel®
Virtualization-optimized architectures
Tanenbaum 8.3 See references
Computer Architecture Lecture 28 Fasih ur Rehman.
CS533 Concepts of Operating Systems Jonathan Walpole.
System Virtualization 1 Learning Objective: –To understand the implementation choices and details of System Virtualization COMP
Disco: Running Commodity Operating Systems on Scalable Multiprocessors Edouard et al. Madhura S Rama.
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
Full and Para Virtualization
Lecture 12 Virtualization Overview 1 Dec. 1, 2015 Prof. Kyu Ho Park “Understanding Full Virtualization, Paravirtualization, and Hardware Assist”, White.
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts.
Extending Xen * with Intel ® Virtualization Technology Mobile Embedded System Choi, Jin-yong
CS 140 Lecture Notes: Virtual MachinesSlide 1 Process Abstraction Instruction Set Registers MMU I/O Devices Physical Memory Virtual Memory System Calls.
Running Commodity Operating Systems on Scalable Multiprocessors Edouard Bugnion, Scott Devine and Mendel Rosenblum Presentation by Mark Smith.
CS 695 Topics in Virtualization and Cloud Computing, Autumn 2012 CS 695 Topics in Virtualization and Cloud Computing More Introduction + Processor Virtualization.
Virtualization-optimized architectures
Advanced Operating Systems (CS 202) Virtualization
CS 140 Lecture Notes: Virtual Machines
OS Virtualization.
CS 140 Lecture Notes: Virtual Machines
Translation Buffers (TLB’s)
Translation Buffers (TLB’s)
CS 140 Lecture Notes: Virtual Machines
Translation Buffers (TLBs)
Review What are the advantages/disadvantages of pages versus segments?
Presentation transcript:

Hardware-assisted Virtualization 15-612 Operating System Practicum Carnegie Mellon University Pratik Shah (pcshah) Rohan Patil (rspatil)

Agenda Introduction to VT-x CPU virtualization with VT-x VMX VMX Transitions Virtual Machine Control Structure (VMCS) MMU Virtualization with VT-x Virtual Processor IDentifier (VPID) Sidebar: Virtualizing memory in software Nested / Extended Page Tables (EPT) References Q & A

VT-x Intel Vanderpool Technology, referred to as VT-x, represents Intel’s virtualization technology on the x86 platform.

VT-x : Motivation To solve the problem that the x86 instructions architecture cannot be virtualized. Simplify VMM software by closing virtualization holes by design. Ring Compression Non-trapping instructions Excessive trapping Eliminate need for software virtualization (i.e paravirtualization, binary translation).

CPU Virtualization with VT-x

VMX Eliminate de-privileging of Ring for guest OS. Virtual Machine Extensions define processor-level support for virtual machines on the x86 platform by a new form of operation called VMX operation. Kinds of VMX operation: root: VMM runs in VMX root operation non-root: Guest runs in VMX non-root operation Eliminate de-privileging of Ring for guest OS.

Pre VT-x Post VT-x VMM ring de-privileging of guest OS VMM executes in VMX root-mode Guest OS aware its not at Ring 0 Guest OS de-privileging eliminated Guest OS runs directly on hardware Source: [2]

VMX Transitions Transitions between VMX root operation and VMX non-root operation. Kinds of VMX transitions: VM Entry: Transitions into VMX non-root operation. VM Exit: Transitions from VMX non-root operation to VMX root operation. Registers and address space swapped in one atomic operation.

VMX Transitions VM 1 VM 2 VM n VMX Non-Root Operation Ring 3 Ring 3 VM Entry VMCS 1 VMCS 2 VMCS n VM Exit Ring 3 VMX Root Operation Ring 0 vmlaunch / vmresume VMX Transitions

VMCS: VM Control Structure Data structure to manage VMX non-root operation and VMX transitions. Specifies guest OS state. Configured by VMM. Controls when VM exits occur.

VMCS: VM Control Structure The VMCS consists of six logical groups: Guest-state area: Processor state saved into the guest-state area on VM exits and loaded on VM entries. Host-state area: Processor state loaded from the host-state area on VM exits. VM-execution control fields: Fields controlling processor operation in VMX non-root operation. VM-exit control fields: Fields that control VM exits. VM-entry control fields: Fields that control VM entries. VM-exit information fields: Read-only fields to receive information on VM exits describing the cause and the nature of the VM exit.

CPU Virtualization with VT-x Source: [2]

MMU Virtualization with VT-x

VPID: Motivation First generation VT-x forces TLB flush on each VMX transition. Performance loss on all VM exits. Performance loss on most VM entries Guest page tables not modified always Better VMM software control of TLB flushes is beneficial.

VPID: Virtual Processor Identifier 16-bit virtual-processor-ID field in the VMCS. Cached linear translations tagged with VPID value. No flush of TLBs on VM entry or VM exit if VPID active. TLB entries of different virtual machines can all co-exist in the TLB.

Virtualizing Memory in Software Three abstractions of memory: 4GB Current Guest Process Guest OS Virtual Address Spaces 4GB Virtual RAM Virtual Frame Buffer Virtual Devices Virtual ROM Physical Address Spaces 4GB RAM Devices Frame Buffer ROM Machine Address Space Source: [6]

Shadow Page Tables VMM maintains shadow page tables that map guest-virtual pages directly to machine pages. Guest modifications to V->P tables synced to VMM V->M shadow page tables. Guest OS page tables marked as read-only. Modifications of page tables by guest OS -> trapped to VMM. Shadow page tables synced to the guest OS tables

Set CR3 by guest OS (1) Guest Guest Guest Shadow Shadow Shadow Page Table Guest Page Table Guest Page Table Virtual CR3 Real CR3 Shadow Page Table Shadow Page Table Shadow Page Table Set CR3 by guest OS (1) Source: [6]

Set CR3 by guest OS (2) Guest Guest Guest Shadow Shadow Shadow Page Table Guest Page Table Guest Page Table Virtual CR3 Real CR3 Shadow Page Table Shadow Page Table Shadow Page Table Set CR3 by guest OS (2) Source: [6]

Drawbacks: Shadow Page Tables Maintaining consistency between guest page tables and shadow page tables leads to an overhead: VMM traps Loss of performance due to TLB flush on every “world-switch”. Memory overhead due to shadow copying of guest page tables.

Nested / Extended Page Tables Extended page-table mechanism (EPT) used to support the virtualization of physical memory. Translates the guest-physical addresses used in VMX non-root operation. Guest-physical addresses are translated by traversing a set of EPT paging structures to produce physical addresses that are used to access memory.

Nested / Extended Page Tables Source: [2]

Nested / Extended Page Tables Source: [4]

Advantages: EPT Simplified VMM design. Guest page table modifications need not be trapped, hence VM exits reduced. Reduced memory footprint compared to shadow page table algorithms.

Disadvantages: EPT TLB miss is very costly since guest-physical address to machine address needs an extra EPT walk for each stage of guest-virtual address translation.

References Intel 64 and IA-32 Architectures Software Developer’s Manual (Volume 3C, Part 3) http://download.intel.com/products/processor/manual/326019.pdf Intel Virtualization Technology Processor Virtualization Extensions and Intel Trusted execution Technology repo.meh.or.id/Todo/virtualization.pdf Intel Virtualization Technology Primer by Rich Uhlig software.intel.com/file/26677 Hardware Virtualization blogs by Johan De Gelas at AnandTech http://www.anandtech.com/show/2480/9 http://www.anandtech.com/show/2480/10 Performance Evaluation of Intel EPT Hardware Assist http://www.vmware.com/pdf/Perf_ESX_Intel-EPT-eval.pdf Memory Virtualization by Scott Devine, VMware Labs labs.vmware.com/download/46/‎

Questions

Thank You