running dual android xen instances on nexus 10

13
Dual-Android TM on Nexus 10 2/11/2014 © Samsung Electronics 1 Samsung Research UK Presentation for FOSDEM 2014

Upload: samsung-open-source-group

Post on 10-May-2015

325 views

Category:

Technology


3 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Running Dual Android Xen Instances on Nexus 10

Dual-AndroidTM on Nexus 10

2/11/2014 © Samsung Electronics 1

Samsung Research UK Presentation

for

FOSDEM 2014

Page 2: Running Dual Android Xen Instances on Nexus 10

2 © Samsung Electronics

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 CPU: ARM Cortex A15 (x2) : With virtualization extensions

o GPU: ARM Mali T604 (OpenGl ES2.0)

o Memory available: 2GB RAM, plenty of Flash

o Screen resolution: 2560x1504

Page 3: Running Dual Android Xen Instances on Nexus 10

3 © Samsung Electronics

Configuration

Software configuration – 2 VMs only

o DOM0 = 1st Android

o DOMU = 2nd Android

o Linux 3.4

o 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 DOM0 kernel DOMU kernel

Memory 1GB RAM 1GB RAM

SMP Dual-core Dual-core Single-core

I/O Pass through PV Drivers

Page 4: Running Dual Android Xen Instances on Nexus 10

Xen PVH Architecture

4 © Samsung Electronics

DOMU DOM0

Android

Jelly Bean 4.2

GPU

Mali T604

CPU 0

(Cortex A15)

Kernel

(PL1)

User

(PL0)

HYP

(PL2)

Android

Apps

Linux 3.4

HW CPU 1

(Cortex A15)

Android

Jelly Bean 4.2

Android

Apps

Linux 3.4

Xen on ARM

Rings Physical

Drivers

Back End

Drivers

Front End

Drivers

Display,

Touch

etc.

Page 5: Running Dual Android Xen Instances on Nexus 10

5 © Samsung Electronics

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

Page 6: Running Dual Android Xen Instances on Nexus 10

6 © Samsung Electronics

Video

DOM0 – Blue Wallpaper DOMU – Orange Wallpaper

Switching icon

Demo video

o Switching between Android Icon or Volume key

o Angry Birds in DOMU Near-native performance of PV drivers

o Angry Birds in DOM0 and DOMU concurrently Two independent Android

o 3D Benchmark clip

Passthrough drivers PV Drivers

Page 7: Running Dual Android Xen Instances on Nexus 10

Android UI virtualization challenges

Android Jelly Bean

o Project Butter: Buttery smooth UI

o Triple buffering using ION memory allocated buffers, no FBdev

o New sync mechanism via fences.

o Hardware composition for the Surfaces

o 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.

7 © Samsung Electronics

Page 8: Running Dual Android Xen Instances on Nexus 10

8 © Samsung Electronics

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

15 0 30 45 60 time (ms)

Composition frame buffers

0

1

2

0

1

2 App frame buffers

Page 9: Running Dual Android Xen Instances on Nexus 10

9 © Samsung Electronics

Results

0

20

40

60

80

100

120

140

160

0

10

20

30

40

50

60

70

Packets

/sec (

k)

FP

S

Dual-Android, GPU composition

DOM0 DOMU Packets/sec (k)

Page 10: Running Dual Android Xen Instances on Nexus 10

10 © Samsung Electronics

Event Channel Under Stress

DOMU Vsync arrival time delta

16.67

0

5

10

15

20

25

30

35

10 11 12 13 14 15 16 17 18 19 20

De

lta

Tim

e (

ms

)

Benchmark Time (sec)

Some

missed

events

Page 11: Running Dual Android Xen Instances on Nexus 10

11 © Samsung Electronics

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

Page 12: Running Dual Android Xen Instances on Nexus 10

12 © Samsung Electronics

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.

Page 13: Running Dual Android Xen Instances on Nexus 10

13 © Samsung Electronics

Q&A