androit real-time for the rest of...

40
Corporate Technology ` Androit Real-time for the rest of us Android Builders Summit 2012 Wolfgang Mauerer Siemens AG, Corporate Competence Centre Embedded Linux Corporate Research and Technologies, Open Source Platforms Copyright © 2012, Siemens AG. All rights reserved. Page 1 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Upload: others

Post on 11-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Corporate Technology

AndroitReal-time for the rest of us

Android Builders Summit 2012

Wolfgang Mauerer

Siemens AG, Corporate Competence Centre Embedded LinuxCorporate Research and Technologies, Open Source Platforms

Copyright © 2012, Siemens AG. All rights reserved.

Page 1 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 2: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Corporate Technology

AndroitReal-time for the rest of us

Android Builders Summit 2012

Wolfgang Mauerer, Jan Sawallisch, Gernot Hillier

Siemens AG, Corporate Competence Centre Embedded LinuxCorporate Research and Technologies, Open Source Platforms

S. Honick, S. Oberthur, University Paderborn

Copyright © 2012, Siemens AG. All rights reserved.

Page 1 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 3: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Overview

1 Introduction & Rationale

2 PREEMPT RT

3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements

4 Building Your Own

Page 2 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 4: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Outline

1 Introduction & Rationale

2 PREEMPT RT

3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements

4 Building Your Own

Page 3 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 5: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android & Industrial Control I

Page 4 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 6: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android & Industrial Control II

Page 5 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 7: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android & Industrial Control II

Page 5 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 8: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

From Android™ to Androit

From Android to Androit

Android and real-time

A bon droit – the right choice!

Business

Machine consolidation

Multi-Coreproliferation

Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 9: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

From Android™ to Androit

From Android to Androit

Android and real-time

A bon droit – the right choice!

Business

Machine consolidation

Multi-Coreproliferation

Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 10: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

From Android™ to Androit

From Android to Androit

Android and real-time

A bon droit – the right choice!

Business

Developer availability

Attractivity sells

Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 11: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

From Android™ to Androit

From Android to Androit

Android and real-time

A bon droit – the right choice!

Business

Developer availability

Attractivity sells

Technical

Reduced HMI complexity

Opportunity: RT/non-RTseparation

App model

Licensing

Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 12: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android 6= Embedded Linux

Architecture: (Embedded) LinuxApplications

Framework Applications

POSIX libc

Linux + BSP

C/C++

C

Syscall

IPC

C

Key Concepts

Movecomplexityupwards

Lingua Franca:Java

Consistency

On Philosophy

The whole is greater than the sum of its parts!

Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 13: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android 6= Embedded Linux

Architecture: (Embedded) Android

App

App Framework

CoreLibsDalvik

Bionic

Java

JNI

Binder, JavaApp

Binder

Linux + BSP+ Android Patches

Syscalls

Zygote

Key Concepts

Movecomplexityupwards

Lingua Franca:Java

Consistency

On Philosophy

The whole is greater than the sum of its parts!

Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 14: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android 6= Embedded Linux

Architecture: (Embedded) Android

App

App Framework

CoreLibsDalvik

Bionic

Java

JNI

Binder, JavaApp

Binder

Linux + BSP+ Android Patches

Syscalls

Zygote

Key Concepts

Movecomplexityupwards

Lingua Franca:Java

Consistency

On Philosophy

The whole is greater than the sum of its parts!

Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 15: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Android 6= Embedded Linux

Architecture: (Embedded) Android

App

App Framework

CoreLibsDalvik

Bionic

Java

JNI

Binder, JavaApp

Binder

Linux + BSP+ Android Patches

Syscalls

Zygote

Key Concepts

Consistency forusers anddevelopers

Convenientand saferlanguages

On Philosophy

The whole is greater than the sum of its parts!

Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 16: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit: Use Cases

Consumer

In-car entertainment

Home control

Industrial

Small PLCs

Transportation and medicalsystems (Safety?Certification?)

Page 8 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 17: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Outline

1 Introduction & Rationale

2 PREEMPT RT

3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements

4 Building Your Own

Page 9 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 18: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

PREEMPT RT: Overview

Goal

Transform Linux into hard RTkernel

Merge Strategy

Merge upstream, by end of year

Roadmap Architecture

Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 19: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

PREEMPT RT: Overview

Goal

Transform Linux into hard RTkernel

Merge Strategy

Predictions: Learn from cold fusion

Roadmap Architecture

Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 20: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

PREEMPT RT: Overview

Goal

Transform Linux into hard RTkernel

Merge Strategy

Predictions: Learn from cold fusion

Roadmap Architecture

Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 21: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

PREEMPT RT: State of Affairs

Mainline

High-res timers

PI Mutexes

Kernel preemption/Threadedinterrupts

Spinlock annotations

Out of Tree

Lock transformation

Unconditional threadedinterrupts

Latency optimisation, bugfixes

Illustration

Spinlock IRQ Sleeping lock IRQ

Z Z Z

R R R

Page 11 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 22: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Outline

1 Introduction & Rationale

2 PREEMPT RT

3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements

4 Building Your Own

Page 12 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 23: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit Architecture: Challenges

Challenges

Android, preempt rt and BSP integration

Propagating real-time “upwards”

Consolidate RT and application model

Asymmetry: HMI vs. RT

Page 13 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 24: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit Architecture: Challenges

Challenges

Android, preempt rt and BSP integration

Propagating real-time “upwards”

Consolidate RT and application model

Asymmetry: HMI vs. RT

Page 13 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 25: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit: Software Architecture I

Architecture Variants

IntegrateRT-JVM

Extend DVM Hybrid Approach

Application Framework

LibsAndroid Runtime

Applications

Linux Real-Time

Core Libs

Dalvik VM RT-JVM

Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 26: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit: Software Architecture I

Architecture Variants

IntegrateRT-JVM

Extend DVM Hybrid Approach

Application Framework

LibsAndroid Runtime

Applications

Linux Real-Time

Core LibsDalvik VMWith RT

Extensions

Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 27: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit: Software Architecture I

Architecture Variants

IntegrateRT-JVM

Extend DVM Hybrid Approach

Application Framework

Libs Android Runtime

Applications

Linux Real-Time

Core Libs

Dalvik VM

Real-TimeApplications

CommunicationChannel

Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 28: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit: Software Architecture II

Architecture

Application Framework

Libs Android Runtime

Applications

Linux Real-Time

Core Libs

Dalvik VM

Real-TimeApplications

CommunicationChannel

Design decisions

Decouple RT and non-RT(Middleware?)

Java coupling: RCU,transactions

Introduce glibc

Page 15 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 29: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Demonstration: Measurement Setup

Output Signal

HDMI-Output-Pin:„5V enable“

HDMI-Input-Pin:„hot plug detect“

Input Signal

Interrupt Latency

Signal Generator Oscilloscope

Timer Latency

Android Device„Motorola Xoom“

HDMI cable

Page 16 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 30: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Demonstration

Page 17 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 31: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Performance Measurements I

Observed Timer Delay [µs]

# s

ampl

es [a

.u.]

1

10

100

1000

1

10

100

1000

CPU 0

100 200 300 400 500

CPU 1

100 200 300 400 500

RT

Non−

RT

Page 18 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 32: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Performance Measurements I

Getclock results available

Handler scheduled in

HRT finished

HRT processing

Timer

fires

Timer

expected

3µs 5µs 7µs 30µs 20µs

t

Delay [µs]

# S

ampl

es [a

.u.]

1

10

100

1000

10000

1

10

100

1000

10000

Expiration delay

0 50 100

150

200

250

HRT handler delay

0 50 100

150

200

250

HRT duration

0 50 100

150

200

250

Schedule In

0 50 100

150

200

250

Getclock

0 50 100

150

200

250

RT

Non−

RT

Page 18 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 33: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Outline

1 Introduction & Rationale

2 PREEMPT RT

3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements

4 Building Your Own

Page 19 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 34: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Good, Bad, Ugly

IssuesDevice Access

Sources/BSP

Interfaces

Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia

Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 35: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Good, Bad, Ugly

BSP Theorem

RBSP(n) ∝ 1

n

Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia

Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 36: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Good, Bad, Ugly

Corollary

limn→∞

RBSP(n) = 0

Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia

Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 37: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit HOWTO

Fo

rwa r

d

BS

P

An

dro

id

Pre

emp

t R

T

Van

ill a

Van

ill a

Van

ill a

Base System Tasks

preempt rt-capable base kernel(BSP!)

Android patches

preempt rt patches

Latency tuning (device drivers!)

Userland Tasks

Android component adaption

RT control integration

Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 38: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit HOWTO

# of

Pat

ches

0

50

100

150

200

250

Andro

id Fixe

sBSP

Andro

id

BSP Fixe

s

Gener

ic

Late

ncy

Preem

pt_R

T

Preem

pt_R

T Fixe

s

Base System Tasks

preempt rt-capable base kernel(BSP!)

Android patches

preempt rt patches

Latency tuning (device drivers!)

Userland Tasks

Android component adaption

RT control integration

Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 39: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Androit HOWTO#

of P

atch

es

0

10

20

30

40

50

60

Andro

id Fixe

sBSP

Andro

id

BSP Fixe

s

Gener

ic

Late

ncy

Preem

pt_R

T

Preem

pt_R

T Fixe

s

Base System Tasks

preempt rt-capable base kernel(BSP!)

Android patches

preempt rt patches

Latency tuning (device drivers!)

Userland Tasks

Android component adaption

RT control integration

Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4

Page 40: Androit Real-time for the rest of usevents.static.linuxfound.org/images/stories/pdf/lf_abs12_mauerer.pdfJava Consistency On Philosophy The whole is greater than the sum of its parts!

Thanks for your interest!

Page 22 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4