KVM Architecture Overview



Similar documents
The QEMU/KVM Hypervisor

Advanced Computer Networks. Network I/O Virtualization

Virtualization in Linux KVM + QEMU

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

Exploiting The Latest KVM Features For Optimized Virtualized Enterprise Storage Performance

Beyond the Hypervisor

KVM: Kernel-based Virtualization Driver

Architecture of the Kernel-based Virtual Machine (KVM)

Using Linux as Hypervisor with KVM

Nested Virtualization

Enhancing Hypervisor and Cloud Solutions Using Embedded Linux Iisko Lappalainen MontaVista

Assessing the Performance of Virtualization Technologies for NFV: a Preliminary Benchmarking

kvm: Kernel-based Virtual Machine for Linux

Network Virtualization Technologies and their Effect on Performance

KVM Virtualization Roadmap and Technology Update

RPM Brotherhood: KVM VIRTUALIZATION TECHNOLOGY

Real-Time KVM for the Masses Unrestricted Siemens AG All rights reserved

Nested Virtualization

2972 Linux Options and Best Practices for Scaleup Virtualization

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

virtio-vsock Zero-configuration host/guest communication Stefan Hajnoczi KVM Forum 2015 KVM FORUM 2015 STEFAN HAJNOCZI

COS 318: Operating Systems. Virtual Machine Monitors

RCL: Design and Open Specification

KVM in Embedded Requirements, Experiences, Open Challenges

KVM KERNEL BASED VIRTUAL MACHINE

High-performance vnic framework for hypervisor-based NFV with userspace vswitch Yoshihiro Nakajima, Hitoshi Masutani, Hirokazu Takahashi NTT Labs.

KVM on S390x. Revolutionizing the Mainframe

Real-time KVM from the ground up

Enabling Technologies for Distributed Computing

KVM PERFORMANCE IMPROVEMENTS AND OPTIMIZATIONS. Mark Wagner Principal SW Engineer, Red Hat August 14, 2011

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

Red Hat Enterprise Linux 7 Virtualization Getting Started Guide

Virtualization Technologies

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

Virtual Machines. COMP 3361: Operating Systems I Winter

Virtualization. Types of Interfaces

Virtualization. Dr. Yingwu Zhu

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

Enabling Technologies for Distributed and Cloud Computing

Cloud Operating Systems for Servers

RED HAT ENTERPRISE VIRTUALIZATION & CLOUD COMPUTING

Virtualization Technology. Zhiming Shen

Introduction to Virtualization & KVM

Virtualization Performance on SGI UV 2000 using Red Hat Enterprise Linux 6.3 KVM

Virtualization. Pradipta De

Full and Para Virtualization

BHyVe. BSD Hypervisor. Neel Natu Peter Grehan

Virtual device passthrough for high speed VM networking

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

Chapter 5 Cloud Resource Virtualization

IBM. Kernel Virtual Machine (KVM) Best practices for KVM

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

RED HAT ENTERPRISE VIRTUALIZATION

Cloud Computing CS

Performance tuning Xen

FOR SERVERS 2.2: FEATURE matrix

Securing your Virtual Datacenter. Part 1: Preventing, Mitigating Privilege Escalation

Networking for Caribbean Development

Kernel Virtual Machine

Deploy and test ovirt using nested virtualization environments. Mark Wu

KVM Virtualized I/O Performance

Enterprise-Class Virtualization with Open Source Technologies

Date: December 2009 Version: 1.0. How Does Xen Work?

COS 318: Operating Systems. Virtual Machine Monitors

A quantitative comparison between xen and kvm

Chapter 14 Virtual Machines

kvm: the Linux Virtual Machine Monitor

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

Virtualization. Jukka K. Nurminen

Real-Time Virtualization How Crazy Are We?

RED HAT ENTERPRISE VIRTUALIZATION FOR SERVERS: COMPETITIVE FEATURES

Taming Hosted Hypervisors with (Mostly) Deprivileged Execution

RCL: Software Prototype

I/O in Linux Hypervisors and Virtual Machines Lecture for the Embedded Systems Course CSD, University of Crete (May 12 & 14, 2015)

Virtualization for Cloud Computing

Red Hat Linux Internals

Performance Profiling in a Virtualized Environment

RED HAT ENTERPRISE VIRTUALIZATION SCALING UP LOW LATENCY, VIRTUALIZATION, AND LINUX FOR WALL STREET OPERATIONS

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

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

Kernel Optimizations for KVM. Rik van Riel Senior Software Engineer, Red Hat June

Virtualization and Performance NSRC

Module I-7410 Advanced Linux FS-11 Part1: Virtualization with KVM

SUSE Linux uutuudet - kuulumiset SUSECon:sta

How Linux kernel enables MidoNet s overlay networks for virtualized environments. LinuxTag Berlin, May 2014

Hypervisors and Virtual Machines

Multi-core Programming System Overview

Scaling Microsoft Exchange in a Red Hat Enterprise Virtualization Environment

Toward a practical HPC Cloud : Performance tuning of a virtualized HPC cluster

Programmable Networking with Open vswitch

KVM Security Comparison

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

12. Introduction to Virtual Machines

SDN software switch Lagopus and NFV enabled software node

Transcription:

KVM Architecture Overview 2015 Edition Stefan Hajnoczi <stefanha@redhat.com> 1

Introducing KVM virtualization KVM hypervisor runs virtual machines on Linux hosts Mature on x86, recent progress on ARM and ppc Most popular and best supported hypervisor on OpenStack https://wiki.openstack.org/wiki/hypervisorsupportmatrix Built in to Red Hat Enterprise Linux Qumranet startup created KVM, joined Red Hat in 2008 2

Virtualization goals Efficiently and securely running virtual machines on a Linux host Linux, Windows, etc guest operating systems Access to networking and storage in a controlled fashion Linux guest Windows guest Host Net Disk 3

Where does KVM fit into the stack? Management for datacenters and clouds OpenStack RHEV Management for one host Emulation for one guest QEMU libvirt Guest QMP Host hardware access and resource mgmt Host kernel kvm.ko 4

More on QEMU and kvm.ko QEMU Device emulation RAM... QXL gfx card virtio-blk disk Virtualization features Live migration... VNC remote display Storage migration Host kernel Intel VMX Guest/host mode switching In-kernel Device emulation kvm.ko 5

Hardware virtualization support with Intel VMX Allows safe guest code execution at native speed Certain operations trap out to the hypervisor VMXON VMRESUME VMLAUNCH Host mode Guest mode VMEXIT 6

Memory virtualization with Intel EPT Extended Page Tables (EPT) add a level of address translation for guest physical memory. Guest Page Table Guest memory address Host Page Table Physical RAM 7

How QEMU uses kvm.ko QEMU userspace process uses kvm.ko driver to execute guest code: open("/dev/kvm") ioctl(kvm_create_vm) ioctl(kvm_create_vcpu) for (;;) { ioctl(kvm_run) switch (exit_reason) { case KVM_EXIT_IO: /*... */ case KVM_EXIT_HLT: /*... */ } } 8

QEMU process model QEMU is a userspace process Guest RAM Unprivileged and isolated using SELinux for security QEMU Each KVM vcpu is a thread Host kernel Host kernel scheduler decides when vcpus run 9

Linux concepts apply to QEMU/KVM Since QEMU is a userspace process, the usual Linux tools work: ps(1), top(1), etc see QEMU processes and threads tcpdump(8) sees tap network traffic blktrace(8) sees disk I/O requests SystemTap and perf see QEMU activity etc 10

Architecture: Event-driven multi-threaded Event loops are used for timers, file descriptor monitoring, etc Non-blocking I/O Callbacks or coroutines Multi-threaded architecture but with big lock VCPU threads execute in parallel Specific tasks that would block event loop are done in threads, e.g. remote display encoding, RAM live migration work, virtio-blk dataplane, etc Rest of QEMU code runs under global mutex 11

Architecture: Emulated and pass-through devices Guest sees CPU, RAM, disk, etc like on real machines Unmodified operating systems can run Paravirtualized devices for better performance Most devices are emulated and not real Isolation from host for security Sharing of resources between guests Pass-through PCI adapters, disks, etc also possible Dedicated hardware 12

Architecture: Host/guest device emulation split Guest device device model visible to guest rtl8139 Intel e1000 virtio-net Decouples hardware emulation from I/O mechanism tap L2TPv3 socket Host device performs I/O on behalf of guest 13

Architecture: virtio devices KVM implements virtio device models net, blk, scsi, serial, rng, balloon See http://docs.oasis-open.org/virtio/ for specs Open standard for paravirtualized I/O devices Red Hat contributes to Linux and Windows guest drivers 14

Architectural exception: vhost in-kernel devices Most device emulation is best done in userspace Some APIs or performance features only available in host kernel vhost drivers emulate virtio devices in host kernel vhost_net.ko high-performance virtio-net emulation takes advantage of kernel-only zero-copy and interrupt handling features Other devices could be developed in theory, but usually userspace is a better choice 15

Storage in QEMU Block drivers fall in two categories: Formats image file formats (qcow2, vmdk, etc) qcow2 raw raw-posix rbd (Ceph) Protocols I/O transports (POSIX file, rbd/ceph, etc) Plus additional block drivers that interpose like quorum, blkdebug, blkverify 16

Storage stack Application VFS Block layer Format Protocol VFS Block layer Disk Guest application plus full file system and block layer QEMU image format, storage migration, I/O throttling Host full file system and block layer Beware double caching and anticipatory scheduling delays! 17

Walkthrough: virtio-blk disk read request (Part 1) 1. Guest fills in request descriptors 2. Guest writes to virtio-blk virtqueue notify register Request header Data buffer Request footer QEMU Device emulation Guest Guest RAM kvm.ko 18

Walkthrough: virtio-blk disk read request (Part 2) 3. QEMU issues I/O request on behalf of guest QEMU Device emulation Guest Data buffer Linux AIO VFS Block layer kvm.ko Physical disk 19

Walkthrough: virtio-blk disk read request (Part 3) 4. QEMU fills in request footer and injects completion interrupt QEMU Device emulation Guest Request footer Linux AIO VFS Block layer Interrupt kvm.ko Physical disk 20

Walkthrough: virtio-blk disk read request (Part 4) 5. Guest receives interrupt and executes handler 6. Guest reads data from buffer QEMU Guest Interrupt kvm.ko Request header Data buffer Request footer Guest RAM 21

Thank you! Technical discussion: qemu-devel@nongnu.org IRC #qemu on irc.oftc.net #kvm on chat.freenode.net http://qemu-project.org/ http://linux-kvm.org/ More on my blog: http://blog.vmsplice.net/ 22