Running Dual Android Xen Instances on Nexus 10


Published on

Srinivas Kalaga from Samsung Research UK talks about running 2 instances of the Android OS on the same hardware (Nexus 10) via Xen.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Running Dual Android Xen Instances on Nexus 10

  1. 1. Dual-AndroidTM on Nexus 10 Samsung Research UK Presentation for FOSDEM 2014 2/11/2014 © Samsung Electronics 1
  2. 2. Introduction  Feasibility: 2 copies of Android on Xen on ARM? o Xen on mobile performance? o Virtualized GPU required  Nexus 10 device used (SoC: Samsung Exynos 5250) o o o o CPU: ARM Cortex A15 (x2) : With virtualization extensions GPU: ARM Mali T604 (OpenGl ES2.0) Memory available: 2GB RAM, plenty of Flash Screen resolution: 2560x1504 © Samsung Electronics 2
  3. 3. Configuration  Software configuration – 2 VMs only o o o o DOM0 = 1st Android DOMU = 2nd Android Linux 3.4 Android Jelly Bean 4.2  Xen 4.2 for ARM o Virtualization extensions support • • • • • vGIC2 Two stage translation page tables, guest memory isolation by hardware. Generic timer for Hypervisor timer Neon SIMD support IOMMU (not fully supported yet so IPA=PA)  Parallel development in Samsung HQ to community Xen SMP I/O © Samsung Electronics Dual-core DOMU kernel 1GB RAM Memory DOM0 kernel 1GB RAM Dual-core Single-core Pass through PV Drivers 3
  4. 4. Xen PVH Architecture DOM0 DOMU Android Apps Android Apps Android Jelly Bean 4.2 Linux 3.4 User (PL0) Kernel (PL1) Android Jelly Bean 4.2 Linux 3.4 Physical Drivers HYP (PL2) HW Back End Drivers Rings Front End Drivers Xen on ARM Display, Touch etc. © Samsung Electronics GPU Mali T604 CPU 0 (Cortex A15) CPU 1 (Cortex A15) 4
  5. 5. Mobile Virtualization  I/O Challenges – Mobiles have ~50 device drivers o Sensors: Touch, gyro, proximity, ambient light o Media: Display, GPU, Camera, Audio, Video o Connectivity: Charger, USB, WiFi, Bluetooth  User Switching o Xen scheduler runs as normal. o “Foreground” VM – user devices require arbitration driver in DOM0 • Display • Touch Display Switch Foreground VM © Samsung Electronics 5
  6. 6. Video  Demo video o o o o Switching between Android  Icon or Volume key Angry Birds in DOMU  Near-native performance of PV drivers Angry Birds in DOM0 and DOMU concurrently  Two independent Android 3D Benchmark clip DOM0 – Blue Wallpaper Passthrough drivers DOMU – Orange Wallpaper PV Drivers Switching icon © Samsung Electronics 6
  7. 7. Android UI virtualization challenges  Android Jelly Bean o o o o o Project Butter: Buttery smooth UI Triple buffering using ION memory allocated buffers, no FBdev New sync mechanism via fences. Hardware composition for the Surfaces So rendering to display is all closely integrated within the OS frameworks and Kernel Subsystems (Surfaceflinger, Surfaceview, Gralloc , ION memory allocator, Fence-sync, Display driver).  Para-virtualization of ION, Fence-Sync and Display using grant-memory and eventchannels. © Samsung Electronics 7
  8. 8. Near-Native Performance Challenges  60 frames per second = 16.6ms per frame o GPU renders each surface  GPU composes the surfaces  frame  Virtualized graphics options o API Remoting done above GPU driver for chipset portability  Android JB has “butter smooth” technology o Triple buffering o Needs reliable Vsync interrupt  Xen event channel stressed o Deferred waiting using sync points & fences Composition frame buffers 0 1 2 App frame buffers 0 1 2 0 © Samsung Electronics 15 30 45 60 time (ms) 8
  9. 9. Results Dual-Android, GPU composition 70 160 60 140 FPS 100 40 80 30 60 20 Packets/sec (k) 120 50 40 10 20 0 0 DOM0 © Samsung Electronics DOMU Packets/sec (k) 9
  10. 10. Event Channel Under Stress  DOMU Vsync arrival time delta Delta Time (ms) 35 Some missed events 30 25 20 16.67 15 10 5 0 10 11 12 13 14 15 16 Benchmark Time (sec) © Samsung Electronics 17 18 19 20 10
  11. 11. Xen For Mobile  Multi-page ring o Needed for throughput performance running benchmarks o Ensure low-latency  Non-linear grant references o Old grants are re-used. PV drivers assume linearity  RAM Allocation limit 512MB o Buddy allocator is unable to allocate contiguous chunk of memory from the Domheap memory  Per-VM interrupts unreliable when stressed o Must ensure Vsync is received in DOMU with minimal latency  Contribution to community o Samsung will work to share Xen changes with community o Some code is proprietary © Samsung Electronics 11
  12. 12. Conclusion  Two Android can run with near-native graphics performance  Xen runs well on mobile devices  Using PV drivers, no major changes to Xen architecture required Android is a trademark of Google Inc. The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries. ARM is a registered trademark of ARM Limited. Mali is a trademark of ARM Limited. STAR WARS and related properties are trademarks in the United States and/or in other countries of Lucasfilm Ltd. and/or its affiliates. © 2012 Lucasfilm Ltd. All rights reserved. Angry Birds is a trademark of Rovio Entertainment Ltd. © Samsung Electronics 12
  13. 13. Q&A © Samsung Electronics 13