1. 23 1月, 2007 2 次提交
    • A
      [PATCH] KVM: fix race between mmio reads and injected interrupts · cccf748b
      Avi Kivity 提交于
      The kvm mmio read path looks like:
      
       1. guest read faults
       2. kvm emulates read, calls emulator_read_emulated()
       3. fails as a read requires userspace help
       4. exit to userspace
       5. userspace emulates read, kvm sets vcpu->mmio_read_completed
       6. re-enter guest, fault again
       7. kvm emulates read, calls emulator_read_emulated()
       8. succeeds as vcpu->mmio_read_emulated is set
       9. instruction completes and guest is resumed
      
      A problem surfaces if the userspace exit (step 5) also requests an interrupt
      injection.  In that case, the guest does not re-execute the original
      instruction, but the interrupt handler.  The next time an mmio read is
      exectued (likely for a different address), step 3 will find
      vcpu->mmio_read_completed set and return the value read for the original
      instruction.
      
      The problem manifested itself in a few annoying ways:
      - little squares appear randomly on console when switching virtual terminals
      - ne2000 fails under nfs read load
      - rtl8139 complains about "pci errors" even though the device model is
        incapable of issuing them.
      
      Fix by skipping interrupt injection if an mmio read is pending.
      
      A better fix is to avoid re-entry into the guest, and re-emulating immediately
      instead.  However that's a bit more complex.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cccf748b
    • H
      [PATCH] vmx: Fix register constraint in launch code · e0015489
      Herbert Xu 提交于
      Both "=r" and "=g" breaks my build on i386:
      
        $ make
          CC [M]  drivers/kvm/vmx.o
        {standard input}: Assembler messages:
        {standard input}:3318: Error: bad register name `%sil'
        make[1]: *** [drivers/kvm/vmx.o] Error 1
        make: *** [_module_drivers/kvm] Error 2
      
      The reason is that setbe requires an 8-bit register but "=r" does not
      constrain the target register to be one that has an 8-bit version on
      i386.
      
      According to
      
      	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10153
      
      the correct constraint is "=q".
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e0015489
  2. 12 1月, 2007 1 次提交
    • I
      [PATCH] KVM: add VM-exit profiling · 07031e14
      Ingo Molnar 提交于
      This adds the profile=kvm boot option, which enables KVM to profile VM
      exits.
      
      Use: "readprofile -m ./System.map | sort -n" to see the resulting
      output:
      
         [...]
         18246 serial_out                               148.3415
         18945 native_flush_tlb                         378.9000
         23618 serial_in                                212.7748
         29279 __spin_unlock_irq                        622.9574
         43447 native_apic_write                        2068.9048
         52702 enable_8259A_irq                         742.2817
         54250 vgacon_scroll                             89.3740
         67394 ide_inb                                  6126.7273
         79514 copy_page_range                           98.1654
         84868 do_wp_page                                86.6000
        140266 pit_read                                 783.6089
        151436 ide_outb                                 25239.3333
        152668 native_io_delay                          21809.7143
        174783 mask_and_ack_8259A                       783.7803
        362404 native_set_pte_at                        36240.4000
       1688747 total                                      0.5009
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NAvi Kivity <avi@qumranet.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      07031e14
  3. 06 1月, 2007 10 次提交
  4. 31 12月, 2006 4 次提交
  5. 23 12月, 2006 2 次提交
  6. 14 12月, 2006 7 次提交
  7. 11 12月, 2006 1 次提交
    • A
      [PATCH] kvm: userspace interface · 6aa8b732
      Avi Kivity 提交于
      web site: http://kvm.sourceforge.net
      
      mailing list: kvm-devel@lists.sourceforge.net
        (http://lists.sourceforge.net/lists/listinfo/kvm-devel)
      
      The following patchset adds a driver for Intel's hardware virtualization
      extensions to the x86 architecture.  The driver adds a character device
      (/dev/kvm) that exposes the virtualization capabilities to userspace.  Using
      this driver, a process can run a virtual machine (a "guest") in a fully
      virtualized PC containing its own virtual hard disks, network adapters, and
      display.
      
      Using this driver, one can start multiple virtual machines on a host.
      
      Each virtual machine is a process on the host; a virtual cpu is a thread in
      that process.  kill(1), nice(1), top(1) work as expected.  In effect, the
      driver adds a third execution mode to the existing two: we now have kernel
      mode, user mode, and guest mode.  Guest mode has its own address space mapping
      guest physical memory (which is accessible to user mode by mmap()ing
      /dev/kvm).  Guest mode has no access to any I/O devices; any such access is
      intercepted and directed to user mode for emulation.
      
      The driver supports i386 and x86_64 hosts and guests.  All combinations are
      allowed except x86_64 guest on i386 host.  For i386 guests and hosts, both pae
      and non-pae paging modes are supported.
      
      SMP hosts and UP guests are supported.  At the moment only Intel
      hardware is supported, but AMD virtualization support is being worked on.
      
      Performance currently is non-stellar due to the naive implementation of the
      mmu virtualization, which throws away most of the shadow page table entries
      every context switch.  We plan to address this in two ways:
      
      - cache shadow page tables across tlb flushes
      - wait until AMD and Intel release processors with nested page tables
      
      Currently a virtual desktop is responsive but consumes a lot of CPU.  Under
      Windows I tried playing pinball and watching a few flash movies; with a recent
      CPU one can hardly feel the virtualization.  Linux/X is slower, probably due
      to X being in a separate process.
      
      In addition to the driver, you need a slightly modified qemu to provide I/O
      device emulation and the BIOS.
      
      Caveats (akpm: might no longer be true):
      
      - The Windows install currently bluescreens due to a problem with the
        virtual APIC.  We are working on a fix.  A temporary workaround is to
        use an existing image or install through qemu
      - Windows 64-bit does not work.  That's also true for qemu, so it's
        probably a problem with the device model.
      
      [bero@arklinux.org: build fix]
      [simon.kagstrom@bth.se: build fix, other fixes]
      [uril@qumranet.com: KVM: Expose interrupt bitmap]
      [akpm@osdl.org: i386 build fix]
      [mingo@elte.hu: i386 fixes]
      [rdreier@cisco.com: add log levels to all printks]
      [randy.dunlap@oracle.com: Fix sparse NULL and C99 struct init warnings]
      [anthony@codemonkey.ws: KVM: AMD SVM: 32-bit host support]
      Signed-off-by: NYaniv Kamay <yaniv@qumranet.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      Cc: Simon Kagstrom <simon.kagstrom@bth.se>
      Cc: Bernhard Rosenkraenzer <bero@arklinux.org>
      Signed-off-by: NUri Lublin <uril@qumranet.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NAnthony Liguori <anthony@codemonkey.ws>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6aa8b732