Nested Virtualization



Similar documents
Intel Virtualization Technology Overview Yu Ke

Virtualization in Linux KVM + QEMU

Virtualization. ! Physical Hardware. ! Software. ! Isolation. ! Software Abstraction. ! Encapsulation. ! Virtualization Layer. !

Full and Para Virtualization

Intel s Virtualization Extensions (VT-x) So you want to build a hypervisor?

Virtualization Technology. Zhiming Shen

Virtual Machines. COMP 3361: Operating Systems I Winter

Hybrid Virtualization The Next Generation of XenLinux

Nested Virtualization

Knut Omang Ifi/Oracle 19 Oct, 2015

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

Chapter 5 Cloud Resource Virtualization

Virtualization VMware Inc. All rights reserved

Virtualization Technologies

Attacking Hypervisors via Firmware and Hardware

Brian Walters VMware Virtual Platform. Linux J. 1999, 63es, Article 6 (July 1999).

Hardware virtualization technology and its security

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

Virtualization. Pradipta De

Attacking Hypervisors via Firmware and Hardware

VMware and CPU Virtualization Technology. Jack Lo Sr. Director, R&D

Virtualization. Types of Interfaces

The Turtles Project: Design and Implementation of Nested Virtualization

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

Virtualization. P. A. Wilsey. The text highlighted in green in these slides contain external hyperlinks. 1 / 16

Advanced Computer Networks. Network I/O Virtualization

Virtualization. Jia Rao Assistant Professor in CS

Virtual machines and operating systems

Nested Virtualization

PCI-SIG SR-IOV Primer. An Introduction to SR-IOV Technology Intel LAN Access Division

Intel Virtualization Technology (VT) in Converged Application Platforms

Intel Virtualization Technology

Intel Virtualization Technology Processor Virtualization Extensions and Intel Trusted execution Technology

Virtual Machine Monitors. Dr. Marc E. Fiuczynski Research Scholar Princeton University

Cloud^H^H^H^H^H Virtualization Technology. Andrew Jones May 2011

CS 695 Topics in Virtualization and Cloud Computing. More Introduction + Processor Virtualization

Architecture of the Kernel-based Virtual Machine (KVM)

Taming Hosted Hypervisors with (Mostly) Deprivileged Execution

Virtualization. Jukka K. Nurminen

Virtual Machines. Virtual Machine (VM) Examples of Virtual Systems. Types of Virtual Machine

COS 318: Operating Systems. Virtual Machine Monitors

Hypervisors and Virtual Machines

Xen and the Art of. Virtualization. Ian Pratt

Understanding Full Virtualization, Paravirtualization, and Hardware Assist. Introduction...1 Overview of x86 Virtualization...2 CPU Virtualization...

x86 Virtualization Hardware Support Pla$orm Virtualiza.on

Hypervisor Memory Forensics

Kernel Virtual Machine

Jukka Ylitalo Tik TKK, April 24, 2006

Hypervisor-Based, Hardware-Assisted System Monitoring

EE282 Lecture 11 Virtualization & Datacenter Introduction

Virtualization. Dr. Yingwu Zhu

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

RPM Brotherhood: KVM VIRTUALIZATION TECHNOLOGY

FRONT FLYLEAF PAGE. This page has been intentionally left blank

ELI: Bare-Metal Performance for I/O Virtualization

KVM Architecture Overview

Cloud Computing CS

ELI: Bare-Metal Performance for I/O Virtualization

Compromise-as-a-Service

Enabling Intel Virtualization Technology Features and Benefits

Machine Virtualization: Efficient Hypervisors, Stealthy Malware

Intel Trusted Platforms Overview

I/O Virtualization Using Mellanox InfiniBand And Channel I/O Virtualization (CIOV) Technology

2972 Linux Options and Best Practices for Scaleup Virtualization

Distributed and Cloud Computing

Virtualization in the ARMv7 Architecture Lecture for the Embedded Systems Course CSD, University of Crete (May 20, 2014)

KVM: A Hypervisor for All Seasons. Avi Kivity avi@qumranet.com

Basics in Energy Information (& Communication) Systems Virtualization / Virtual Machines

AMD 64 Virtualization

The Microsoft Windows Hypervisor High Level Architecture

KVM Security Comparison

COM 444 Cloud Computing

Introduction to Virtual Machines

Virtualization for Cloud Computing

Practical Protection of Kernel Integrity for Commodity OS from Untrusted Extensions

SR-IOV Networking in Xen: Architecture, Design and Implementation Yaozu Dong, Zhao Yu and Greg Rose

CPET 581 Cloud Computing: Technologies and Enterprise IT Strategies. Virtualization of Clusters and Data Centers

Intel Ethernet and Configuring Single Root I/O Virtualization (SR-IOV) on Microsoft* Windows* Server 2012 Hyper-V. Technical Brief v1.

Using Linux as Hypervisor with KVM

Optimizing Network Virtualization in Xen

NoHype: Virtualized Cloud Infrastructure without the Virtualization

A Hypervisor IPS based on Hardware assisted Virtualization Technology

Hardware accelerated Virtualization in the ARM Cortex Processors

Introduction to Virtualization & KVM

WHITE PAPER Mainstreaming Server Virtualization: The Intel Approach

kvm: Kernel-based Virtual Machine for Linux

Distributed Systems. Virtualization. Paul Krzyzanowski

Enterprise-Class Virtualization with Open Source Technologies

The NOVA Microhypervisor

Hypervisors. Introduction. Introduction. Introduction. Introduction. Introduction. Credits:

Chapter 14 Virtual Machines

Bare-Metal Performance for x86 Virtualization

How To Create A Cloud Based System For Aaas (Networking)

Lecture 2 Cloud Computing & Virtualization. Cloud Application Development (SE808, School of Software, Sun Yat-Sen University) Yabo (Arber) Xu

KVM: Kernel-based Virtualization Driver

Cloud Computing #6 - Virtualization

Windows Server Virtualization & The Windows Hypervisor

Virtualization Technology. Zhonghong Ou Data Communications Software Lab, Aalto University

Transcription:

Nested Virtualization Dongxiao Xu, Xiantao Zhang, Yang Zhang May 9, 2013

Agenda Nested Virtualization Overview Dive into Nested Virtualization Details Nested CPU Virtualization Nested MMU Virtualization Nested I/O Virtualization Optimization with Intel HW Feature Nested CPU Virtualization: VMCS shadowing Nested MMU Virtualization: Virtual EPT Nested I/O Virtualization: Virtual VT-d 2

3 Nested Virtualization Overview

What is Nested Virtualization Concept Running virtual machines inside virtual machine Objectives of Nested Virtualization Unmodified Hypervisor/Guest Isolation and security Efficiency in performance Approaches Software Solutions (Para-Virtualization, BT, etc.) Hardware Solution: Nested VMX L2 Guest L2 Guest L1 Hypervisor L0 Hypervisor Hardware L1 Guest 4

Nested Virtualization -- A key feature towards cloud computing Virtualization in daily life Windows 7 compatibility mode Windows 8 with Hyper-V Linux with KVM Run virtualization apps/solutions by cloud user Solution 1: Allocate a physical machine with virtualization capability Solution 2: Nested Virtualization capable VMMs 5

Nested Virtualization Other usage models Hypervisor level of Anti-Virus Facility for investigating VMM behavior New HW feature emulation 6

7 Dive into Nested Virtualization Details

CPU Virtualization Guest vcpu is running privileged instruction Guest traps into VMM by VM exit VMM emulates the instruction on behalf of guest VMM updates guest EIP and goes back to guest Guest vcpu continues running vcpu 8

CPU Virtualization VMX key concepts New running modes: root and non-root modes. The info bag: VMCS (4k page) Saving guest running status Control when guest exists Information exchange Guest VMM: VM Exit Guest traps into VMM context VMM helps to emulate the instruction VMM Guest: VM Entry VMLAUNCH or VMRESUME Returning from VMM back to guest 9

Nested CPU Virtualization Nested virtualization guidelines: L0 emulates virtual VMCS (vmcs12), virtual VM exit and virtual VM entry for L1 VMM so that L1 regards L2 as its guest. L0 provides the actual runtime environment for L2 guest directly by constructing vmcs02 and load it into hardware. L2 Guest L2 Guest vmcs12 vmcs12 L1 Hypervisor L2 Guest L2 Guest vmcs02 vmcs02 L0 Hypervisor L1 Guest Hardware 10

Nested CPU Virtualization Guest vcpu encounters a privileged instruction when running vcpu Guest traps into L0 VMM by VM exit L0 VMM checks the status, prepare the virtual VMCS, and inject the VM entry into L1 VMM L1 VMM emulates this instruction When finished, L1 VMM call VMRESUME trying back to guest L0 VMM get the VM exit (due to VMRESUME executed in non-root mode), and issue real VMRESUME Guest continues to run instructions 11

Nested CPU Virtualization Nested VMX key concepts Virtualize VMCS Shadow VMCS and virtual VMCS Virtualize VMExit Guest trap into L0 VMM L0 inject to L1 VMM Virtualize VMEntry L1 VMM trap into L0 VMM L0 VMM return back to L2 guest 12

MMU Virtualization What memory virtualization needs to do? Present guest OS memory resource it expects Isolate memory among guests/hv from guests Share memory resources whenever possible Guest Pseudo Physical Memory Hypervisor VM1 0 1 2 3 4 VM2 VM3 VM4 Machine Physical Memory 0 4 2 1 3 13

MMU Virtualization Software solution: Shadow Page Tables Utilize the original CPU paging mechanism (CR3). Guest OS maintains gva to gpa mappings. Hypervisor maintains gpa to hpa mappings. Hypervisor establishes shadow page tables (gva hpa). Pros: Support unmodified guests. No specific hardware required. GVA GPA HPA Cons Performance issue (trap guest PT operations, etc). Complex software implementation. CR3 14

MMU Virtualization Hardware solution: Extended Page Tables (EPT) Bring in another paging dimension in hardware. Guest OS maintains gva to gpa mappings, loaded in CR3. Hypervisor maintains gpa to hpa mappings, loaded in EPTP. Pros: Guest owns CR3 page table. Performance is highlight. Simplified software. CR3 EPTP GVA GPA HPA 15

Nested MMU Virtualization Challenges Three dimensions of paging L2 gva L2 gpa L2 gpa L1 gpa L1 gpa L0 hpa CPU only provides two dimension paging with EPT Nested MMU virtualization combinations shadow on shadow shadow on EPT EPT on EPT EPT on shadow (No valuable significance) Shadow Shadow Shadow EPT Legacy Solutions EPT EPT 16

Nested MMU Virtualization Shadow on Shadow Use one dimension page table to emulate three. No specific hardware requirement, can use in old platforms. Performance is not good. L2 GVA L2 GPA L1 GPA L0 HPA SPT12 SPT02, CR3 17

Nested MMU Virtualization Shadow on EPT Use two dimension page tables to emulate three. Need EPT involvement. L2 page faults will trigger a lot of emulation effort. L2 GVA L2 GPA L1 GPA EPTP L0 HPA SPT12, CR3 18

I/O Virtualization Software communicate with device Port I/O MMIO Device transfer data to and from system memory DMA access Events notification from device Interrupt Device discovery and configuration Configuration space access in PCI device Processor Interrupt I/O System Memory DMA Device 19

I/O Virtualization Software solution: Device emulation Maintain same SW interface (I/O, MMIO, INTR, DMA) Use arbitrary media to emulate virtualized device Pros Transparent to VM software stack Agnostic to physical device in the platform. Thus Legacy SW can still run, even after HW upgrade Smooth VM migration across different platforms Good physical device sharing Cons Un-optimum performance Cannot enjoy latest & greatest HW Lack of modern device emulation, since too complex Poor scalability Isolation and stability depends on implementation Device Model IRQ Driver Device Emul VM Exit Virtual Interrupt Apps Native Driver I/O IRQ Hypervisor Hardware 20

I/O Virtualization Software solution: Para-virtualized I/O VMM presents a specialized virtual device to VM A new & efficient interface between VMM & VM driver Usually high-level abstraction Requires a specialized driver in VM Pros Better performance Agnostic to physical device in the platform Legacy SW can still run, even after HW upgrade Smooth VM migration across different platforms Good physical device sharing Cons Need install specialized driver in VM High CPU utilization (I/O interface and memory copy) Not so good scalability because of CPU utilization Backend Driver Driver Device Share Memory Hypercalls Notifications Apps Frontend Driver VMM Hardware 21

I/O Virtualization Hardware solution: VT-d Assign a physical device to a VM directly VM access the device directly, w/ VMM intervention reduced to minimum Physical device access guest s memory directly with help of Intel s VT-d technology Native Driver I/O Apps IRQ Pros Near-to-native performance Minimum VMM intervention, thus low CPU utilization Good isolation Cons Exclusive device access PCI slots in system is limited (SR-IOV) Device VMM Hardware 22

Nested I/O Virtualization Nested I/O Virtualization Combinations: L2 software emulation + L1 software emulation L2 software emulation + L1 PV L2 software emulation + L1 VT-d L2 PV + L1 software emulation L2 PV + L1 PV L2 PV + L1 VT-d Mixed Pros and Cons But, still need software intercept. 23

24 Optimizations with Intel HW Feature

Nested CPU Optimization: Reduce VM Exits L1VMM operates VMCS in non-root mode VM exit will be triggered to emulate the non-root VMREAD/VMWRITE For a single virtual VM exit, L1 will trigger ~20 VMREAD/VMWRITE. Goal: Reduce heavy VM exits due to non-root VMREAD/VMWRITE 25

26 Nested CPU Optimization: Ideal Case

Nested CPU Optimization: VMCS Shadowing Hardware assisted non-root VMREAD/VMWRITE Shadow VMCS is linked to L1 s VMCS by VMCS Link Pointer No VMExit happened for non-root VMREAD/VMWRITE L2 VMREAD VMWRITE Shadow VMCS L1 VMCS01 VMCS Link Pointer L0 27

Nested MMU Optimization EPT on EPT Use two dimension page tables to emulate three. Need EPT involvement. L2 fully owns its page tables. Best performance among the three solutions. CR3 L2 GVA L2 GPA L1 GPA L0 HPA EPT02, EPTP 28

Virtual EPT Architecture L2 Guest VM entry/exit Virtual VM entry/exit L1 VMM vmcs12 EPT12 L2 GPA L1 GPA Shadowing Shadowing L0 VMM vmcs02 EPT02 vmcs01 EPT01 L2 GPA L0 HPA L1 GPA L0 HPA 29

Virtual EPT Performance 1.2 1 0.8 0.6 0.4 0.2 0 L2 w/o optimization L2 w/ vept L1 30

Nested I/O Optimization: I/O performance for L2 guest is very slow Due to extremely long device emulation path through all the way to L1 & L0 VMMs How to fix that? Present virtual VT-d engine to L1 VMM Device can be directly assigned to L2 guest High I/O performance, because of minimum VMM intervention. Must-to-have features in Virtual VT-d DMA Remapping & Queue Invalidation: Exposed Interrupt remapping: Not Exposed 31

Virtual VT-d Architecture L2 Guest Guest view of VT-d Bus 0 DevQ,Funy DevP,Funn L1 VMM VT-d page table Device Bus 0 Virtual VT-d vdmar vqi Shadowing Dev M FunN Bus N L0 VMM Shadow VT-d page table 32

Mb/s Performance Evaluation of virtual VT-d 1100 1000 900 800 700 600 500 400 300 200 100 0 Bandwidth of Nested Guest Ideal Bandwidth TCP Send TCP Receive UDP Send UDP Receive Iperf testing with the assigned NIC to nested Guest Bandwidth is good enough! 33

Thank You! Q & A? 34