1. 03 9月, 2014 1 次提交
  2. 29 8月, 2014 2 次提交
  3. 22 8月, 2014 1 次提交
  4. 21 8月, 2014 1 次提交
  5. 06 8月, 2014 1 次提交
    • P
      KVM: Move more code under CONFIG_HAVE_KVM_IRQFD · c77dcacb
      Paolo Bonzini 提交于
      Commits e4d57e1e (KVM: Move irq notifier implementation into
      eventfd.c, 2014-06-30) included the irq notifier code unconditionally
      in eventfd.c, while it was under CONFIG_HAVE_KVM_IRQCHIP before.
      
      Similarly, commit 297e2105 (KVM: Give IRQFD its own separate enabling
      Kconfig option, 2014-06-30) moved code from CONFIG_HAVE_IRQ_ROUTING
      to CONFIG_HAVE_KVM_IRQFD but forgot to move the pieces that used to be
      under CONFIG_HAVE_KVM_IRQCHIP.
      
      Together, this broke compilation without CONFIG_KVM_XICS.  Fix by adding
      or changing the #ifdefs so that they point at CONFIG_HAVE_KVM_IRQFD.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c77dcacb
  6. 05 8月, 2014 1 次提交
  7. 28 7月, 2014 2 次提交
  8. 05 6月, 2014 1 次提交
  9. 03 6月, 2014 1 次提交
  10. 05 5月, 2014 1 次提交
    • C
      kvm/irqchip: Speed up KVM_SET_GSI_ROUTING · 719d93cd
      Christian Borntraeger 提交于
      When starting lots of dataplane devices the bootup takes very long on
      Christian's s390 with irqfd patches. With larger setups he is even
      able to trigger some timeouts in some components.  Turns out that the
      KVM_SET_GSI_ROUTING ioctl takes very long (strace claims up to 0.1 sec)
      when having multiple CPUs.  This is caused by the  synchronize_rcu and
      the HZ=100 of s390.  By changing the code to use a private srcu we can
      speed things up.  This patch reduces the boot time till mounting root
      from 8 to 2 seconds on my s390 guest with 100 disks.
      
      Uses of hlist_for_each_entry_rcu, hlist_add_head_rcu, hlist_del_init_rcu
      are fine because they do not have lockdep checks (hlist_for_each_entry_rcu
      uses rcu_dereference_raw rather than rcu_dereference, and write-sides
      do not do rcu lockdep at all).
      
      Note that we're hardly relying on the "sleepable" part of srcu.  We just
      want SRCU's faster detection of grace periods.
      
      Testing was done by Andrew Theurer using netperf tests STREAM, MAERTS
      and RR.  The difference between results "before" and "after" the patch
      has mean -0.2% and standard deviation 0.6%.  Using a paired t-test on the
      data points says that there is a 2.5% probability that the patch is the
      cause of the performance difference (rather than a random fluctuation).
      
      (Restricting the t-test to RR, which is the most likely to be affected,
      changes the numbers to respectively -0.3% mean, 0.7% stdev, and 8%
      probability that the numbers actually say something about the patch.
      The probability increases mostly because there are fewer data points).
      
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> # s390
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      719d93cd
  11. 24 4月, 2014 1 次提交
  12. 22 4月, 2014 1 次提交
  13. 18 4月, 2014 1 次提交
    • M
      KVM: VMX: speed up wildcard MMIO EVENTFD · 68c3b4d1
      Michael S. Tsirkin 提交于
      With KVM, MMIO is much slower than PIO, due to the need to
      do page walk and emulation. But with EPT, it does not have to be: we
      know the address from the VMCS so if the address is unique, we can look
      up the eventfd directly, bypassing emulation.
      
      Unfortunately, this only works if userspace does not need to match on
      access length and data.  The implementation adds a separate FAST_MMIO
      bus internally. This serves two purposes:
          - minimize overhead for old userspace that does not use eventfd with lengtth = 0
          - minimize disruption in other code (since we don't know the length,
            devices on the MMIO bus only get a valid address in write, this
            way we don't need to touch all devices to teach them to handle
            an invalid length)
      
      At the moment, this optimization only has effect for EPT on x86.
      
      It will be possible to speed up MMIO for NPT and MMU using the same
      idea in the future.
      
      With this patch applied, on VMX MMIO EVENTFD is essentially as fast as PIO.
      I was unable to detect any measureable slowdown to non-eventfd MMIO.
      
      Making MMIO faster is important for the upcoming virtio 1.0 which
      includes an MMIO signalling capability.
      
      The idea was suggested by Peter Anvin.  Lots of thanks to Gleb for
      pre-review and suggestions.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      68c3b4d1
  14. 27 2月, 2014 1 次提交
  15. 18 2月, 2014 1 次提交
  16. 14 2月, 2014 1 次提交
  17. 30 1月, 2014 1 次提交
  18. 15 1月, 2014 1 次提交
  19. 09 1月, 2014 2 次提交
  20. 22 12月, 2013 1 次提交
    • C
      KVM: arm-vgic: Support KVM_CREATE_DEVICE for VGIC · 7330672b
      Christoffer Dall 提交于
      Support creating the ARM VGIC device through the KVM_CREATE_DEVICE
      ioctl, which can then later be leveraged to use the
      KVM_{GET/SET}_DEVICE_ATTR, which is useful both for setting addresses in
      a more generic API than the ARM-specific one and is useful for
      save/restore of VGIC state.
      
      Adds KVM_CAP_DEVICE_CTRL to ARM capabilities.
      
      Note that we change the check for creating a VGIC from bailing out if
      any VCPUs were created, to bailing out if any VCPUs were ever run.  This
      is an important distinction that shouldn't break anything, but allows
      creating the VGIC after the VCPUs have been created.
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NChristoffer Dall <christoffer.dall@linaro.org>
      7330672b
  21. 13 12月, 2013 2 次提交
  22. 21 11月, 2013 1 次提交
    • H
      KVM: kvm_clear_guest_page(): fix empty_zero_page usage · 8a3caa6d
      Heiko Carstens 提交于
      Using the address of 'empty_zero_page' as source address in order to
      clear a page is wrong. On some architectures empty_zero_page is only the
      pointer to the struct page of the empty_zero_page.  Therefore the clear
      page operation would copy the contents of a couple of struct pages instead
      of clearing a page.  For kvm only arm/arm64 are affected by this bug.
      
      To fix this use the ZERO_PAGE macro instead which will return the struct
      page address of the empty_zero_page on all architectures.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      8a3caa6d
  23. 06 11月, 2013 1 次提交
  24. 31 10月, 2013 1 次提交
    • A
      kvm: Add VFIO device · ec53500f
      Alex Williamson 提交于
      So far we've succeeded at making KVM and VFIO mostly unaware of each
      other, but areas are cropping up where a connection beyond eventfds
      and irqfds needs to be made.  This patch introduces a KVM-VFIO device
      that is meant to be a gateway for such interaction.  The user creates
      the device and can add and remove VFIO groups to it via file
      descriptors.  When a group is added, KVM verifies the group is valid
      and gets a reference to it via the VFIO external user interface.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ec53500f
  25. 30 10月, 2013 1 次提交
  26. 28 10月, 2013 1 次提交
    • Y
      KVM: Mapping IOMMU pages after updating memslot · e0230e13
      Yang Zhang 提交于
      In kvm_iommu_map_pages(), we need to know the page size via call
      kvm_host_page_size(). And it will check whether the target slot
      is valid before return the right page size.
      Currently, we will map the iommu pages when creating a new slot.
      But we call kvm_iommu_map_pages() during preparing the new slot.
      At that time, the new slot is not visible by domain(still in preparing).
      So we cannot get the right page size from kvm_host_page_size() and
      this will break the IOMMU super page logic.
      The solution is to map the iommu pages after we insert the new slot
      into domain.
      Signed-off-by: NYang Zhang <yang.z.zhang@Intel.com>
      Tested-by: NPatrick Lu <patrick.lu@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e0230e13
  27. 17 10月, 2013 2 次提交
  28. 03 10月, 2013 1 次提交
  29. 30 9月, 2013 3 次提交
    • P
      KVM: Convert kvm_lock back to non-raw spinlock · 2f303b74
      Paolo Bonzini 提交于
      In commit e935b837 ("KVM: Convert kvm_lock to raw_spinlock"),
      the kvm_lock was made a raw lock.  However, the kvm mmu_shrink()
      function tries to grab the (non-raw) mmu_lock within the scope of
      the raw locked kvm_lock being held.  This leads to the following:
      
      BUG: sleeping function called from invalid context at kernel/rtmutex.c:659
      in_atomic(): 1, irqs_disabled(): 0, pid: 55, name: kswapd0
      Preemption disabled at:[<ffffffffa0376eac>] mmu_shrink+0x5c/0x1b0 [kvm]
      
      Pid: 55, comm: kswapd0 Not tainted 3.4.34_preempt-rt
      Call Trace:
       [<ffffffff8106f2ad>] __might_sleep+0xfd/0x160
       [<ffffffff817d8d64>] rt_spin_lock+0x24/0x50
       [<ffffffffa0376f3c>] mmu_shrink+0xec/0x1b0 [kvm]
       [<ffffffff8111455d>] shrink_slab+0x17d/0x3a0
       [<ffffffff81151f00>] ? mem_cgroup_iter+0x130/0x260
       [<ffffffff8111824a>] balance_pgdat+0x54a/0x730
       [<ffffffff8111fe47>] ? set_pgdat_percpu_threshold+0xa7/0xd0
       [<ffffffff811185bf>] kswapd+0x18f/0x490
       [<ffffffff81070961>] ? get_parent_ip+0x11/0x50
       [<ffffffff81061970>] ? __init_waitqueue_head+0x50/0x50
       [<ffffffff81118430>] ? balance_pgdat+0x730/0x730
       [<ffffffff81060d2b>] kthread+0xdb/0xe0
       [<ffffffff8106e122>] ? finish_task_switch+0x52/0x100
       [<ffffffff817e1e94>] kernel_thread_helper+0x4/0x10
       [<ffffffff81060c50>] ? __init_kthread_worker+0x
      
      After the previous patch, kvm_lock need not be a raw spinlock anymore,
      so change it back.
      Reported-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: kvm@vger.kernel.org
      Cc: gleb@redhat.com
      Cc: jan.kiszka@siemens.com
      Reviewed-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2f303b74
    • P
      KVM: protect kvm_usage_count with its own spinlock · 4a937f96
      Paolo Bonzini 提交于
      The VM list need not be protected by a raw spinlock.  Separate the
      two so that kvm_lock can be made non-raw.
      
      Cc: kvm@vger.kernel.org
      Cc: gleb@redhat.com
      Cc: jan.kiszka@siemens.com
      Reviewed-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4a937f96
    • P
      KVM: cleanup (physical) CPU hotplug · 4fa92fb2
      Paolo Bonzini 提交于
      Remove the useless argument, and do not do anything if there are no
      VMs running at the time of the hotplug.
      
      Cc: kvm@vger.kernel.org
      Cc: gleb@redhat.com
      Cc: jan.kiszka@siemens.com
      Reviewed-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4fa92fb2
  30. 17 9月, 2013 1 次提交
  31. 28 8月, 2013 1 次提交
  32. 27 8月, 2013 1 次提交
    • A
      kvm: optimize away THP checks in kvm_is_mmio_pfn() · 11feeb49
      Andrea Arcangeli 提交于
      The checks on PG_reserved in the page structure on head and tail pages
      aren't necessary because split_huge_page wouldn't transfer the
      PG_reserved bit from head to tail anyway.
      
      This was a forward-thinking check done in the case PageReserved was
      set by a driver-owned page mapped in userland with something like
      remap_pfn_range in a VM_PFNMAP region, but using hugepmds (not
      possible right now). It was meant to be very safe, but it's overkill
      as it's unlikely split_huge_page could ever run without the driver
      noticing and tearing down the hugepage itself.
      
      And if a driver in the future will really want to map a reserved
      hugepage in userland using an huge pmd it should simply take care of
      marking all subpages reserved too to keep KVM safe. This of course
      would require such a hypothetical driver to tear down the huge pmd
      itself and splitting the hugepage itself, instead of relaying on
      split_huge_page, but that sounds very reasonable, especially
      considering split_huge_page wouldn't currently transfer the reserved
      bit anyway.
      Signed-off-by: NAndrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      11feeb49
  33. 26 8月, 2013 1 次提交