1. 02 10月, 2009 1 次提交
  2. 28 9月, 2009 1 次提交
  3. 24 9月, 2009 1 次提交
  4. 10 9月, 2009 24 次提交
  5. 28 6月, 2009 2 次提交
  6. 12 6月, 2009 1 次提交
  7. 10 6月, 2009 10 次提交
    • A
      KVM: Prevent overflow in largepages calculation · 09f8ca74
      Avi Kivity 提交于
      If userspace specifies a memory slot that is larger than 8 petabytes, it
      could overflow the largepages variable.
      
      Cc: stable@kernel.org
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      09f8ca74
    • A
      KVM: Disable large pages on misaligned memory slots · ac04527f
      Avi Kivity 提交于
      If a slots guest physical address and host virtual address unequal (mod
      large page size), then we would erronously try to back guest large pages
      with host large pages.  Detect this misalignment and diable large page
      support for the trouble slot.
      
      Cc: stable@kernel.org
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      ac04527f
    • M
      KVM: take mmu_lock when updating a deleted slot · b43b1901
      Marcelo Tosatti 提交于
      kvm_handle_hva relies on mmu_lock protection to safely access
      the memslot structures.
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      b43b1901
    • M
      KVM: protect assigned dev workqueue, int handler and irq acker · 547de29e
      Marcelo Tosatti 提交于
      kvm_assigned_dev_ack_irq is vulnerable to a race condition with the
      interrupt handler function. It does:
      
              if (dev->host_irq_disabled) {
                      enable_irq(dev->host_irq);
                      dev->host_irq_disabled = false;
              }
      
      If an interrupt triggers before the host->dev_irq_disabled assignment,
      it will disable the interrupt and set dev->host_irq_disabled to true.
      
      On return to kvm_assigned_dev_ack_irq, dev->host_irq_disabled is set to
      false, and the next kvm_assigned_dev_ack_irq call will fail to reenable
      it.
      
      Other than that, having the interrupt handler and work handlers run in
      parallel sounds like asking for trouble (could not spot any obvious
      problem, but better not have to, its fragile).
      
      CC: sheng.yang@intel.com
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      547de29e
    • S
      KVM: VMX: Disable VMX when system shutdown · 8e1c1815
      Sheng Yang 提交于
      Intel TXT(Trusted Execution Technology) required VMX off for all cpu to work
      when system shutdown.
      
      CC: Joseph Cihula <joseph.cihula@intel.com>
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      8e1c1815
    • G
      KVM: Fix interrupt unhalting a vcpu when it shouldn't · 78646121
      Gleb Natapov 提交于
      kvm_vcpu_block() unhalts vpu on an interrupt/timer without checking
      if interrupt window is actually opened.
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      78646121
    • G
      KVM: Timer event should not unconditionally unhalt vcpu. · 09cec754
      Gleb Natapov 提交于
      Currently timer events are processed before entering guest mode. Move it
      to main vcpu event loop since timer events should be processed even while
      vcpu is halted.  Timer may cause interrupt/nmi to be injected and only then
      vcpu will be unhalted.
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      09cec754
    • G
      KVM: MMU: do not free active mmu pages in free_mmu_pages() · f00be0ca
      Gleb Natapov 提交于
      free_mmu_pages() should only undo what alloc_mmu_pages() does.
      Free mmu pages from the generic VM destruction function, kvm_destroy_vm().
      Signed-off-by: NGleb Natapov <gleb@redhat.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      f00be0ca
    • S
      KVM: Device assignment framework rework · e56d532f
      Sheng Yang 提交于
      After discussion with Marcelo, we decided to rework device assignment framework
      together. The old problems are kernel logic is unnecessary complex. So Marcelo
      suggest to split it into a more elegant way:
      
      1. Split host IRQ assign and guest IRQ assign. And userspace determine the
      combination. Also discard msi2intx parameter, userspace can specific
      KVM_DEV_IRQ_HOST_MSI | KVM_DEV_IRQ_GUEST_INTX in assigned_irq->flags to
      enable MSI to INTx convertion.
      
      2. Split assign IRQ and deassign IRQ. Import two new ioctls:
      KVM_ASSIGN_DEV_IRQ and KVM_DEASSIGN_DEV_IRQ.
      
      This patch also fixed the reversed _IOR vs _IOW in definition(by deprecated the
      old interface).
      
      [avi: replace homemade bitcount() by hweight_long()]
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      e56d532f
    • S
      KVM: Enable MSI-X for KVM assigned device · d510d6cc
      Sheng Yang 提交于
      This patch finally enable MSI-X.
      
      What we need for MSI-X:
      1. Intercept one page in MMIO region of device. So that we can get guest desired
      MSI-X table and set up the real one. Now this have been done by guest, and
      transfer to kernel using ioctl KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY.
      
      2. Information for incoming interrupt. Now one device can have more than one
      interrupt, and they are all handled by one workqueue structure. So we need to
      identify them. The previous patch enable gsi_msg_pending_bitmap get this done.
      
      3. Mapping from host IRQ to guest gsi as well as guest gsi to real MSI/MSI-X
      message address/data. We used same entry number for the host and guest here, so
      that it's easy to find the correlated guest gsi.
      
      What we lack for now:
      1. The PCI spec said nothing can existed with MSI-X table in the same page of
      MMIO region, except pending bits. The patch ignore pending bits as the first
      step (so they are always 0 - no pending).
      
      2. The PCI spec allowed to change MSI-X table dynamically. That means, the OS
      can enable MSI-X, then mask one MSI-X entry, modify it, and unmask it. The patch
      didn't support this, and Linux also don't work in this way.
      
      3. The patch didn't implement MSI-X mask all and mask single entry. I would
      implement the former in driver/pci/msi.c later. And for single entry, userspace
      should have reposibility to handle it.
      Signed-off-by: NSheng Yang <sheng@linux.intel.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      d510d6cc