1. 03 5月, 2007 10 次提交
    • D
      KVM: Add mmu cache clear function · e0fa826f
      Dor Laor 提交于
      Functions that play around with the physical memory map
      need a way to clear mappings to possibly nonexistent or
      invalid memory.  Both the mmu cache and the processor tlb
      are cleared.
      Signed-off-by: NDor Laor <dor.laor@qumranet.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      e0fa826f
    • A
      KVM: SVM: Ensure timestamp counter monotonicity · 0cc5064d
      Avi Kivity 提交于
      When a vcpu is migrated from one cpu to another, its timestamp counter
      may lose its monotonic property if the host has unsynced timestamp counters.
      This can confuse the guest, sometimes to the point of refusing to boot.
      
      As the rdtsc instruction is rather fast on AMD processors (7-10 cycles),
      we can simply record the last host tsc when we drop the cpu, and adjust
      the vcpu tsc offset when we detect that we've migrated to a different cpu.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      0cc5064d
    • A
      KVM: MMU: Fix hugepage pdes mapping same physical address with different access · d28c6cfb
      Avi Kivity 提交于
      The kvm mmu keeps a shadow page for hugepage pdes; if several such pdes map
      the same physical address, they share the same shadow page.  This is a fairly
      common case (kernel mappings on i386 nonpae Linux, for example).
      
      However, if the two pdes map the same memory but with different permissions, kvm
      will happily use the cached shadow page.  If the access through the more
      permissive pde will occur after the access to the strict pde, an endless pagefault
      loop will be generated and the guest will make no progress.
      
      Fix by making the access permissions part of the cache lookup key.
      
      The fix allows Xen pae to boot on kvm and run guest domains.
      
      Thanks to Jeremy Fitzhardinge for reporting the bug and testing the fix.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      d28c6cfb
    • A
      KVM: Remove set_cr0_no_modeswitch() arch op · f6528b03
      Avi Kivity 提交于
      set_cr0_no_modeswitch() was a hack to avoid corrupting segment registers.
      As we now cache the protected mode values on entry to real mode, this
      isn't an issue anymore, and it interferes with reboot (which usually _is_
      a modeswitch).
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      f6528b03
    • A
      KVM: MMU: Remove global pte tracking · aac01224
      Avi Kivity 提交于
      The initial, noncaching, version of the kvm mmu flushed the all nonglobal
      shadow page table translations (much like a native tlb flush).  The new
      implementation flushes translations only when they change, rendering global
      pte tracking superfluous.
      
      This removes the unused tracking mechanism and storage space.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      aac01224
    • A
      KVM: Avoid guest virtual addresses in string pio userspace interface · 039576c0
      Avi Kivity 提交于
      The current string pio interface communicates using guest virtual addresses,
      relying on userspace to translate addresses and to check permissions.  This
      interface cannot fully support guest smp, as the check needs to take into
      account two pages at one in case an unaligned string transfer straddles a
      page boundary.
      
      Change the interface not to communicate guest addresses at all; instead use
      a buffer page (mmaped by userspace) and do transfers there.  The kernel
      manages the virtual to physical translation and can perform the checks
      atomically by taking the appropriate locks.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      039576c0
    • A
      KVM: Add guest mode signal mask · 1961d276
      Avi Kivity 提交于
      Allow a special signal mask to be used while executing in guest mode.  This
      allows signals to be used to interrupt a vcpu without requiring signal
      delivery to a userspace handler, which is quite expensive.  Userspace still
      receives -EINTR and can get the signal via sigwait().
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      1961d276
    • A
      KVM: Handle cpuid in the kernel instead of punting to userspace · 06465c5a
      Avi Kivity 提交于
      KVM used to handle cpuid by letting userspace decide what values to
      return to the guest.  We now handle cpuid completely in the kernel.  We
      still let userspace decide which values the guest will see by having
      userspace set up the value table beforehand (this is necessary to allow
      management software to set the cpu features to the least common denominator,
      so that live migration can work).
      
      The motivation for the change is that kvm kernel code can be impacted by
      cpuid features, for example the x86 emulator.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      06465c5a
    • A
      KVM: Do not communicate to userspace through cpu registers during PIO · 46fc1477
      Avi Kivity 提交于
      Currently when passing the a PIO emulation request to userspace, we
      rely on userspace updating %rax (on 'in' instructions) and %rsi/%rdi/%rcx
      (on string instructions).  This (a) requires two extra ioctls for getting
      and setting the registers and (b) is unfriendly to non-x86 archs, when
      they get kvm ports.
      
      So fix by doing the register fixups in the kernel and passing to userspace
      only an abstract description of the PIO to be done.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      46fc1477
    • A
      KVM: Use a shared page for kernel/user communication when runing a vcpu · 9a2bb7f4
      Avi Kivity 提交于
      Instead of passing a 'struct kvm_run' back and forth between the kernel and
      userspace, allocate a page and allow the user to mmap() it.  This reduces
      needless copying and makes the interface expandable by providing lots of
      free space.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      9a2bb7f4
  2. 04 3月, 2007 4 次提交
  3. 13 2月, 2007 3 次提交
  4. 27 1月, 2007 1 次提交
  5. 06 1月, 2007 13 次提交
  6. 31 12月, 2006 3 次提交
  7. 14 12月, 2006 1 次提交
  8. 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