1. 24 4月, 2012 1 次提交
  2. 20 4月, 2012 1 次提交
    • A
      KVM: Fix page-crossing MMIO · f78146b0
      Avi Kivity 提交于
      MMIO that are split across a page boundary are currently broken - the
      code does not expect to be aborted by the exit to userspace for the
      first MMIO fragment.
      
      This patch fixes the problem by generalizing the current code for handling
      16-byte MMIOs to handle a number of "fragments", and changes the MMIO
      code to create those fragments.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      f78146b0
  3. 12 4月, 2012 1 次提交
    • A
      KVM: unmap pages from the iommu when slots are removed · 32f6daad
      Alex Williamson 提交于
      We've been adding new mappings, but not destroying old mappings.
      This can lead to a page leak as pages are pinned using
      get_user_pages, but only unpinned with put_page if they still
      exist in the memslots list on vm shutdown.  A memslot that is
      destroyed while an iommu domain is enabled for the guest will
      therefore result in an elevated page reference count that is
      never cleared.
      
      Additionally, without this fix, the iommu is only programmed
      with the first translation for a gpa.  This can result in
      peer-to-peer errors if a mapping is destroyed and replaced by a
      new mapping at the same gpa as the iommu will still be pointing
      to the original, pinned memory address.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      32f6daad
  4. 08 4月, 2012 5 次提交
  5. 20 3月, 2012 1 次提交
  6. 08 3月, 2012 4 次提交
  7. 05 3月, 2012 5 次提交
  8. 27 12月, 2011 11 次提交
  9. 26 9月, 2011 4 次提交
    • A
      KVM: Fix simultaneous NMIs · 7460fb4a
      Avi Kivity 提交于
      If simultaneous NMIs happen, we're supposed to queue the second
      and next (collapsing them), but currently we sometimes collapse
      the second into the first.
      
      Fix by using a counter for pending NMIs instead of a bool; since
      the counter limit depends on whether the processor is currently
      in an NMI handler, which can only be checked in vcpu context
      (via the NMI mask), we add a new KVM_REQ_NMI to request recalculation
      of the counter.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      7460fb4a
    • J
      KVM: Clean up and extend rate-limited output · bd80158a
      Jan Kiszka 提交于
      The use of printk_ratelimit is discouraged, replace it with
      pr*_ratelimited or __ratelimit. While at it, convert remaining
      guest-triggerable printks to rate-limited variants.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      bd80158a
    • S
      KVM: Intelligent device lookup on I/O bus · 743eeb0b
      Sasha Levin 提交于
      Currently the method of dealing with an IO operation on a bus (PIO/MMIO)
      is to call the read or write callback for each device registered
      on the bus until we find a device which handles it.
      
      Since the number of devices on a bus can be significant due to ioeventfds
      and coalesced MMIO zones, this leads to a lot of overhead on each IO
      operation.
      
      Instead of registering devices, we now register ranges which points to
      a device. Lookup is done using an efficient bsearch instead of a linear
      search.
      
      Performance test was conducted by comparing exit count per second with
      200 ioeventfds created on one byte and the guest is trying to access a
      different byte continuously (triggering usermode exits).
      Before the patch the guest has achieved 259k exits per second, after the
      patch the guest does 274k exits per second.
      
      Cc: Avi Kivity <avi@redhat.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      743eeb0b
    • S
      KVM: Make coalesced mmio use a device per zone · 2b3c246a
      Sasha Levin 提交于
      This patch changes coalesced mmio to create one mmio device per
      zone instead of handling all zones in one device.
      
      Doing so enables us to take advantage of existing locking and prevents
      a race condition between coalesced mmio registration/unregistration
      and lookups.
      Suggested-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      2b3c246a
  10. 24 7月, 2011 1 次提交
  11. 14 7月, 2011 1 次提交
    • G
      KVM: Steal time implementation · c9aaa895
      Glauber Costa 提交于
      To implement steal time, we need the hypervisor to pass the guest
      information about how much time was spent running other processes
      outside the VM, while the vcpu had meaningful work to do - halt
      time does not count.
      
      This information is acquired through the run_delay field of
      delayacct/schedstats infrastructure, that counts time spent in a
      runqueue but not running.
      
      Steal time is a per-cpu information, so the traditional MSR-based
      infrastructure is used. A new msr, KVM_MSR_STEAL_TIME, holds the
      memory area address containing information about steal time
      
      This patch contains the hypervisor part of the steal time infrasructure,
      and can be backported independently of the guest portion.
      
      [avi, yongjie: export delayacct_on, to avoid build failures in some configs]
      Signed-off-by: NGlauber Costa <glommer@redhat.com>
      Tested-by: NEric B Munson <emunson@mgebm.net>
      CC: Rik van Riel <riel@redhat.com>
      CC: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      CC: Peter Zijlstra <peterz@infradead.org>
      CC: Anthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NYongjie Ren <yongjie.ren@intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      c9aaa895
  12. 12 7月, 2011 1 次提交
  13. 22 5月, 2011 2 次提交
  14. 11 5月, 2011 2 次提交
    • J
      KVM: Fix off by one in kvm_for_each_vcpu iteration · b42fc3cb
      Jeff Mahoney 提交于
      This patch avoids gcc issuing the following warning when KVM_MAX_VCPUS=1:
      warning: array subscript is above array bounds
      
      kvm_for_each_vcpu currently checks to see if the index for the vcpu is
      valid /after/ loading it. We don't run into problems because the address
      is still inside the enclosing struct kvm and we never deference or write
      to it, so this isn't a security issue.
      
      The warning occurs when KVM_MAX_VCPUS=1 because the increment portion of
      the loop will *always* cause the loop to load an invalid location since
      ++idx will always be > 0.
      
      This patch moves the load so that the check occurs before the load and
      we don't run into the compiler warning.
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NJeff Mahoney <jeffm@suse.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      b42fc3cb
    • A
      KVM: 16-byte mmio support · cef4dea0
      Avi Kivity 提交于
      Since sse instructions can issue 16-byte mmios, we need to support them.  We
      can't increase the kvm_run mmio buffer size to 16 bytes without breaking
      compatibility, so instead we break the large mmios into two smaller 8-byte
      ones.  Since the bus is 64-bit we aren't breaking any atomicity guarantees.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      cef4dea0