Optimizing I/O Virtualization & VM Memory Management for Tablet Devices



Similar documents
Running Windows 8 on top of Android with KVM. 21 October Zhi Wang, Jun Nakajima, Jack Ren

KVM Architecture Overview

Virtualization in Linux KVM + QEMU

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Real-time KVM from the ground up

KVM & Memory Management Updates

novm: Hypervisor Rebooted Adin Scannell

Tech Tip: Understanding Server Memory Counters

Using Linux as Hypervisor with KVM

Hardware Based Virtualization Technologies. Elsie Wahlig Platform Software Architect

Operating System Structure

RCL: Software Prototype

Cloud Operating Systems for Servers

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

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

Operating System Structures

Architecture (SOSP 2011) 11/11/2011 Minsung Jang

Where is the memory going? Memory usage in the 2.6 kernel

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

MODULE 3 VIRTUALIZED DATA CENTER COMPUTE

LiveBackup. Jagane Sundar

File Systems Management and Examples

Determining the Correct Usage of Swap in Linux * 2.6 Kernels

Enabling Technologies for Distributed Computing

Unmatchable Windows 8 Tablet S1185 Sales Kit Lite

Xen and the Art of. Virtualization. Ian Pratt

Memory Resource Management in VMware ESX Server

File System & Device Drive. Overview of Mass Storage Structure. Moving head Disk Mechanism. HDD Pictures 11/13/2014. CS341: Operating System

Linux Driver Devices. Why, When, Which, How?

Xen and XenServer Storage Performance

Live und in Farbe Live Migration. André Przywara CLT 2010

Outline: Operating Systems

Connecting Software Connect Bridge - Mobile CRM Android User Manual

MOVEIRO BT-200 Technical Information for Application Developer

KVM: Kernel-based Virtualization Driver

How to Install Windows on Xen TM 3.0

A Virtualized Linux Integrity Subsystem for Trusted Cloud Computing

Virtual Systems with qemu

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

Discovering Computers

Chapter 14 Virtual Machines

Intel NAS Performance Toolkit

BHyVe. BSD Hypervisor. Neel Natu Peter Grehan

DCPS STUDENT OPTION HOME USE PROGRAM SIGN UP INSTRUCTIONS

Virtualization. Dr. Yingwu Zhu

Virtual Machines. COMP 3361: Operating Systems I Winter

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

Areas Covered. Chapter 1 Features (Overview/Note) Chapter 2 How to Use WebBIOS. Chapter 3 Installing Global Array Manager (GAM)

Example of Standard API

Enabling Technologies for Distributed and Cloud Computing

About Parallels Desktop 10 for Mac

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

Gigabyte Management Console User s Guide (For ASPEED AST 2400 Chipset)

I3: Maximizing Packet Capture Performance. Andrew Brown

Chapter 2 Array Configuration [SATA Setup Utility] This chapter explains array configurations using this array controller.

Parallels Desktop 4 for Windows and Linux Read Me

Performance Management in a Virtual Environment. Eric Siebert Author and vexpert. whitepaper

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

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c February 2015

Watch your Flows with NfSen and NFDUMP 50th RIPE Meeting May 3, 2005 Stockholm Peter Haag

Enterprise-Class Virtualization with Open Source Technologies

Analyzing ChromeOS s Boot Performance

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Memory Management under Linux: Issues in Linux VM development

Phoenix SecureCore TM Setup Utility

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

Chapter 12: Mass-Storage Systems

Architecture of the Kernel-based Virtual Machine (KVM)

Hyper-V vs ESX at the datacenter

Virtualization Technologies

Lessons Learned while Pushing the Limits of SecureFile LOBs. by Jacco H. Landlust. zondag 3 maart 13

COS 318: Operating Systems. Virtual Machine Monitors

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-3: Windows and Memory Management

Understanding Virtual Memory In Red Hat Enterprise Linux 3

COS 318: Operating Systems

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

Virtual vs Physical Addresses

Chapter 5 Cloud Resource Virtualization

Microsoft Exchange Server 2003 Deployment Considerations

Lecture 11. RFS A Network File System for Mobile Devices and the Cloud

October Gluster Virtual Storage Appliance User Guide

Putting it all together: Intel Nehalem.

System Configuration and Order-information Guide ECONEL 100 S2. March 2009

QUESTIONS & ANSWERS. ItB tender 72-09: IT Equipment. Elections Project

CQG/NET Technical Specifications. September 16, 2014 Version

Chapter 4. Backup / Restore

ServerPronto Cloud User Guide

Obj: Sec 1.0, to describe the relationship between hardware and software HW: Read p.2 9. Do Now: Name 3 parts of the computer.

VDI Optimization Real World Learnings. Russ Fellows, Evaluator Group

Increasing XenServer s VM density

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

How To Write To A Linux Memory Map On A Microsoft Zseries (Amd64) On A Linux (Amd32) (

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Lecture 6: Operating Systems and Utility Programs

Join & Leave Meetings

Knut Omang Ifi/Oracle 19 Oct, 2015

CELLS A Virtual Mobile Smartphone Architecture

Transcription:

Optimizing I/O Virtualization & VM Memory Management for Tablet Devices October 14 th, 2014 Bokdeuk Jeong, Jaeyong Yoo, Sung-Min Lee Software R&D Center, Samsung Electronics Vasily Leonenko Samsung R&D Institute Russia, Samsung Electronics

QEMU/KVM RUNNING WINDOWS ON ANDROID

Running Another OS on Android Windows 8.1 on Android KitKat w/ Atom Tablet Looks like this HW spec: Baytrail (Atom Z3775, 1.46 GHz) 3GB RAM 64GB emmc 5.0 VM: 4 VCPUs, 1GB RAM 16GB used (30GB disk image) Windows 8.1 32bit

Running Another OS on Android How To Run Windows on Android with KVM/QEMU Limbo-Android Runs QEMU on Android Intel s Talk at KVM Forum 2013 Enabled Limbo w/ KVM support Added missing system calls & POSIX functions Samsung did Rebased Limbo to QEMU 1.7.1 Used 32-bit Android Kernel with PAE for Windows to use the NX bit VM w/ more than 1GB RAM support on 32-bit Android kernel Samsung also added Multitouch USB multitouch support Bluetooth Bluetooth pass-through WIFI Access Wi-Fi access via virtual Ethernet Battery charge status sync via ACPI Audio Interface with OpenSLES Graphic Virtualization based on API-forwarding

Finding Another Missing Pieces Running Windows 8.1 VM on Android as an App An app should start instantly. 5 seconds is the max time most mobile user will wait for a website or application to load. 74% will leave a mobile website if it doesn t load within 5 seconds, and 50% will exit an app. (infographic) Start VM with a snapshot Android kills an app in background with the heaviest memory usage first when it is low on memory By Low Memory Killer in Kernel By Activity Manager Service Utilize automatic VM memory balloon & suspend/resume Virtualized I/O devices in QEMU should interface with Android world HIDs, Audio, Bluetooth, Battery Charging Status, Display and etc.

QEMU/KVM STARTING UP VM WITHIN 5 SECONDS

Fast VM Startup Displaying Metro UI after Boot QEMU bios Windows Booting Auto Login 48.3 ~ 50 Seconds 3.3 seconds for initialization 45 seconds - with no change from the previous VM run VM Startup from Snapshot* w/ Existing QEMU + - If changes in VM occurred during the last run - If disk image is not clean QEMU 10.4 seconds 3.0 seconds for initialization 7.4 seconds for loading VM snapshot VM Startup from Snapshot* w/ QEMU Modification QEMU 5.4 Seconds 1.2 seconds for initialization 4.2 seconds for loading VM snapshot * Snapshot size: 574MB (taken at the Metro UI screen)

Fast VM Startup Modification on Saving and Loading Snapshots (1/2) Separate file for VM State only Reduces time for L1/L2 table lookup in qcow2 Reduces time for meta data lookup of a qcow2 file (> 15GB) in the host kernel Resize QEMUFile buf from 32KB to 512KB Read-ahead hint API Set read-ahead for snapshot area in the qcow2 snapshot file Using fadvise() with POSIX_FADV_SEQUENTIAL

Fast VM Startup Modifications on Saving and Loading Snapshots (2/2) Save contiguous non-zero pages larger than 512KB together after a single header Load the contiguous non-zero RAM state directly to VM RAM Avoids memory copy overhead Layout of RAM Snapshot addr w/ flags ch (1byte) addr w/ flags (8bytes) memory contents (4KB) addr w/ flags memory contents (4KB) addr w/ flags ch (1byte) zero page RAM_SAVE_FLAG_PAGE Load to the QEMUFile buffer zero page Copy to the VM RAM Layout of RAM Snapshot addr w/ flags ch (1byte) addr w/ flags (8bytes) # pages (1byte) memory contents (> 512KB) addr w/ flags ch (1byte) RAM_SAVE_FLAG_LARGE_PAGE Load to the VM RAM directly

Fast VM Startup Disable unused virtual device & modules floppy disk, vmmouse USB companion controllers qemu monitor qmp socket Enable nodefaults option THP w/ zero-pages disabled Eliminate redundant qemu_system_reset() call <vl.c> int main(int argc, char **argv, char **envp) { qemu_system_reset(vmreset_silent); if (loadvm) { if (load_vmstate(loadvm) < 0) { autostart = 0; } } Removed <savevm.c> int load_vmstate(const char *name) { qemu_system_reset(vmreset_silent); ret = qemu_loadvm_state(f); }

QEMU/KVM BALLOONING VM MEMORY ACCORDING TO THE FOREGROUND SCREEN DISPLAY

Android-based Ballooning AMS callback + LMK callback LIMBO/QEMU Android Activity Manager Service Approach I: on updateoomadjlocked() call Ballooning Android I/F Balloon Backend get minfree get free memory size get watermark eventfd /sys/module/lowmemoryk iller/parameters/minfree /proc/meminfo /proc/zoneinfo Low Memory Killer as a registered shrinker Approach II: on lowmem_shrink() call KERNEL MinFree Table of LMK Process type Foreground Visible Perceptible, Backup Heavy Weight, Service, Home, Previous, Service_B Cached App Min Cached App Max, Unknown Adj Value 0~ 1~ 2 ~ 4~ 9~ 15~ Oom Min Free 48MB 60MB 72MB 84MB 96MB 128MB

Ballooning: VM Execution at Foreground Guest has higher priority of using memory. Let VM freely use its memory Try to keep guest VM memory pressure small - VM memory pressure = (Total Mem Free Mem)/Total Mem - VM memory pressure < FG_VM_Mem_Pressure (e.g. 75%) But, don t let Android sacrifice important apps for VM - important apps: Visible apps, Perceptible apps, Services.. - e.g.) FG_Host_Mem_Threshold = Minfree[3] (e.g. 84MB) QEMU Guest (Windows) Balloon Backend 2. DEFLATE OO MB Balloon Frontend 2. deflate 1. Detect Guest Memory Pressure dvq 3. Send a list of guest physical page frames that balloon freed 4. madvise(addr, len, MADV_WILLNEED) free Balloon App 1 App n OS Guest memory Linux Kernel (3.10+) Host free memory pool

Ballooning: VM Execution at Background Host apps have higher priority of using memory. Yield guest memory as much as it can. Try to keep host free memory > BG_Host_Mem_Threshold BG_Host_Mem_Threshold = MAX(Minfree[5], SUM(low watermark of lowmem, low watermark of highmem)) + margin But, don t cause severe guest page swap VM memory pressure < BG_VM_Mem_Pressure (e.g 95%) QEMU Guest (Windows) Android Activity Manager Service Balloon Backend 1. Detect Host Memory Pressure 0. Notify low free memory eventfd 2. Inflate OO MB ivq Balloon Frontend 3. Send a list of guest physical page frames that balloon allocated 4. madvise(addr, len, MADV_DONTNEED) 2. Inflate alloc Balloon App 1 App n OS Guest memory Low Memory Killer Linux Kernel (3.10+) Host free memory pool

kilobytes Software R&D Center Ballooning: Experiment Result Guest VM RAM: 1GB VM Memory Pressure at Background: 100% 1000000 800000 600000 Without balloon, VM was killed at this point. 400000 200000 0 26259 26309 26359 time (sec) 26409 26459 26509 26559 Switch VM -> Android A host app starts allocating memory. The host app has allocated 300MB The host app has allocated 800MB Killed the host app Switch Android -> VM Killed apps in VM

QEMU/KVM INTERFACING ANDROID WITH QEMU VIRTUAL DEVICES

I/O Devices: Newly Added Virtual Devices Limbo QEMU Guest VM Bluedroid bluetooth.default.so Protocol multiplexer RAW HCI Battery Intent Receiver SurfaceView Keyboard, Mouse, Touch Listeners libopensles.so OpenSL Interface (audio/opensl.c) Audio stack intel-hda usb-bt Android UI event handler (ui/android.c) USB stack QEMU HID subsystem multitouch usb-multitouch ACPI SMBus Power Source Battery ACPI Namespace DSDT Power Source Battery SMB controller Host Kernel newly added

I/O Devices: Features HID USB Multi-touch Mouse 3-buttons, hover functionalities Bluetooth Bluetooth HCI Pass-through Bluedroid modification to support HCI raw data Sound OpenSL interface in QEMU maintains a lock-free ring buffer to pass samples to OpenSL Used asynchronous queue processing maintained by OpenSL ACPI Added Objects to ACPI namespace in Guest VM Power Source: implements standard ACPI power source protocol Battery: implements standard ACPI control method battery protocol SMBus Controller: connection based on SMBus

0 256 512 768 1024 1280 1536 1792 2048 2304 2560 2816 3072 0 256 512 768 1024 1280 1536 1792 2048 2304 2560 2816 3072 Software R&D Center Large VM Memory Support on 32-bit kernel QEMU/Limbo Virtual Memory Guest Physical Memory KB Lower boundary of the mmap virtual memory area #define TASK_UNMAPPED_BASE (TASK_SIZE / 3) == 1GB KB Unused area by Limbo (i.e. android apps) (Linux process used to allocate this area for Text, Data, BSS segments)

Acknowledgment Many thanks for individual contribution Je-Min Kim Jae Min Kim Sungjin Kim Byung Chul So Min Kang Yong Hyeok Lee Junbong Yu Chanju Park Anatoly Stepanov Petr Ovchenkov Sergey Vorm Stanislav Andreev Anton Yakovlev Svetlana Khafizova

Thank you Software R&D Center