xen

reelingripehalfSoftware and s/w Development

Dec 14, 2013 (3 years and 9 months ago)

70 views

Xen and the Art of Virtualization


Paul Barham, Boris Dragovic, Keir Fraser, Steven Hand, Tim Harris,

Alex Ho, Rolf Neugebauer, Ian Pratt, Andrew Warfield

Apology / Disclaimer

Why Virtualise?


Consolidate machines


Isolate performance


Stay flexible

HARDWARE

HARDWARE

???

HARDWARE

???

Linux

WinXP

HARDWARE

???

Linux

WinXP

Mirage

HARDWARE

Virtual Machine Monitor

Linux

WinXP

Mirage

How to Build a VMM 1: Emulation

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

Guest App

Guest App

“Physical” memory

Virtual MMU

Virtual System Calls

Virtual CPU

How to Build a VMM 2: Trap and
Emulate

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

“Physical” memory

Virtual MMU

Virtual System Calls

Guest App

How to Build a VMM 2: Trap and
Emulate

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

“Physical” memory

Virtual MMU

Virtual System Calls

Guest App

add %eax, %ebx

How to Build a VMM 2: Trap and
Emulate

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

“Physical” memory

Virtual MMU

Virtual System Calls

Guest App

outb %al

How to Build a VMM 2: Trap and
Emulate

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

“Physical” memory

Virtual MMU

Virtual System Calls

Guest App

outb %al

How to Build a VMM 2: Trap and
Emulate

HARDWARE

Normal OS

EMULATOR PROCESS

Guest Kernel

“Physical” memory

Virtual MMU

Virtual System Calls

Guest App

sysenter

handle_sysenter

How to Build a VMM 2: Trap and
Emulate

for(i = 0; i < 256; i++)

mangle_pagetable_entry(&ptes[i]);




256 traps into the emulator


Severe performance penalty

How to Build a VMM 3: Dynamic
Binary Translation

HARDWARE

Normal OS

TRANSLATOR PROCESS

Rewritten

Guest Kernel

Rewritten

Guest App

“Physical” memory

Virtual MMU

Virtual System Calls

How to Build a VMM 3: Dynamic
Binary Translation

for(i = 0; i < 256; i++)

mangle_pagetable_entry(&ptes[i]);

How to Build a VMM 3: Dynamic
Binary Translation

pte_t new_ptes[256];

for(i = 0; i < 256; i++)

new_ptes[i] =
mangled_entry(&ptes[i]);

register_new_ptes(new_ptes, 256);


But when is this a safe alteration?

How to Build a VMM 4: Xen

Q. But when is this a safe alteration?

A. Let the humans worry about that.


Manually hack the OS: “paravirtualisation”.

Xen: Founding Principles


Minimally alter guest OS


Don't disguise multiplexing


Thusly, be faster than the competition

VMWare Memory Management

VAS Pages

“Physical” frames

VMWare Memory Management

VAS Pages

“Physical” frames

Page

Table

VMWare Memory Management

VAS Pages

Physical frames

Page

Table

(not

really)

VMWare Memory Management

VAS Pages

Physical frames

Shadow

Page

Table

Xen Memory Management

VAS Pages

Physical frames

Xen Memory Management

VAS Pages

Physical frames

Page

Table

VMWare I/O

“Physical”

Memory

“Device” Memory

“I/O

Ports”

“Device”

Ports

NE2000 Model

Rubbish NIC

One op at a time

Shared buffers


Xen I/O

Own

Memor
y

Packet

Async Queue
--
>

<
--

Async Queue

Hypervisor

Xen I/O

Own

Memor
y

Packet

Async Queue
--
>

<
--

Async Queue

Hypervisor

Xen I/O

Own

Memor
y

Buffer

Async Queue
--
>

<
--

Async Queue

Hypervisor

Strawman Warning


VMWare does that too


“Guest additions” are basically paravirt

Is it Any Good?