Skip to content
  1. May 03, 2007
    • Avi Kivity's avatar
      KVM: Add physical memory aliasing feature · e8207547
      Avi Kivity authored
      
      
      With this, we can specify that accesses to one physical memory range will
      be remapped to another.  This is useful for the vga window at 0xa0000 which
      is used as a movable window into the (much larger) framebuffer.
      
      Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
      e8207547
    • Avi Kivity's avatar
      KVM: Simply gfn_to_page() · 954bbbc2
      Avi Kivity authored
      
      
      Mapping a guest page to a host page is a common operation.  Currently,
      one has first to find the memory slot where the page belongs (gfn_to_memslot),
      then locate the page itself (gfn_to_page()).
      
      This is clumsy, and also won't work well with memory aliases.  So simplify
      gfn_to_page() not to require memory slot translation first, and instead do it
      internally.
      
      Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
      954bbbc2
    • Dor Laor's avatar
      KVM: Add mmu cache clear function · e0fa826f
      Dor Laor authored
      
      
      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: default avatarDor Laor <dor.laor@qumranet.com>
      Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
      e0fa826f
    • Avi Kivity's avatar
      KVM: SVM: Ensure timestamp counter monotonicity · 0cc5064d
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      0cc5064d
    • Avi Kivity's avatar
      KVM: MMU: Fix hugepage pdes mapping same physical address with different access · d28c6cfb
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      d28c6cfb
    • Avi Kivity's avatar
      KVM: Remove set_cr0_no_modeswitch() arch op · f6528b03
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      f6528b03
    • Avi Kivity's avatar
      KVM: MMU: Remove global pte tracking · aac01224
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      aac01224
    • Avi Kivity's avatar
      KVM: Avoid guest virtual addresses in string pio userspace interface · 039576c0
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      039576c0
    • Avi Kivity's avatar
      KVM: Add guest mode signal mask · 1961d276
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      1961d276
    • Avi Kivity's avatar
      KVM: Handle cpuid in the kernel instead of punting to userspace · 06465c5a
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      06465c5a
    • Avi Kivity's avatar
      KVM: Do not communicate to userspace through cpu registers during PIO · 46fc1477
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      46fc1477
    • Avi Kivity's avatar
      KVM: Use a shared page for kernel/user communication when runing a vcpu · 9a2bb7f4
      Avi Kivity authored
      
      
      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: default avatarAvi Kivity <avi@qumranet.com>
      9a2bb7f4
  2. Mar 04, 2007
  3. Feb 12, 2007
  4. Jan 26, 2007
  5. Jan 06, 2007
  6. Dec 30, 2006
  7. Dec 13, 2006
  8. Dec 10, 2006
    • Avi Kivity's avatar
      [PATCH] kvm: userspace interface · 6aa8b732
      Avi Kivity authored
      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: default avatarYaniv Kamay <yaniv@qumranet.com>
      Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
      Cc: Simon Kagstrom <simon.kagstrom@bth.se>
      Cc: Bernhard Rosenkraenzer <bero@arklinux.org>
      Signed-off-by: default avatarUri Lublin <uril@qumranet.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: default avatarAnthony Liguori <anthony@codemonkey.ws>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      6aa8b732
Loading