1. 30 1月, 2008 5 次提交
    • A
      KVM: MMU: Clean up MMU functions to take struct kvm when appropriate · f67a46f4
      Anthony Liguori 提交于
      Some of the MMU functions take a struct kvm_vcpu even though they affect all
      VCPUs.  This patch cleans up some of them to instead take a struct kvm.  This
      makes things a bit more clear.
      
      The main thing that was confusing me was whether certain functions need to be
      called on all VCPUs.
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      f67a46f4
    • M
      KVM: CodingStyle cleanup · d77c26fc
      Mike Day 提交于
      Signed-off-by: NMike D. Day <ncmike@ncultra.org>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      d77c26fc
    • I
      KVM: Remove the usage of page->private field by rmap · 290fc38d
      Izik Eidus 提交于
      When kvm uses user-allocated pages in the future for the guest, we won't
      be able to use page->private for rmap, since page->rmap is reserved for
      the filesystem.  So we move the rmap base pointers to the memory slot.
      
      A side effect of this is that we need to store the gfn of each gpte in
      the shadow pages, since the memory slot is addressed by gfn, instead of
      hfn like struct page.
      Signed-off-by: NIzik Eidus <izik@qumranet.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      290fc38d
    • A
      KVM: MMU: Make flooding detection work when guest page faults are bypassed · 12b7d28f
      Avi Kivity 提交于
      When we allow guest page faults to reach the guests directly, we lose
      the fault tracking which allows us to detect demand paging.  So we provide
      an alternate mechnism by clearing the accessed bit when we set a pte, and
      checking it later to see if the guest actually used it.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      12b7d28f
    • A
      KVM: Allow not-present guest page faults to bypass kvm · c7addb90
      Avi Kivity 提交于
      There are two classes of page faults trapped by kvm:
       - host page faults, where the fault is needed to allow kvm to install
         the shadow pte or update the guest accessed and dirty bits
       - guest page faults, where the guest has faulted and kvm simply injects
         the fault back into the guest to handle
      
      The second class, guest page faults, is pure overhead.  We can eliminate
      some of it on vmx using the following evil trick:
       - when we set up a shadow page table entry, if the corresponding guest pte
         is not present, set up the shadow pte as not present
       - if the guest pte _is_ present, mark the shadow pte as present but also
         set one of the reserved bits in the shadow pte
       - tell the vmx hardware not to trap faults which have the present bit clear
      
      With this, normal page-not-present faults go directly to the guest,
      bypassing kvm entirely.
      
      Unfortunately, this trick only works on Intel hardware, as AMD lacks a
      way to discriminate among page faults based on error code.  It is also
      a little risky since it uses reserved bits which might become unreserved
      in the future, so a module parameter is provided to disable it.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      c7addb90
  2. 13 10月, 2007 3 次提交
  3. 21 7月, 2007 1 次提交
    • A
      KVM: MMU: Store nx bit for large page shadows · d55e2cb2
      Avi Kivity 提交于
      We need to distinguish between large page shadows which have the nx bit set
      and those which don't.  The problem shows up when booting a newer smp Linux
      kernel, where the trampoline page (which is in real mode, which uses the
      same shadow pages as large pages) is using the same mapping as a kernel data
      page, which is mapped using nx, causing kvm to spin on that page.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      d55e2cb2
  4. 16 7月, 2007 16 次提交
  5. 03 5月, 2007 3 次提交
    • A
      KVM: Per-vcpu statistics · 1165f5fe
      Avi Kivity 提交于
      Make the exit statistics per-vcpu instead of global.  This gives a 3.5%
      boost when running one virtual machine per core on my two socket dual core
      (4 cores total) machine.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      1165f5fe
    • 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: MMU: Remove unnecessary check for pdptr access · ca5aac1f
      Avi Kivity 提交于
      We already special case the pdptr access, so no need to check it again.
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      ca5aac1f
  6. 04 3月, 2007 2 次提交
  7. 13 2月, 2007 1 次提交
  8. 27 1月, 2007 2 次提交
  9. 23 1月, 2007 1 次提交
    • A
      [PATCH] KVM: fix bogus pagefault on writable pages · fc3dffe1
      Avi Kivity 提交于
      If a page is marked as dirty in the guest pte, set_pte_common() can set the
      writable bit on newly-instantiated shadow pte.  This optimization avoids
      a write fault after the initial read fault.
      
      However, if a write fault instantiates the pte, fix_write_pf() incorrectly
      reports the fault as a guest page fault, and the guest oopses on what appears
      to be a correctly-mapped page.
      
      Fix is to detect the condition and only report a guest page fault on a user
      access to a kernel page.
      
      With the fix, a kvm guest can survive a whole night of running the kernel
      hacker's screensaver (make -j9 in a loop).
      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>
      fc3dffe1
  10. 06 1月, 2007 6 次提交