Xen and the Art of Virtualization

Slides:



Advertisements
Similar presentations
Virtualization Technology
Advertisements

XEN AND THE ART OF VIRTUALIZATION Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, lan Pratt, Andrew Warfield.
Embedded System Lab. Yoon Jun Kee Xen and the Art of Virtualization.
Bart Miller. Outline Definition and goals Paravirtualization System Architecture The Virtual Machine Interface Memory Management CPU Device I/O Network,
G Robert Grimm New York University Disco.
Xen and the Art of Virtualization A paper from the University of Cambridge, presented by Charlie Schluting For CS533 at Portland State University.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
Computer Organization and Architecture
Virtual Machine Monitors CSE451 Andrew Whitaker. Hardware Virtualization Running multiple operating systems on a single physical machine Examples:  VMWare,
Xen and the Art of Virtualization Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt, Andrew Warfield.
Xen and the Art of Virtualization. Introduction  Challenges to build virtual machines Performance isolation  Scheduling priority  Memory demand  Network.
Xen and the Art of Virtualization Paul Barham*, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauery, Ian Pratt, Andrew Wareld.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Virtualization Technology Prof D M Dhamdhere CSE Department IIT Bombay Moving towards Virtualization… Department of Computer Science and Engineering, IIT.
Tanenbaum 8.3 See references
Zen and the Art of Virtualization Paul Barham, et al. University of Cambridge, Microsoft Research Cambridge Published by ACM SOSP’03 Presented by Tina.
Virtual Machines Xen and Terra Rajan Palanivel. Xen and Terra : Papers Xen and the art of virtualization. -Univ. of Cambridge Terra: A VM based platform.
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
CS533 Concepts of Operating Systems Jonathan Walpole.
Benefits: Increased server utilization Reduced IT TCO Improved IT agility.
Xen I/O Overview. Xen is a popular open-source x86 virtual machine monitor – full-virtualization – para-virtualization para-virtualization as a more efficient.
Xen and the Art of Virtualization Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt & Andrew Warfield.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Xen and The Art of Virtualization Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris, Alex Ho, Rolf Neugebauer, Ian Pratt & Andrew Warfield.
CS533 Concepts of Operating Systems Jonathan Walpole.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Introduction to virtualization
Full and Para Virtualization
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
OS Structures - Xen. Xen Key points Goal: extensibility akin to SPIN and Exokernel goals Main difference: support running several commodity operating.
Advanced Operating Systems (CS 202) Virtualization March 7, 2016.
Xen and the Art of Virtualization
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
Virtualization.
Virtual Machine Monitors
Advanced Operating Systems (CS 202) Virtualization
Virtualization Technology
Presented by Yoon-Soo Lee
ECE232: Hardware Organization and Design
CS161 – Design and Architecture of Computer
CSE 120 Principles of Operating
CS352H: Computer Systems Architecture
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Xen: The Art of Virtualization
Morgan Kaufmann Publishers Large and Fast: Exploiting Memory Hierarchy
OS Virtualization.
Virtualization Techniques
Direct Memory Access Disk and Network transfers: awkward timing:
Xen and the Art of Virtualization
Translation Lookaside Buffer
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Xen and the Art of Virtualization
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Cache writes and examples
System Virtualization
Presentation transcript:

Xen and the Art of Virtualization CSE-291 (Cloud Computing) Fall 2016

Why Virtualization? Share resources among many uses Allow heterogeneity in environments Allow differences in host and guest Provide a mechanism for migration, checkpointing, etc Recovery, maintenance Provide for elasticity

Challenges to Virtualization Isolation Performance w.r.t. resource sharing (CPU, memory, network, disk) Protection w.r.t. resource use Support multiple operating systems Minimal performance penalty

Granularity Multiplex processes Multiplex OSes Finely grained, but forces symmetric execution environment Multiplex OSes Allows heterogeneous environments High overhead of OS, runtime wastage and start-up latency

Full Virtualization Can be expensive Time might not be a resource that it is desirable to virtualize Timeouts, etc Real network addresses allow better integration with real-world Much easier with hardware support

Paravirtualization “Good enough” virtualization Very similar to fully virtualized machine, but some differences that can be leveraged by knowledgeable OS OS needs to be tweaked Apps do not need to be changed

Xen Design Principles Support for unmodified application binaries is essential, or users will not transition to Xen. Hence we must virtualize all architectural features required by existing standard ABIs. Supporting full multi-application operating systems is important, as this allows complex server configurations to be virtualized within a single guest OS instance. Paravirtualization is necessary to obtain high performance and strong resource isolation on uncooperative machine architectures such as x86. Even on cooperative machine architectures, completely hiding the effects of resource virtualization from guest OSes risks both correctness and performance

Memory Management: Hardware Support Hardware Support: Software Managed TLB (Not available on x86) Easiest option Not available on x86 Hardware Support: Tagged TLB (Not available on x86) Use one tag per address space Also a good option x86 Hardware managed page table Flushed upon context switch

Virtualizing Memory Management On x86 Implication: All valid page translations must be in page table Guest OSes allocate and manage page tables Xen needs to be mapped into all address spaces, so entering and leaving it doesn’t require a flush or load. But protected from Guest OS Guest OS allocates pages from own memory, but asks Xen to map it Xen can validate/protect page tables OS can batch updates for performance (amortize hypervisor overhead)

Virtualizing CPU: Privlege In model with only two privilege levels, hypervisor would need to be at OS’s normal level of privilege OS would need to run at app level, in its own context Hypervisor would need to handle transitions, setting page tables, etc Insert whole discussion about TLBs here X86 supports 4 privilege levels (“rings”) 0 normally for OS, 3 normally for apps With Xen, Xen uses Ring-0, OS uses Ring-1 Isolates OS from Apps Ensures only Xen can run privileged instructions

Virtualizing CPU: Privileged Instructions Paravirtualized Instructions Validated and executed within Xen (Ring-0) Processor fails or faults attempts other than from Ring-0 Guest OS can’t directly execute Exceptions (Faults, Traps, etc) Handled by Xen, which copies exception frame to Guest OS Adjustment needed for page fault handler, since OS can’t read address from CR2 register Xen copies to an extended stack frame. OS Needs to be modified to look there.

SysCalls and Page Faults Common enough to affect performance Syscalls Guests register “fast interrupt handler” (top half) Validated by Xen for install Page Faults Can’t be optimized. Address is in CR2 and needs to be propagated by Xen

Device I/O Fully abstracted by Xen Simple interface Shared memory ring-buffers Callbacks via bit-maps replace interrupts Xen flips bit and calling Guest OS event handler Can also be blocked by OS

The Paravirtualized X86 Interface

Overall Structure

Control and Management Separation of Policy and Mechanism Xen exports interfaces Domain-0 created at boot time Able to create new domains Creates and deletes virtual network and block devices and associated access controls Manages the resources associated with each domain Guest OSes use interfaces to manage resources Exports application management interface Manage all of the resources

Hypercalls and Events Hypercall Events Synchronous calls from domain into Xen Basically a trap into the hypervisor, e.g. to request page table updates Events Notifications to domain from Xen, e.g. to replace interrupts Per domain bitmask is updated, followed by notification

Data Transfer: I/O Rings Circular ring Allocated by domain Accessible by Xen 2 pairs of producer-consumer pointers

CPU Scheduling Schedule domains via Borrowed Virtual Time (BVT) Balances context switches, dispatch time, and fairness Borrows from future time to allow warm threads to favor recently woken domains

Time and Timers Real time Virtual time Wall-clock time Seconds since machine’s boot to the accuracy of processor’s cycle counter Virtual time Advances only when VM is running Wall-clock time Real time plus offset Allows adjustment to real-time, without messing it up

Physical Memory Memory is statically partitioned to domains Memory can later be released Virtualized physical pages need to be mapped to physical pages for page tables Xen provides this via a globally readable array Can also be used to optimize for cache locality, etc.

Network Provides Virtual Firewall Router (VFR) Each domain has one or more Virtual Network Interfaces (VIF) attached to VFR Each VIF has two rings of buffer descriptors: transmit and receive Rules managed by Domain-0 Transmit: Enqueue packet descriptor Packet payload via scatter-gather DMA Simple round-robin packet scheduler Receive: Exchange packet-buffer for empty frame on ring

Disk Only Domain-0 can access the actual disks Disks are represented as Virtual Block Devices (VBDs) Translation table from VBD offset to physical offset VBDs keep extents and access control information Guest scheduler may order requests going onto ring Xen can reorder after that, knowing more about storage Requests from competing domains are batched and round-robin scheduled Fairness, but minimize overhead Domains can specify reorder barriers to preserve higher-level semantics, e.g write-ahead log