1. 22 12月, 2013 6 次提交
  2. 13 12月, 2013 1 次提交
  3. 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
  4. 06 11月, 2013 1 次提交
  5. 05 11月, 2013 1 次提交
    • G
      KVM: IOMMU: hva align mapping page size · 27ef63c7
      Greg Edwards 提交于
      When determining the page size we could use to map with the IOMMU, the
      page size should also be aligned with the hva, not just the gfn.  The
      gfn may not reflect the real alignment within the hugetlbfs file.
      
      Most of the time, this works fine.  However, if the hugetlbfs file is
      backed by non-contiguous huge pages, a multi-huge page memslot starts at
      an unaligned offset within the hugetlbfs file, and the gfn is aligned
      with respect to the huge page size, kvm_host_page_size() will return the
      huge page size and we will use that to map with the IOMMU.
      
      When we later unpin that same memslot, the IOMMU returns the unmap size
      as the huge page size, and we happily unpin that many pfns in
      monotonically increasing order, not realizing we are spanning
      non-contiguous huge pages and partially unpin the wrong huge page.
      
      Ensure the IOMMU mapping page size is aligned with the hva corresponding
      to the gfn, which does reflect the alignment within the hugetlbfs file.
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NGreg Edwards <gedwards@ddn.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      27ef63c7
  6. 31 10月, 2013 3 次提交
  7. 30 10月, 2013 1 次提交
  8. 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
  9. 17 10月, 2013 2 次提交
  10. 15 10月, 2013 1 次提交
  11. 03 10月, 2013 2 次提交
  12. 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
  13. 25 9月, 2013 1 次提交
  14. 17 9月, 2013 2 次提交
  15. 04 9月, 2013 1 次提交
  16. 30 8月, 2013 3 次提交
  17. 28 8月, 2013 1 次提交
  18. 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
  19. 26 8月, 2013 1 次提交
  20. 29 7月, 2013 1 次提交
  21. 18 7月, 2013 2 次提交
  22. 27 6月, 2013 2 次提交
  23. 04 6月, 2013 1 次提交
    • A
      kvm: exclude ioeventfd from counting kvm_io_range limit · 6ea34c9b
      Amos Kong 提交于
      We can easily reach the 1000 limit by start VM with a couple
      hundred I/O devices (multifunction=on). The hardcode limit
      already been adjusted 3 times (6 ~ 200 ~ 300 ~ 1000).
      
      In userspace, we already have maximum file descriptor to
      limit ioeventfd count. But kvm_io_bus devices also are used
      for pit, pic, ioapic, coalesced_mmio. They couldn't be limited
      by maximum file descriptor.
      
      Currently only ioeventfds take too much kvm_io_bus devices,
      so just exclude it from counting kvm_io_range limit.
      
      Also fixed one indent issue in kvm_host.h
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      6ea34c9b
  24. 19 5月, 2013 1 次提交
    • M
      ARM: KVM: move GIC/timer code to a common location · 7275acdf
      Marc Zyngier 提交于
      As KVM/arm64 is looming on the horizon, it makes sense to move some
      of the common code to a single location in order to reduce duplication.
      
      The code could live anywhere. Actually, most of KVM is already built
      with a bunch of ugly ../../.. hacks in the various Makefiles, so we're
      not exactly talking about style here. But maybe it is time to start
      moving into a less ugly direction.
      
      The include files must be in a "public" location, as they are accessed
      from non-KVM files (arch/arm/kernel/asm-offsets.c).
      
      For this purpose, introduce two new locations:
      - virt/kvm/arm/ : x86 and ia64 already share the ioapic code in
        virt/kvm, so this could be seen as a (very ugly) precedent.
      - include/kvm/  : there is already an include/xen, and while the
        intent is slightly different, this seems as good a location as
        any
      
      Eventually, we should probably have independant Makefiles at every
      levels (just like everywhere else in the kernel), but this is just
      the first step.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      7275acdf