Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

19
Embedded Software Lab. @ SKKU 15 1 김김김 , 김김김 , 김김김 Tizen System Analysis

Transcript of Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Page 1: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

1

김혁중 , 한규화 , 황연성

Tizen System Analysis

Page 2: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

2

• To evaluate the hardware behavior • Tizen on QEMU + GEM5

– Idea from Gemdroid– Expected to simulator Tizen behavior using GEM5 with

the trace extracted from Tizen emulator (QEMU)

Primary Goal: Gem+Tizen

Page 3: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

3

• "GemDroid: A Framework to Evaluate Mobile Platforms“

• The 2014 ACM International Conference on Measurement and Modeling of Computer Systems. ACM(SIGMETRICS), 2014.

• The Pennsylvania State University– Chidambaram Nachiappan Nachiappan, Praveen

Yedlapalli, Mahmut T. Kandemir, Anand Sivasubramaniam, Chita R. Das

• Intel Corp.– Niranjan Soundararajan

GemDroid

Page 4: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

4

• Holistic evaluation tools for mobile system covering cores, IPs, memory, and system SW.

GemDroid (cont)

– provides cycle-accurate simulation models (800x slowdown)

– captures and replays instruction-level trace (ARM instructions + IP calls)

Page 5: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

5

• QEMU(Quick EMUlator)– Open source– Hypervisor (Virtual machine monitor)– Hardware virtualization– GNU GPL version2 license– Supports

• IA_32, X86-64…

QEMU

Page 6: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

6

• Modular discrete event driven computer system simulator platform

• Merger of the best aspects of the M5 and GEMS– M5

• provide a highly configurable simulation framework, multiple ISAs, and diverse CPU models

– GEMS• complement M5’s features with a detailed and flexible memory

system– multiple cache coherence protocols and interconnect models

• Provide a wide variety of capabilities and components– CPU model– System mode– Memory system

GEM5

Page 7: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

7

• GEM5 is ‘architecture simulator’– Impossible to simulate using instruction trace from

QEMU (runtime simulation is needed)– In case of the paper (GemDroid), it may only simulate

memory event using memory event trace and GEM5.

• Tizen should be run on GEM5 for using GEM5 (rather than trace)– Trace-driven simulation is not available– GEM5 uses pre-built OS image for full-system simulation

• Android image and ubuntu image are provided by the GEM5 community, but Tizen has no specific image.

Problem of using GEM5

Page 8: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

8

• Architecture Simulator (like GEM5)– Run simulation based on QEMU with PTLsim and

DRAMsim.– Because Tizen (3.0) can run on generic QEMU,

‘expected’ to simulate Tizen behavior using MARSS.

Plan B: MARSSx86 simulator

Page 9: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

9

• Need to use Generic QEMU (because MARSS modified QEMU source code)

• To run Tizen on Generic QEMU, we need to choose Tizen 3.0 common x11 image– Port Tizen 3.0 common image into QEMU (in MARSS)

• MARSSx86 uses old version of QEMU– QEMU version on MARSSx86 is 0.2.0 (currently QEMU is 2.2.0)

• On generic QEMU, display don’t show up with Tizen image.– Modify the display option into fbdev (Framebuffer) rather than

DRM– In systemd, set fbdev (dev/fb0) as default mount.– Success to boot up Tizen 3.0 image on QEMU.– Success to run Crosswalk on Tizen 3.0 image.

Tizen porting on MARSSx86Sim

Ref: https://www.mail-archive.com/[email protected]/msg04905.html

Page 10: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

10

• Emulation was available, but, simulation was not available– When start simulation, the system gets crash.

• Reason: PTLsim (Core simulator) can’t translate corresponding instruction.– Solution

• Linux kernel downgrade– Current linux kernel version on Tizen is 3.14– Success to port Tizen on linux vanilla kernel 3.10 (with some boot

up fail like SMACK)– Still get translation error

• Fix instruction translation problem– After fixing: other Instruction also has same translation error.– It is impossible to translate all x86 instruction into up-to-date

Problem on running MARSSx86 simulation

Page 11: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

11MARSSx86 simulation Failed

Page 12: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

12

• Overview– Qemu memory trace

• Fix Tizen QEMU (Tizen_2.2) to get memory trace profile• Simulate memory behavior using Trafficgen in GEM5• load/store, memory address, tick information

– Qemu device behavior trace• Tizen emulator uses virtio device to improve the

performance• It may available to get event trace on QEMU virtio source• Insert event trace code on GPU, codec, touch screen virtio

driver

Plan C: QEMU Tracing on Tizen

Page 13: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

13

• Clone Tizen emulator on emulator repository– git clone

ssh://review.tizen.org:gerrit/sdk/emulator/qemu.git

• Install pre-requisite tools for configure– run ./emulator_configure.sh on [QEMU]/tizen– if get some error about dependency, install required tool

for corresponding error

• Build 진행– run ./build.sh– built emulator-x86 image is in [QEMU]/tizen/emulator/bin

• Run emulator using built image– copy emulator-x86 into [Tizen-sdk]/tools/emulator/bin– Run emulator (IDE or emulator manager)

Tizen_2.2 emulator build & Execution

https://www.mail-archive.com/[email protected]/msg04704.html 참고

Page 14: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

14

• Memory tracing– tlb_fill ([QEMU]/target-i386/mem_helper.c)

• Check whether accessed address is in TLB• Memory address, read/write, time(tick) = total 13 byte

• Memory trace parsing– Make memory trace as binary data (because of huge

size)– 21-byte entry: operation, address, size, tick– Convert binary trace into

readable trace using parser

Implementation

Page 15: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

15Implementation (cont)

• Device tracing– [QEMU]/tizen/src/hw/– maru_brill_codec.c– maru_virtio_hwkey.c– maru_virtio_touchscree.c– virtio-gl.c

Page 16: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

16

• Qemu tracing and parsing– http://www.youtube.com/watch?

v=Y_O_l_foawg&list=UUGxmuQQIBhjOTEENNOiGwAg&index=2

Demo

Page 17: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

17

• Memory Trace– Extract memory trace on Tizen emulator– Native application (5min)

• watch• cube• drawing board• scheduler

– Web application (5min)• analog watch• image rotation• paint app• event manager

Experiment

Page 18: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

18

Native Web

# of Instruction (million) 74.34111 100.0356

Total cycle (billion) 1775.75 1790.99

Mem write (GB) 5.65 4.43

Mem read (GB) 10.10 8.89

Brill_codec 157 42

touchscreen 1699 16864

hwkey 72 42

virtio-gl 29327 121350

Results

• Each Native app & Web app workload– Extract memory event, instruction count, memory RW

request, device event• brill_codec is codec device, touchscreen is touch event,

hwkey is hardware key event, virtio-gl is OpenGL event

Page 19: Embedded Software Lab. @ SKKU 15 1 김혁중, 한규화, 황연성 Tizen System Analysis.

Embedded Software Lab. @ SKKU

15

19

• Not a same workload between Native and Web App– Try to make similar workload with similar application

but it is not same– Need to analyze micro component like view, interaction

• Tracing– Need to analyze core, instruction pipe-line or cache

behavior

• Device tracing– Only trace event call count– Need to break down into detail behavior like memory

allocation, task scheduling, etc.

Limitation