27
Scheduler Support for Video-oriented Multimedia on Client-side Virtualization Hwanju Kim 1 , Jinkyu Jeong 1 , Jaeho Hwang 1 , Joonwon Lee 2 , and Seungryoul Maeng 1 Korea Advanced Institute of Science and Technology (KAIST) 1 Sungkyunkwan University 2 ACM Multimedia Systems (MMSys) February, 22-24, Chapel Hill, North Carolina, USA

Scheduler Support for Video-oriented Multimedia on Client-side Virtualization

Embed Size (px)

Citation preview

Scheduler Support for Video-oriented Multimedia on

Client-side Virtualization

Hwanju Kim1, Jinkyu Jeong1, Jaeho Hwang1, Joonwon Lee2, and Seungryoul Maeng1

Korea Advanced Institute of Science and Technology (KAIST)1

Sungkyunkwan University2

ACM Multimedia Systems (MMSys)

February, 22-24, Chapel Hill, North Carolina, USA

Virtualization Everywhere •  A new layer between OS and HW

VM

OS VM

OS

Hypervisor

Server-side virtualization

Cloud computing Virtual desktop infrastructure

Client-side virtualization

Multiple OSes High resource utilization Strong Isolation Easy management Live maintenance Fast provisioning …

=hypervisor

2/22

Client-side Virtualization •  Multiple OS instances on a local device •  Primary use cases •  Different OSes for application compatibility •  Consolidating business and personal computing environments on a single device •  BYOD: Bring Your Own Device

Business VM

Personal VM

Hypervisor

Managed domain

3/22

Multimedia on Virtualized Clients •  Multimedia is ubiquitous on any VM

Windows VM

Linux VM

Hypervisor

Business VM

Personal VM

Hypervisor

Business VM

Personal VM

Hypervisor

Video Playback Compilation

Data Processing 3D game

Video conference Downloading

1. Multimedia workloads are dominant on virtualized clients

2. Interactive systems can have concurrently mixed workloads

4/22

Issues on Multi-layer Scheduling •  A multimedia-agnostic hypervisor invalidat

es OS policies for multimedia VM

OS scheduler

VM

OS Scheduler

Hypervisor Scheduler

CPU

OS scheduler

CPU

Virtual CPU Virtual CPU

Task Task

BVT [SOSP’99] SMART [TOCS’03]

Rialto [SOSP’97]

BEST [MMCN’02]

HuC [TOMCCAP’06]

Redline [OSDI’08]

RSIO [SIGMETRICS’10] Windows MMCSS

Larger CPU proportion & Timely dispatching Task Task Task Task

I’m unaware of any multimedia-specific OS policies in a VM, since I see each VM as a black box.

Additional abstraction

Semantic gap!

5/22

Multimedia-agnostic Hypervisor •  Multimedia QoS degradation •  Two VMs with equal CPU shares •  Multimedia VM + Competing VM

0

5

10

15

20

25

30

Ave

rage

FPS

Competing workloads in another VM

0 10 20 30 40 50 60 70 80 90

100

Ave

rage

FPS

Competing workloads in another VM

VM VM

Xen hypervisor Credit scheduler

Video playback or 3D game

Competing workloads

Video playback (720p) on VLC media player Quake III Arena (demo1)

6/22

Possible Solutions to Semantic Gap •  Explicit vs. Implicit

VM

OS scheduler

Hypervisor Scheduler

Explicit OS cooperation

+ Accurate - OS modification - Infeasible w/o multimedia-friendly OS schedulers

VM

OS scheduler

Hypervisor Scheduler

Explicit User involvement

+ Simple - Inconvenient - Unsuitable for dynamic workloads

VM

OS scheduler

Hypervisor Scheduler

Implicit Hypervisor-only

+ Transparency - Difficult to identify workload demands at the hypervisor

Workload monitor

7/22

Proposed Approach •  Multimedia-aware hypervisor scheduler •  Transparent scheduler support for multimedia •  No modifications to upper layer SW (OS & apps) •  “Feedback-driven VM scheduling”

VM

Hypervisor

VM VM

Multimedia manager

(feedback-driven)

CPU scheduler

Multimedia monitor

Audio Video CPU

Estimated multimedia QoS

Scheduling command (e.g., CPU share or priority)

Challenges 1. How to estimate multimedia QoS

based on a small set of HW events? 2. How to control CPU scheduler based on the estimated information

8/22

Multimedia QoS Estimation •  What is estimated as multimedia QoS? •  “Display rate” (i.e., frame rate) •  Used by HuC scheduler [TOMCCAP’06]

•  How is a display rate captured at the hypervisor? •  Two types of display

Framebuffer Acceleration

unit

Display interface

Memory-mapped

Graphics Library

Video device

1.  Memory-mapped display

(e.g., video playback)

2. GPU-accelerated display (e.g., 3D game)

9/22

Memory-mapped Display (1/2) •  How to estimate a display update rate on

the memory-mapped framebuffer •  Write-protection for virtual address space mapped to framebuffer

Framebuffer memory

Virtual address space

Display interface

Write-protection

write

Hypervisor

page fault handler { Update display rate }

The hypervisor can inspect any attempt to map memory

Sampling to reduce trap overheads (1/128 pages, by default)

10/22

Memory-mapped Display (2/2) •  Accurate estimation •  Maintaining display rate per task •  An aggregated display rate does not represent multimedia QoS •  Tracking guest OS task at the hypervisor

•  Inspecting address space switches (Antfarm [USENIX’06])

•  Monitoring audio access (RSIO [SIGMETRIC’10]) •  Inspecting audio buffer access with write-protection •  A task with a high display rate and audio access à a multimedia task

Task

Task

25 FPS

10 FPS

11/22

GPU-accelerated Display (1/2) •  Naïve method •  Inspecting GPU command buffer with

write-protection or polling •  Too heavy due to huge amount of GPU commands

•  Lightweight method •  Little overhead, but less accuracy

•  3D games are less sensitive to frame rate degradation than video playback

•  GPU interrupt-based estimation •  An interrupt is typically used for an application to

manage buffer memory •  Hypothesis

•  “A GPU interrupt rate is in proportion to a display rate”

12/22

GPU-accelerated Display (2/2) •  Linear relationship between display rates

and GPU interrupt rates

•  Exponential weighted moving average (EWMA) is used to reduce fluctuation •  EWMAt = (1-w) x EWMAt-1 + w x current value

0

2000

4000

6000

8000

10000

12000

0 20 40 60 80 100

# o

f G

PU

inte

rrupt

/ s

ec

FPS

Quake3 demo1 (640x480)

Quake3 demo2 (640x480)

Quake3 demo1 (1024x768)

60

80

100

120

140

160

0 20 40 60 80 100

# o

f G

PU

inte

rrupt

/ s

ec

FPS

Quake3 demo1 (640x480)

Quake3 demo2 (640x480)

Quake3 demo1 (1024x768)

0

50

100

150

200

250

300

350

400

0 20 40 60

# o

f G

PU

inte

rrupt

/ s

ec

FPS

Quake3 demo4 (320x240)

Quake3 demo4 (640x480)

Intel GMA 950 (Apple MacBook)

Nvidia 6150 Go (HP Pavillion tablet)

PowerVR (Samsung GalaxyS)

A GPU interrupt rate can be used to estimate a display rate without additional overheads

13/22

Multimedia Manager •  A feedback-driven CPU allocator •  Base assumption •  “Additional CPU share (or higher priority) improves

a display rate”

•  Desired frame rate (DFR) •  A currently achievable display rate

•  Multiplied by tolerable ratio (0.8)

IF current FPS < previous FPS AND

current FPS < DFR THEN

Increase CPU share

/* Exceptional cases: * 1) No relationship between CPU and FPS * 2) FPS is saturated below DFR * 3) Local CPU contention in a VM */ If no FPS improvement by CPU share increase (3 times) Then Decrease CPU share by half

If in initial phase Then Exponential increase Else Linear increase

14/22

Priority Boosting •  Responsive dispatching •  Problem •  The hypervisor does not distinguish the types of

events for priority boosting •  A VM that will handle a multimedia event cannot preempt

a currently running VM handling a normal event.

•  Higher priority for multimedia-related events •  e.g., video, audio, one-shot timer

MMBOOST

IOBOOST

Normal priority Priority

Multimedia events

Other events

Based on remaining CPU shares

15/22

Evaluation •  Experimental environment •  Intel MacBook with Intel GMA 950 •  Xen 3.4.0 with Ubuntu 8.04 •  Implementation based on Xen Credit scheduler

•  Two-VM scenario •  One with direct I/O + one with indirect (hosted) I/O •  Presenting the case of direct I/O in this talk

•  See the paper for the details of the indirect I/O case

16/22

0 5

10 15 20 25 30

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85

FPS

Time (sec)

Real FPS Estimated FPS Video playback (720p) (w/ CPU-bound VM)

Estimation Accuracy •  Estimation accuracy •  Error rates: 0.55%~3.05%

0

20

40

60

80

100

0 5 10 15 20 25 30 35 40 45 50 55 60 65

FPS

Time (sec)

Real FPS Estimated FPS Estimated FPS (EWMA, w=0.2) Quake 3 (w/ CPU-bound VM)

17/22

multimedia manager disabled

Estimation Overhead •  CPU overhead caused by page faults •  Video playback •  0.3~1% with sampling •  Less than 5% with tracking all pages

Overhead All

pages Sampling

1/8 pages 1/32 pages 1/128 pages

Low resolution (640x354) 4.95% 1.10% 0.54% 0.58%

High resolution (1280x720) 3.91% 1.04% 0.69% 0.33%

18/22

Multimedia Manager •  Video playback (720p) + CPU-bound VM

0 10 20 30 40 50 60 70 80 90 100

0

5

10

15

20

25

0 10 20 30 40 50 60 70 80

CPU

shar

e (%

)

FPS

Time (sec)

FPS DFR CPU share (%)

20

30

40

50

60

70

80

90

100

5

10

15

20

25

5 6 7 8 9 10

40

50

60

70

80

90

100

10

15

20

25

80 81 82 83 84

19/22

Performance Improvement •  Performance improvement •  Closed to maximum achievable frame rates

0

5

10

15

20

25

Ave

rage

FPS

Competing workloads in another VM

Credit scheduler

Credit scheduler w/ multimedia support

0

20

40

60

80

100

Ave

rage

FPS

Competing workloads in another VM

Credit scheduler

Credit scheduler w/ multimedia support

VM VM

Hypervisor

Video playback or 3D game

Competing workloads

Video playback (720p) on VLC media player Quake III Arena (demo1)

20/22

Limitations & Discussion •  Network-streamed multimedia •  Additional preemption support required for

multimedia-related network packets

•  Multiple multimedia workloads in a VM •  Multimedia manager algorithm should be

refined to satisfy QoS of mixed multimedia workloads in the same VM

•  Adaptive management for SMP VMs •  Adaptive vCPU allocation based on hosted

multimedia workloads

21/22

Conclusions •  Demands for multimedia-aware hypervisor •  Multimedia are increasingly dominant in

virtualized systems

•  “Multimedia-friendly hypervisor scheduler” •  Transparent and lightweight multimedia support

on client-side virtualization

•  Future directions •  Multimedia for server-side VDI •  Multicore extension for SMP VMs •  Considerations for network-streamed multimedia

22/22

Thank You! •  Questions and comments

•  Contact •  [email protected]

23/22

EXTRA SLIDES

Workload Details •  Descriptions and CPU usages for used

workloads

25/22

Task-based Display Rate Management •  Different types of frame rate accounting

26/22

0 5

10 15 20 25 30

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85

FPS

Time (sec)

Real FPS Estimated FPS

Video playback (640x354) + Directory listing on the screen (ls –alR /) (w/ CPU-bound VM)

Error rate = 1.78%

For Unix-like OSes, a display rate is accounted to a previously scheduled task when a framebuffer write is observed (this heuristic works well because a display interface is interactive and is highly likely to be scheduled promptly on requests)

Local CPU Contention in a VM •  Increasing the number of CPU-bound tasks

with a video playback application

27/22

Native Linux Virtualized Linux w/ our scheme

Ø  Our scheme provides sufficient CPU to a VM (IDD) that hosts a multimedia workload even though local CPU contention increases Ø  No starvation of another CPU-bound VM (guest)