Kernel-based Virtual Machine (KVM) Memory Management Unit (MMU) Virtualization Mohammad H. Mofrad February 11, 2016

Slides:



Advertisements
Similar presentations
Hardware-assisted Virtualization
Advertisements

虛擬化技術 Virtualization Technique
Virtualization Technology
E Virtual Machines Lecture 3 Memory Virtualization
Bart Miller. Outline Definition and goals Paravirtualization System Architecture The Virtual Machine Interface Memory Management CPU Device I/O Network,
CS 333 Introduction to Operating Systems Class 11 – Virtual Memory (1)
Network Implementation for Xen and KVM Class project for E : Network System Design and Implantation 12 Apr 2010 Kangkook Jee (kj2181)
Virtual Machines. Virtualization Virtualization deals with “extending or replacing an existing interface so as to mimic the behavior of another system”
Virtualization for Cloud Computing
Virtual Machine Monitors CSE451 Andrew Whitaker. Hardware Virtualization Running multiple operating systems on a single physical machine Examples:  VMWare,
LINUX Virtualization Running other code under LINUX.
虛擬化技術 Virtualization and Virtual Machines
Virtualization-optimized architectures
Tanenbaum 8.3 See references
A Comparison of Software and Hardware Techniques for x86 Virtualization Keith Adams Ole Agesen Oct. 23, 2006.
SymCall: Symbiotic Virtualization Through VMM-to-Guest Upcalls John R. Lange and Peter Dinda University of Pittsburgh (CS) Northwestern University (EECS)
Zen and the Art of Virtualization Paul Barham, et al. University of Cambridge, Microsoft Research Cambridge Published by ACM SOSP’03 Presented by Tina.
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
Xen I/O Overview. Xen is a popular open-source x86 virtual machine monitor – full-virtualization – para-virtualization para-virtualization as a more efficient.
Virtual Machine and its Role in Distributed Systems.
Hadi Salimi Distributed Systems Lab, School of Computer Engineering, Iran University of Science and Technology, Fall 2010 Performance.
Our work on virtualization Chen Haogang, Wang Xiaolin {hchen, Institute of Network and Information Systems School of Electrical Engineering.
CS533 Concepts of Operating Systems Jonathan Walpole.
System Virtualization 1 Learning Objective: –To understand the implementation choices and details of System Virtualization COMP
Cloud Operating System Unit 09 Cloud OS Core Technology M. C. Chiang Department of Computer Science and Engineering National Sun Yat-sen University Kaohsiung,
Virtualisation Front Side Buses SMP systems COMP Jamie Curtis.
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.
CSE 451: Operating Systems Winter 2015 Module 25 Virtual Machine Monitors Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
X86 MMU. Shadow Page Table Extended Page Table Guest wants to access GVA 0, guest PTE (page table entry) maps GVA 0 to GPA 0 Hardware checks NPT (nested.
CS 140 Lecture Notes: Virtual MachinesSlide 1 Process Abstraction Instruction Set Registers MMU I/O Devices Physical Memory Virtual Memory System Calls.
Agile Paging: Exceeding the Best of Nested and Shadow Paging
Virtual Machines (part 2) CPS210 Spring Papers  Xen and the Art of Virtualization  Paul Barham  ReVirt: Enabling Intrusion Analysis through Virtual.
Overview of Virtualization The magic of virtual machines Borislav Varadinov Telerik Software Academy System Administrator Marian.
Virtualization Neependra Khare
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
Virtualization for Cloud Computing
Introduction to Virtualization
Virtualization.
Virtual Machine Monitors
Virtualization Technology
L2- Virtualization Technology
Presented by Mike Marty
CS 3214 Introduction to Computer Systems
CS 3214 Operating Systems Virtualization.
CS 3214 Operating Systems Virtualization Godmar Back.
Section 9: Virtual Memory (VM)
Virtualization overview
Xen: The Art of Virtualization
Running other code under LINUX
Group 8 Virtualization of the Cloud
CS 140 Lecture Notes: Virtual Machines
OS Virtualization.
Virtualization Techniques
CS 140 Lecture Notes: Virtual Machines
Translation Buffers (TLB’s)
TLB Performance Seung Ki Lee.
Full and Para Virtualization
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Virtualization Dr. S. R. Ahmed.
CS 140 Lecture Notes: Virtual Machines
Translation Buffers (TLBs)
Xen and the Art of Virtualization
CSE 451: Operating Systems Autumn Module 24 Virtual Machine Monitors
Hardware Virtualization
System Virtualization
Review What are the advantages/disadvantages of pages versus segments?
CS295: Modern Systems Virtualization
Presentation transcript:

Kernel-based Virtual Machine (KVM) Memory Management Unit (MMU) Virtualization Mohammad H. Mofrad February 11, 2016

Contents Kernel-based Virtual Machine Linux memory management unit memory management unit virtualization 2

KVM as a Virtual Machine Monitor (KVM) 3 Hardware Linux Kernel Kvm.ko /dev/kvm Virtual MachineHost Applications qemu Architecture of the Kernel-based Virtual Machine (KVM), Jan Kiszka, Siemens AG open("/dev/kvm") ioctl(KVM_CREATE_VM) ioctl(KVM_CREATE_VCPU) ioctl(KVM_MEMORY_REGION) for (;;) { ioctl(KVM_RUN) switch (exit_reason) { case KVM_EXIT_IO: /*... */ case KVM_EXIT_HLT: /*... */ }

Linux Memory Management Unit (MMU) A Memory Management Unit (MMU) translates physical memory addresses to virtual address used by the operating system. It requests a page fault interrupt MMU uses a Translation Lookaside Buffer (TLB) to improve virtual address translation speed. 4Source: The Linux Kernel’s Memory Management Unit API, William Gatliff Host Physical Memory Page # Page # … MMU TLB | CPU HVA HPA Host Virtual Address (HVA) Host Physical Address (HPA) Physical Machine

MMU in Virtualization 5 MMU TLB | CPU GVA GPA Guest Physical Memory Page # Page # … MMU Virtualization Host Physical Memory | | | | | | | … Host Virtual Address (HVA) Host Physical Address (HPA) Guest Virtual Address (GVA) Guest Physical Address (GPA) Virtual Machine Physical Machine

Memory virtualization problems 3 levels of indirection But MMU can translate only one But MMU virtualization translates GVA to HPA. 6Virtualization in Linux KVM + QEMU GVAGPAHVAHPA >>

Memory Virtualization Shadow paging Hardware assisted virtualization MMU paravitualization 7

Shadow Paging 8 A|B|C|D|E|F|G|H|I|J| |… 1|2|3|4| |… 1|2|3|4|5|6|7|8|9|10| |… 1|2|3|4|5|6| |… GVA GPA HVA HPA KVM\Qemu GPA >> HPA VM GVA >> GPA Shadow page table Guest process page table | Shadow page table | Page fault >> VM EXIT

Shadow Paging pros and cons + + Software solution + + No need to change guest OS + + No special hardware is required - - Every guest page needs a shadow version -- Shadow page table must be consistent with guest and host 9Virtualization in Linux KVM + QEMU

Hardware Assisted Virtualization (NTP/EPT ) Eliminate the need for shadow paging (software approach) Provide architectural support Nested Page Table (NPT) by AMD Extended Page Table (EPT) by Intel 10Address Translation for Virtual Machines

Hardware Assisted Virtualization (NTP/EPT ) 11 A|B|C|D|E|F|G|H|I|J| |… 1|2|3|4| |… 1|2|3|4|5|6|7|8|9|10| |… 1|2|3|4|5|6| |… GVA GPA HVA HPA KVM/Qemu GPA >> HPA VM GVA >> GPA NTP/EPT table Guest process page table | N/ETP page table | Page fault >> NTP/EPT violation

NTP/EPT Pros and Cons + + OS independent + + No need to change guest OS + + NTP/EPT table is proportional to guest memory - - Need hardware support -- Considerable overhead for TLB misses -- More memory access + longer latency 12Virtualization in Linux KVM + QEMU

MMU Paravirtualization Paravirtualization involves modifying OS kernel to replace nonvirtualize instructions with virtualization hypercalls. MMU paravirtualization is one of the original innovations of Xen VMM. So, guest is aware of how to map GVA to HPA!!! 13http://wiki.xenproject.org/wiki/X86_Paravirtualised_Memory_Management

MMU Paravirtualization 14http://wiki.xenproject.org/wiki/X86_Paravirtualised_Memory_Management A|B|C|D|E|F|G|H|I|J| |… 1|2|3|4| |… GVA HPA Xen direct paging GVA >>HPA G2P Guest process page table |. | Page fault >> NTP/EPT violation

MMU Paravirtualization Pros and Cons + + Near native solution + + Low memory overhead while taking full advantage of hardware - - Compatibility cost [modifying the guest kernel] -- All updates/changes need to be validated by VMM -- More memory access + longer latency 15kvm: the Linux virtual machine monitor

Useful References [1]Kivity, Avi, et al. "kvm: the Linux virtual machine monitor." Proceedings of the Linux symposium. Vol [2 ] Bae, Chang S., John R. Lange, and Peter A. Dinda. "Enhancing virtualized application performance through dynamic adaptive paging mode selection.“ Proceedings of the 8th ACM international conference on Autonomic computing. ACM, [3]Wang, Xiaolin, et al. "Selective hardware/software memory virtualization.“ ACM SIGPLAN Notices 46.7, ,