1. 27 12月, 2011 13 次提交
  2. 26 12月, 2011 1 次提交
    • A
      KVM: Device assignment permission checks · 3d27e23b
      Alex Williamson 提交于
      Only allow KVM device assignment to attach to devices which:
      
       - Are not bridges
       - Have BAR resources (assume others are special devices)
       - The user has permissions to use
      
      Assigning a bridge is a configuration error, it's not supported, and
      typically doesn't result in the behavior the user is expecting anyway.
      Devices without BAR resources are typically chipset components that
      also don't have host drivers.  We don't want users to hold such devices
      captive or cause system problems by fencing them off into an iommu
      domain.  We determine "permission to use" by testing whether the user
      has access to the PCI sysfs resource files.  By default a normal user
      will not have access to these files, so it provides a good indication
      that an administration agent has granted the user access to the device.
      
      [Yang Bai: add missing #include]
      [avi: fix comment style]
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NYang Bai <hamo.by@gmail.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      3d27e23b
  3. 25 12月, 2011 1 次提交
  4. 01 11月, 2011 2 次提交
  5. 21 10月, 2011 2 次提交
  6. 26 9月, 2011 6 次提交
  7. 24 9月, 2011 1 次提交
  8. 24 7月, 2011 3 次提交
  9. 12 7月, 2011 5 次提交
  10. 06 6月, 2011 1 次提交
    • M
      KVM: Initialize kvm before registering the mmu notifier · 74b5c5bf
      Mike Waychison 提交于
      It doesn't make sense to ever see a half-initialized kvm structure on
      mmu notifier callbacks.  Previously, 85722cda changed the ordering to
      ensure that the mmu_lock was initialized before mmu notifier
      registration, but there is still a race where the mmu notifier could
      come in and try accessing other portions of struct kvm before they are
      intialized.
      
      Solve this by moving the mmu notifier registration to occur after the
      structure is completely initialized.
      
      Google-Bug-Id: 452199
      Signed-off-by: NMike Waychison <mikew@google.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      74b5c5bf
  11. 26 5月, 2011 1 次提交
  12. 22 5月, 2011 4 次提交
    • O
      KVM: Fix kvm mmu_notifier initialization order · 85722cda
      OGAWA Hirofumi 提交于
      Like the following, mmu_notifier can be called after registering
      immediately. So, kvm have to initialize kvm->mmu_lock before it.
      
      BUG: spinlock bad magic on CPU#0, kswapd0/342
       lock: ffff8800af8c4000, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
      Pid: 342, comm: kswapd0 Not tainted 2.6.39-rc5+ #1
      Call Trace:
       [<ffffffff8118ce61>] spin_bug+0x9c/0xa3
       [<ffffffff8118ce91>] do_raw_spin_lock+0x29/0x13c
       [<ffffffff81024923>] ? flush_tlb_others_ipi+0xaf/0xfd
       [<ffffffff812e22f3>] _raw_spin_lock+0x9/0xb
       [<ffffffffa0582325>] kvm_mmu_notifier_clear_flush_young+0x2c/0x66 [kvm]
       [<ffffffff810d3ff3>] __mmu_notifier_clear_flush_young+0x2b/0x57
       [<ffffffff810c8761>] page_referenced_one+0x88/0xea
       [<ffffffff810c89bf>] page_referenced+0x1fc/0x256
       [<ffffffff810b2771>] shrink_page_list+0x187/0x53a
       [<ffffffff810b2ed7>] shrink_inactive_list+0x1e0/0x33d
       [<ffffffff810acf95>] ? determine_dirtyable_memory+0x15/0x27
       [<ffffffff812e90ee>] ? call_function_single_interrupt+0xe/0x20
       [<ffffffff810b3356>] shrink_zone+0x322/0x3de
       [<ffffffff810a9587>] ? zone_watermark_ok_safe+0xe2/0xf1
       [<ffffffff810b3928>] kswapd+0x516/0x818
       [<ffffffff810b3412>] ? shrink_zone+0x3de/0x3de
       [<ffffffff81053d17>] kthread+0x7d/0x85
       [<ffffffff812e9394>] kernel_thread_helper+0x4/0x10
       [<ffffffff81053c9a>] ? __init_kthread_worker+0x37/0x37
       [<ffffffff812e9390>] ? gs_change+0xb/0xb
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      85722cda
    • T
      KVM: Validate userspace_addr of memslot when registered · fa3d315a
      Takuya Yoshikawa 提交于
      This way, we can avoid checking the user space address many times when
      we read the guest memory.
      
      Although we can do the same for write if we check which slots are
      writable, we do not care write now: reading the guest memory happens
      more often than writing.
      
      [avi: change VERIFY_READ to VERIFY_WRITE]
      Signed-off-by: NTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      fa3d315a
    • L
      KVM: ioapic: Fix an error field reference · a38f84ca
      Liu Yuan 提交于
      Function ioapic_debug() in the ioapic_deliver() misnames
      one filed by reference. This patch correct it.
      Signed-off-by: NLiu Yuan <tailai.ly@taobao.com>
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      a38f84ca
    • A
      KVM: Use pci_store/load_saved_state() around VM device usage · f8fcfd77
      Alex Williamson 提交于
      Store the device saved state so that we can reload the device back
      to the original state when it's unassigned.  This has the benefit
      that the state survives across pci_reset_function() calls via
      the PCI sysfs reset interface while the VM is using the device.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Acked-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f8fcfd77