E6998 - Virtual Machines Lecture 4 Device Virtualization Scott Devine VMware, Inc.
Outline Types of Device Virtualization Storage Virtualization Direct Access Emulated Para-virtualized Storage Virtualization Copy-on-Write Disks
Computer System Organization CPU Memory MMU Controller Local Bus Interface High-Speed I/O Bus Frame Buffer NIC Controller Bridge LAN Low-Speed I/O Bus CD-ROM USB
Device Virtualization Goals Isolation Multiplexing Speed Mobility Interposition Device Virtualization Strategies Direct Access Emulation Para-virtualization
Direct Access Device CPU VM Local Bus High-Speed I/O Bus Low-Speed Guest OS CPU Memory MMU Controller Local Bus Interface High-Speed I/O Bus Frame Buffer NIC Controller Bridge LAN Low-Speed I/O Bus CD-ROM USB
Memory Isolation w/ Direct Access Device VM Guest OS CPU Memory MMU Controller Local Bus Interface IOMMU High-Speed I/O Bus Frame Buffer NIC Controller Bridge LAN Low-Speed I/O Bus CD-ROM USB
Virtualization Enabled Device VM1 Guest OS VM2 Guest OS CPU Memory MMU Controller Local Bus Interface IOMMU High-Speed I/O Bus vNIC 1 vNIC 2 Frame Buffer NIC Controller Bridge LAN Low-Speed I/O Bus CD-ROM USB
Direct Access Device Virtualization Allow Guest OS direct access to underlying device Positives Fast Simplify monitor Limited device drivers needed Negatives Need hardware support for safety (IOMMU) Need hardware support for multiplexing Hardware interface visible to guest Limits mobility of VM Interposition hard by definition
Emulated Devices Emulate a device in class Convert Emulated registers Memory mapped I/O or programmed I/O Convert Intermediate representation Back-ends per real device
Serial Port Example User App Guest Host OS Monitor Serial Chip ABC Emulation Generic Serial Layer Serial Chip ABC Driver Host OS Monitor Serial Chip XYZ LAN
Emulated Devices Positives Negatives Platform stability Allows interposition No special hardware support needed Isolation, multiplexing implemented by monitor Negatives Can be slow Drivers needed in monitor or host
Para-Virtualized Devices Guest passes requests to Monitor at a higher abstraction level Monitor calls made to initiate requests Buffers shared between guest / monitor Positives Simplify monitor Fast Negatives Monitor needs to supply guest-specific drivers Bootstrapping issues
Traditional Architecture Linux Linux (devel) XP Vista MacOS Virtual Machine Monitor Here the monitor needs to be self-sufficient. There is no help from an Operating System. What does this mean the monitor needs to have: CPU scheduler Memory allocator Device Drivers File system Network stack for administration Hardware
Hosted Monitor Architecture User App Guest OS (Linux) Host OS (Window XP) Virtual Machine Monitor Kernel Module The virtual machine monitor runs in its own address space at kernel level. The VMM time shares the hardware with the host. When the UserApp runs in the host, it switches to the VMM by way of a World Switch. The world switch save all the registers, page tables, etc of the host and then loads the state of the VMM. Initially the state of the VMM is setup up by the UserApp. This includes what the registers should be and the structure and contents of the page tables. When the VMM voluntarily gives up the CPU, it World Switches back to the host. Hardware
Source: http://www.vmware.com/pdf/esx2_performance_implications.pdf VMware ESX 2.0 Traditional arch for cpu scheduling, memory allocation, virtual disk, virtual network. Console OS is there for legacy devices, USB, and as a management platform, i.e. it has the network stack. Source: http://www.vmware.com/pdf/esx2_performance_implications.pdf
Hybrid Ex 2 - Xen 3.0 Para –virtualization Linux Guest Hardware-supported virtualization Unmodified Windows Isolated Device Drivers Source: Ottawa Linux Symposium 2006 presentation. http://www.cl.cam.ac.uk/netos/papers/
Hypervisor Hardware-supported single-use monitor Characteristics Uses Small size Runs in a special hardware mode Guest OS runs in normal priviledge level Uses Security System management Fault tolerance User Mode Operating System Kernel Mode Monitor Mode Hypervisor Hardware
Virtual Disks File on file system Meta-data in file Host file system Hypervisor file system Meta-data in file Maps disk blocks to file offsets Flat file Indexed file Allows disk to grow on demand
Copy-on-Write Disks Win XP + SP1 + SP2 + SP2 IE 7
Copy-on-Write Disks Win XP Reads + SP1 + SP2 + SP2 IE 7 Writes
Non-persistent Execution Win XP + SP1 + SP2 + SP2 IE 7 Reads Temp Writes