200 likes | 311 Views
The Best of Both Worlds with On-Demand Virtualization. Thawan Kooburat Michael Swift University of Wisconsin - Madison. Motivation. Virtualization offers many benefits Why virtualization has not yet become ubiquitous?. Concerns with Virtualization.
E N D
The Best of Both Worlds with On-Demand Virtualization Thawan KooburatMichael Swift University of Wisconsin - Madison
Motivation • Virtualization offers many benefits • Why virtualization has not yet become ubiquitous?
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
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
Uses of On-Demand Virtualization • Datacenter • Resource Consolidation • Debugging • Desktop Environment • Migration • Checkpointing • Introspection
Main Ideas VMM Physical Native OS Guest OS VM • High-level Design • Pause OS operation and resume inside VM • Set aside VMM partition on disk • Virtualize everything
Capturing OS and Process State \\ Native Guest VM Physical Virtualize VMM • Problem: • Need to transfer OS/Process state from native to virtual execution • Solution: • Hibernate/Resume can capture both OS and process state • Snapshot system memory and write image to disk
Capturing OS and Process States Start VM Physical VMM VMM Kernel Native Kernel Guest Kernel Boot Hibernate Resume VMM Partition Guest Partition
Discovering Devices inside the VM \\ Virtualize Guest Native Physical VM Disk Disk NIC NIC • 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
Preserving Device Bindings Apps Apps Virtualize VM Physical Kernel Kernel Disk Disk NIC NIC • 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 Network Disk Applications Applications Kernel Kernel bond0 /dev/mapper/vdisk e1000e e1000 SATA IDE Phy VM Phy VM • 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
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
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
Future Work • Hibernate to RAM • Use kexec for machine reboot • Support devirtualize • Transfer VM back to its original machine
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
Questions Q/A
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
Dealing with Platform Devices \\ \\ VM VM Guest Kernel Boot Kernel Resume config config Hibernate Image • 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
Conversion Time Hibernate10 s Reboot machine 50 s Boot VM 9 s Resume 21 s
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