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



Similar documents
Virtualization in Linux KVM + QEMU

Full and Para Virtualization

Virtual machines and operating systems

Virtual Machines. COMP 3361: Operating Systems I Winter

Hybrid Virtualization The Next Generation of XenLinux

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

Nested Virtualization

Intel Virtualization Technology Overview Yu Ke

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

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

Hardware Assisted Virtualization Intel Virtualization Technology

matasano Hardware Virtualization Rootkits Dino A. Dai Zovi

Virtualization. Explain how today s virtualization movement is actually a reinvention

Kernel Virtual Machine

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

Virtualization. Pradipta De

Jukka Ylitalo Tik TKK, April 24, 2006

Virtualization. Clothing the Wolf in Wool. Wednesday, April 17, 13

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

Virtualization Technology. Zhiming Shen

The Microsoft Windows Hypervisor High Level Architecture

Virtualization. Types of Interfaces

Intel Virtualization Technology and Extensions

Chapter 5 Cloud Resource Virtualization

Virtualization Technologies

Intel Vanderpool Technology for IA-32 Processors (VT-x) Preliminary Specification

Intel Virtualization Technology Specification for the IA-32 Intel Architecture

COS 318: Operating Systems. Virtual Machine Monitors

COS 318: Operating Systems. Virtual Machine Monitors

WHITE PAPER. AMD-V Nested Paging. AMD-V Nested Paging. Issue Date: July, 2008 Revision: 1.0. Advanced Micro Devices, Inc.

Architecture of the Kernel-based Virtual Machine (KVM)

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

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

Hypervisors and Virtual Machines

Virtualization. Jia Rao Assistant Professor in CS

Virtualization VMware Inc. All rights reserved

Virtualization. Dr. Yingwu Zhu

Xen and the Art of. Virtualization. Ian Pratt

Nested Virtualization

Distributed Systems. Virtualization. Paul Krzyzanowski

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

OSes. Arvind Seshadri Mark Luk Ning Qu Adrian Perrig SOSP2007. CyLab of CMU. SecVisor: A Tiny Hypervisor to Provide

Hardware virtualization technology and its security

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

System Virtual Machines

The QEMU/KVM Hypervisor

Chapter 16: Virtual Machines. Operating System Concepts 9 th Edition

Using Linux as Hypervisor with KVM

A Hypervisor IPS based on Hardware assisted Virtualization Technology

FRONT FLYLEAF PAGE. This page has been intentionally left blank

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

Intel Virtualization Technology Processor Virtualization Extensions and Intel Trusted execution Technology

x86 Virtualization Hardware Support Pla$orm Virtualiza.on

OS Virtualization. CSC 456 Final Presentation Brandon D. Shroyer

The Xen of Virtualization

Nested Virtualization

Implementation of a Purely Hardware-assisted VMM for x86 Architecture

kvm: Kernel-based Virtual Machine for Linux

Enabling Technologies for Distributed Computing

IOS110. Virtualization 5/27/2014 1

kvm: the Linux Virtual Machine Monitor

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

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

BHyVe. BSD Hypervisor. Neel Natu Peter Grehan

ELI: Bare-Metal Performance for I/O Virtualization

Knut Omang Ifi/Oracle 19 Oct, 2015

Virtualization. Jukka K. Nurminen

Beyond the Hypervisor

Volume 10 Issue 03 Published, August 10, 2006 ISSN X DOI: /itj Virtualization Technology

Performance tuning Xen

Lecture 17: Virtual Memory II. Goals of virtual memory

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

Enabling Technologies for Distributed and Cloud Computing

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

Outline. Outline. Why virtualization? Why not virtualize? Today s data center. Cloud computing. Virtual resource pool

COM 444 Cloud Computing

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Cloud Computing #6 - Virtualization

Basics of Virtualisation

Cloud Computing CS

Outline: Operating Systems

Intel Virtualization Technology (VT) in Converged Application Platforms

Clouds, Virtualization and Security or Look Out Below

ELEC 377. Operating Systems. Week 1 Class 3

A Unified View of Virtual Machines

Tracing Kernel Virtual Machines (KVM) and Linux Containers (LXC)

CHAPTER 6 TASK MANAGEMENT

The NOVA Microhypervisor

Virtualization for Cloud Computing

Virtual Machines Fact Sheet

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

Multi-core Programming System Overview

Taming Hosted Hypervisors with (Mostly) Deprivileged Execution

Introduction to Virtual Machines

Transcription:

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

Paravirtualization: Xen

Full virtualization Complete illusion of physical hardware Trap _all_ sensitive instructions Virtualized OS PTE update (mov) Example: page table update Hypervisor

Full virtualization Complete illusion of physical hardware Trap _all_ sensitive instructions Example: page table update Virtualized OS PTE update (mov) Trap Hypervisor

Full virtualization Complete illusion of physical hardware Trap _all_ sensitive instructions Example: page table update Traps are slow Binary translation is faster, for some events Not for PTE updates, why? Virtualized OS PTE update (mov) Next instruction Trap Hypervisor if (safe) { update_pte(); emulate_mov(); }

Performance problems Traps are slow Binary translation is faster For some events Not for PTE updates, why? Virtualized OS PTE update (mov) Next instruction Trap Hypervisor if (safe) { update_pte(); emulate_mov(); }

Paravirtualization No illusion of hardware Instead: paravirtualized interface Explicit hypervisor calls to update sensitive state Page tables, interrupt flag But Guest OS needs porting Applications run natively in Ring 3

Paravirtualization Paravirtualized OS PTE update Batch updates update 1 update 2 Invoke hypervisor Hypervisor if (safe) update

Xen

Segmentation and paging

Hypervisor protection

Hardware support for virtualization: KVM

Basic idea Guest instruction stream VM Entry VMCS Guest State Host instruction stream Host State VM Exit

New mode of operation:vmx root VMX root operation 4 privilege levels VMX non-root operation 4 privilege levels as well, but unable to invoke VMX root instructions Guest runs until it performs exception causing it to exit Rich set of exit events Guest state and exit reason are stored in VMCS

Virtual machine control structure (VMCS) Guest State Loaded on entries Saved on exits Host State Saved on entries Loaded on exits Control fields Execution control, exits control, entries control

Guest state Register state Non-register state Activity state: active inactive (HLT, Shutdown, wait for Startup IPI interprocessor interrupt)) Interruptibility state

Host state Only register state ALU registers, also: Base page table address (CR3) Segment selectors Global descriptors table Interrupt descriptors table

VM-execution controls (asynchronous events control) External interrupts (maskable or IRQs) cause exits(yes/no) If not, then they delivered through guest IDT Bit 31 Bit 0 Reserved NMI cause exits (yes/no) If not, then they are delivered normally through guest IDT (descriptor 2)

VM-execution controls HLT PAUSE INVLPG Unconditional I/O Reserved MONITOR Bit 31 Activate I/O bitmaps (synchronous events control, not all reasons are shown) Bit 0

Exception bitmap (one for each of 32 IA-32 exceptions) IA-32 defines 32 exception vectors (interrupts 0-31) Each of them is configured to cause or not VM-exit Bit 31 Bit 0 14 page fault

I/O Bitmaps Two addresses on 4KB memory areas (A and B) A B Safe I/O addresses (not causing exits)

Exit information Information describing conditions of VM-exit is saved in VMCS It's different for different types of event

KVM

Memory virtualization: brute force. Write / read protected page table area. Every access results in VM-Exit and passes control to hypervisor Helper structures describe actual guest VM layout Guest PD CR3 PT Hypervisor TLB Hardware CPU stores pointer on guest page table directory Maintained for each guest. On VM-Exit hypervisor adjusts guest page accordingly.

Memory virtualization: shadow page tables Guest page table hierarchy It's writable, but can be inconsistent with active page table hierarchy stored by the hypervisor Active page table hierarchy Guest PD CR3 VMM maintains it for each VM that it supports PT TLB PD PT Hardware CPU stores pointer on active page table hierarchy. On Intel CPUs TLB is always refilled from active page table directory

Nested page tables 0 paged by gcr3 Guest Virtual gcr3 0 gpt Guest Physical Translation can be cached in TLB paged by hcr3 hcr3 VMM Host Virtual paged by CR3 0 hpt gpt Host Physical PT CR3 used by VMM

Page table lookup 4-level page table

Nested page table lookup

Efficient I/O

Where is the bottleneck What is the bottleneck in case of virtualization? CPU? CPU bound workloads execute natively on the real CPU Sometimes JIT compilation (binary translation makes them even faster [Dynamo] Everything what is inside VM is fast! What is the most frequent operation disturbing execution of VM? Device I/O! Disk, Network, Graphics

Virtual devices in Xen 31

Virtual devices in Xen 32

Virtual devices in Xen 33

Virtual devices in Xen 34

Virtual devices in Xen 35

How to make the I/O fast? Take into account specifics of the devicedriver communication Bulk Session oriented Connection is established once (during boot) No short IPCs, like function calls Costs of establishing an IPC channel are irrelevant Throughput oriented Large packets (512B 4K) Devices have high delays anyway Asynchronous Again, no function calls, devices are already asynchronous

Shared rings and events

Shared rings

Shared rings

Shared rings

Shared rings

Where is a performance bottleneck here?

Eliminate cache thrashing

GPUs Sending frames from the framebuffer No hardware acceleration Too slow OpenGL/DirectX level virtualization Send high-level OpenGL commands over rings OpenGL operations will be executed on the real GPU

Devices supporting virtualization

Some VM tricks: suspend/resume, checkpoints migration

Suspend

Resume

Checkpoints Checkpoints are almost suspend/resume Except that a copy of the entire VM s state has to be saved Memory Disk OK, it s relatively small 128MB-4GB Problem: disks are huge 100GB-1TB How to save storage efficiently?

Branching storage

Branching storage: snapshot

Branching storage: writes

Branching storage: snapshot

Migration Migration is essentially a live checkpoint between machines The goal: minimal downtime How to make the checkpoint faster?

Migration: memory

Migration: memory

Migration: memory

Migration: memory

Migration: storage

Migration

References Intel 64 and IA-32 Architectures Software Developer's Manual. Volume 3C: System Programming Guide, Part 3 Ravi Bhargava, Benjamin Serebrin, Francesco Spadini, and Srilatha Manne. Accelerating twodimensional page walks for virtualized systems. In ASPLOS'08.