Device Virtualization

Document Sample
Device Virtualization Powered By Docstoc
					E6998 - Virtual Machines
        Lecture 4
  Device Virtualization
      Scott Devine
      VMware, Inc.
                           Outline
• Types of Device 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
 NIC           Controller            Bridge
                                                     Buffer


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
VM
Guest
 OS       CPU               Memory

          MMU               Controller


                                             Local Bus

                Interface
                                                                    High-Speed
                                                                      I/O Bus
                                                         Frame
        NIC        Controller            Bridge
                                                         Buffer


   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
         NIC               Controller          Bridge
                                                               Buffer


    LAN



                                                                    Low-Speed
                                                                      I/O Bus
                             CD-ROM                USB
               Virtualization Enabled Device
VM1            VM2
Guest          Guest
 OS      CPU    OS
                                  Memory

         MMU                      Controller


                                                   Local Bus

               Interface     IOMMU
                                                                          High-Speed
                                                                            I/O Bus
vNIC 1         vNIC 2
                                                               Frame
         NIC               Controller          Bridge
                                                               Buffer


     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
   – Emulated registers
   – Memory mapped I/O or programmed I/O
• Convert
   – Intermediate representation
• Back-ends per real device
                    Serial Port Example
           User App
                                             Guest
                           Serial Chip
                              ABC
                           Emulation


                 Generic Serial Layer
                                         Serial Chip
                                            ABC
                                           Driver
 Host OS




                                            Monitor


Serial     LAN
 Chip
 XYZ
                   Emulated Devices
• Positives
   – 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


                          Hardware
 Hosted Monitor Architecture




             User App                 Guest OS (Linux)




              Kernel
              Module

Host OS (Window XP)                Virtual Machine Monitor


                        Hardware
                    VMware ESX 2.0




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                                   User
                                                    Mode
  – Small size
  – Runs in a special
    hardware mode
  – Guest OS runs in normal
    priviledge level                               Kernel
                                Operating System
• Uses                                             Mode

  – Security
                                                   Monitor
  – System management               Hypervisor
                                                   Mode
  – Fault tolerance
                                    Hardware
                       Virtual Disks
• File on file system
   – 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




                        + SP2
+ SP1         + SP2
                         IE 7
        Copy-on-Write Disks

              Win XP




                        + SP2
                                Reads
+ SP1         + SP2
                         IE 7   Writes
 Non-persistent Execution

         Win XP




                   + SP2
+ SP1     + SP2
                    IE 7




                            Reads
                   Temp
                            Writes