27
Xen on ARM Stefano Stabellini

ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Embed Size (px)

DESCRIPTION

During the last few months of 2011 the Xen Community started an effort to port Xen to ARMv7 with virtualization extensions, using the Cortex A15 processor as reference platform. The new Xen port is exploiting this set of hardware capabilities to run guest VMs in the most efficient way possible while keeping the ARM specific changes to the hypervisor and the Linux kernel to a minimum. Developing the new port we took the chance to remove legacy concepts like PV or HVM guests and only support a single kind of guests that is comparable to "PVH" in the Xen X86 world. Linux 3.7 was the first kernel release to run on Xen on ARM as Dom0 and DomU. Xen 4.3, out in July 2013, is the first hypervisor release to support ARMv7 with virtualization extensions and ARMv8. This talk will explain why ARM virtualization is set to be increasingly relevant for the automotive industry in the coming years. We will go on to describe how Xen exploits the strengths of the hardware to meet the requirements of the industry. We will illustrate the early design choices and we will evaluate whether they were proven successful or a failure.

Citation preview

Page 1: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen on ARM

Stefano Stabellini

Page 2: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

What is Xen?● a type-1 hypervisor● small footprint (less than 90K LOC)

Page 3: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen: Open SourceGPLv2 with DCO (like Linux)Diverse contributor community

Page 4: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen: Open Sourcesource:Mike Dayhttp://code.ncultra.org

Page 5: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen: the gears of the cloud● large user base

more than 10 million individuals users

● power the largest clouds inproduction

● not just for servers

Page 6: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen Architecture

Hardware

Xen

Dom0 DomU

HW drivers

PV backends PV Frontends

DomU

PV Frontends

DomU

PV Frontends

Page 7: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen Architecture:driver domains

Hardware

Xen

Dom0 DomU

NetFront

Disk Driver Domain

Toolstack Disk Driver

BlockBack

Network Driver Domain

Network Driver

NetBack BlockFront

Page 8: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

● disaggregation and componentization● security and isolation● resilience● hardware vendors can run their drivers in

separate VMs○ could run in a RTOS environment○ hidden from the user

■ media codecs, crypto keys, etc.

Xen Architecture:driver domains

Page 9: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen on ARM: not just a port● a lean and simple architecture

○ removed cruft accumulated during the years○ no emulation, no QEMU○ use PV drivers for IO as early as possible○ one type of guest○ exploit the hardware as much as possible

● a very good match for the hardware● clean architecture = small code base

Page 10: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen on ARM architecture

Page 11: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen on ARM architecture

Page 12: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Code sizesometimes smaller is better

● X86_64-bit: ~120,000LOC (~4,000 ASM)● ARM code ~= 1/10 x86_64 code

Common ARMv7 ARMv8 Total

xen/arch/arm 5,122 1,969 821 7,912

C 5,023 406 344 5,773

ASM 99 1,563 477 2,139

xen/include/asm-arm 2,315 563 666 3,544

TOTAL 7,437 2,532 1,487 11,456

Page 13: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Achievements of one year

11/11 08/12 11/12 03/13 07/13

First Xen on ARM talk atXen Summit 2012

Xen support for ARM upstream in Linux 3.7

Xen running on real ARM hardware

09/12

Xen 64-bit on ARM64

01/13

Citrix announces that will be joining Linaro

Xen support for ARM64 upstream in Linux 3.11

06/13

Xen 4.3 released with ARM and ARM64 support

Part-time Xen ARM hacking starts

You are here

Page 14: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen-devel ARM traffic from August 2012: ● 4685 emails: 360 emails per month!● 39% of which are not from Citrix

A growing community

Page 15: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Hardware supportUpstream:● Versatile Express Cortex A15● Arndale board● ARMv8 FVP

In progress:● Cubieboard2● Calxeda “Midway”● Applied Micro “Mustang”● Broadcom Brahma-B15● OMAP5

Page 16: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Porting Xen to a new board● Xen only relies on GIC and GT

● platform specific code in Xen is reduced to:

○ secondary cpus bring up

○ UART drivers

○ any platform specific bootup quirks (ideally none)

Page 17: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Upstream featuresXen v4.3:● basic lifecycle operations● memory ballooning● scheduler configurations and vcpu pinning

Linux v3.11:● dom0 and domU support● 32-bit and 64-bit support● SMP support● PV disk, network and console

Page 18: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Android on Xen on ARM● Android is based on the Linux kernel

○ Jelly Bean uses Linux 3.4, when it updates to 3.7 will get Xen on ARM support out of the box

● Additional work needed to support client devices (compass, GPS, etc.) on multiple VMs○ easy to export 1 device to 1 VM○ otherwise each type of device needs a PV drivers

pair

Page 19: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

PV ProtocolsRequest Producer

Request Consumer

Response Producer

Response Consumer

Backend Frontend

Page 20: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

PV Protocols● shared ring protocol● software interrupts AKA event channels● consensual memory sharing: grant table● easy to write● plenty of examples

○ network, block, console, PCI, keyboard, mouse, framebuffer, sound, SCSI, USB, …

Page 21: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Porting other OSes to Xen on ARM● No invasive modifications needed● only some new drivers:

○ grant table, xenbus and event channels○ PV drivers for network, block, console, etc.

● BSD drivers already exist in NetBSD and FreeBSD, can they be reused?

● FreeBSD port to Xen on ARM in progress

Page 22: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Coming in Xen 4.4● 64-bit guest support● live-migration● SWIOTLB

Page 23: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

A look into the future● IOMMU support in Xen● device assignment● UEFI booting● ACPI support

Page 24: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Xen for automotive: why?● type-1● small footprint

○ small codebase○ no QEMU, no emulation

● driver domains / service VMs○ componentization○ security○ support for legacy drivers

● supports Linux out of the box● easy to port other OSes to Xen on ARM

Page 25: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

● http://www.xenproject.org

● Xen on ARM @wiki.xenproject.org goo.gl/FKNXe

● http://lists.xen.org/mailman/listinfo/xen-devel

More Information

Page 26: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix

Questions?

Page 27: ALSF13: Xen on ARM - Virtualization for the Automotive Industry - Stefano Stabellini, Citrix