thawan kooburat michael swift university of wisconsin - madison 1 the best of both worlds with...

20
THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

Upload: julius-foster

Post on 19-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

1

THAWAN KOOBURATMICHAEL SWIFT

UNIVERSITY OF WISCONSIN - MADISON

The Best of Both Worlds with

On-Demand Virtualization

Page 2: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

2

Motivation

Virtualization offers many benefits

Why virtualization has not yet become ubiquitous?

Page 3: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

3

Concerns with Virtualization

Virtualization adds an extra layer that introduces overhead all the time

Lack of functionality GPUs, WLAN and etc.

Performance overhead I/O Devices - Trap and emulate Memory Virtualization – Extra level of page tables

Page 4: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

4

On-Demand Virtualization

Mechanism Normally execute natively Virtualize on-demand Minimal service disruption

Benefits Native performance and full functionality Pay for virtualization overhead only when used

Page 5: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

5

Uses of On-Demand Virtualization

Datacenter Resource Consolidation Debugging

Desktop Environment Migration Checkpointing Introspection

Page 6: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

6

Main Ideas

High-level Design Pause OS operation and resume inside VM Set aside VMM partition on disk Virtualize everything

Physical

VMM

VMNative OSGuest OS

Page 7: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

7

Problem: Need to transfer OS/Process state from native to virtual

executionSolution:

Hibernate/Resume can capture both OS and process state Snapshot system memory and write image to disk

\\

Capturing OS and Process State

Native Guest VMPhysical Virtualize

VMM

Page 8: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

8

Capturing OS and Process States

Physical VMM

VMMPartition

GuestPartition

Native Kernel

HibernateBoot

Guest Kernel

Resume

VMMKernel

Start VM

Page 9: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

9

Discovering Devices inside the VM

Problem: Need to switch from physical to virtual devices

Solution: Use Hotplug support in device

Detach/disable original physical devices before hibernate Scan for virtual devices after resume

\\

9

VMPhysical Virtualize

Disk

Native

NIC Disk

Guest

NIC

Page 10: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

10

Problem: Need to preserve OS/Application state which ties to

devices Network connections, File systems

Need to transfer device bindings across different models/types of devices

Preserving Device Bindings

VMPhysical Virtualize

Disk

Kernel

NIC Disk

Kernel

NIC

Apps Apps

Page 11: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

11

Preserving Device Bindings

Solution: Use logical device to retain states and hide changes

Networks: Bonding Driver Detach physical NIC and attach virtual NIC after resume

Block Devices: Device Mapper Update DM’s table to point to a virtual block device

Applications

Phy VM

e1000e e1000

bond0

KernelApplications

Phy VM

SATA IDE

/dev/mapper/vdisk

KernelNetwork Disk

Page 12: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

12

The Cost of Preparation

Set aside VMM partition on disk No need to pre-allocate CPU or memory

Access hardware through logical devices Only for devices whose state must be preserved

Disable hardware that is not emulated by VMM Eg. IOMMU

Page 13: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

13

Status

Status Prototype

Linux 2.6.35 (~1200 lines of modification) TuxOnIce (Hibernation patch) KVM

Support one-way conversion from physical to virtual machine

Experience SCP/SSH remains open Take about 90 seconds to convert

Hibernating and rebooting take most of the time

Page 14: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

14

Future Work

Hibernate to RAMUse kexec for machine rebootSupport devirtualize

Transfer VM back to its original machine

Page 15: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

15

Conclusion

Benefits Add another method of using virtualization Allow more environments to benefit from virtualization

without its overhead all the time

Contributions On-demand virtualization is possible Existing mechanisms in OS can be repurposed

Page 16: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

16

Questions

Q/A

Page 17: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

17

Other Devices

CPU Current: Offline other CPUs, only one core is left

running Future: CPU hotplug

Memory Current: VM must have equal or more RAM than

physical machine Future: Memory hotplug

Display VGA is supported by all graphic cards Revert to legacy VGA mode before hibernate

Page 18: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

18

Dealing with Platform Devices

Platform devices Device on main board – i.e. timers, interrupt routers No hotplug support Kernel only configure them at boot time via ACPI

Solution Boot kernel pass configuration information to resume

kernel so that it can reconfigure its devices

\\VMBoot Kernel

Resumeconfig

\\VMGuest Kernel

config

HibernateImage

Page 19: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

19

Conversion Time

Hibernate10 s

Reboot machine50 s

Boot VM9 s

Resume21 s

Page 20: THAWAN KOOBURAT MICHAEL SWIFT UNIVERSITY OF WISCONSIN - MADISON 1 The Best of Both Worlds with On-Demand Virtualization

20

Overall Process

Hibernate and resume the kernel inside a virtual machine

Use hotplugging to detach and scan for new hardware

Reconfigure platform devices Update logical device mappings Resume OS subsystem/Applications