1. 03 3月, 2022 1 次提交
  2. 27 8月, 2021 6 次提交
  3. 11 8月, 2021 4 次提交
  4. 21 7月, 2021 3 次提交
  5. 01 7月, 2021 1 次提交
    • A
      vfio/pci: Handle concurrent vma faults · 6a45ece4
      Alex Williamson 提交于
      io_remap_pfn_range() will trigger a BUG_ON if it encounters a
      populated pte within the mapping range.  This can occur because we map
      the entire vma on fault and multiple faults can be blocked behind the
      vma_lock.  This leads to traces like the one reported below.
      
      We can use our vma_list to test whether a given vma is mapped to avoid
      this issue.
      
      [ 1591.733256] kernel BUG at mm/memory.c:2177!
      [ 1591.739515] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
      [ 1591.747381] Modules linked in: vfio_iommu_type1 vfio_pci vfio_virqfd vfio pv680_mii(O)
      [ 1591.760536] CPU: 2 PID: 227 Comm: lcore-worker-2 Tainted: G O 5.11.0-rc3+ #1
      [ 1591.770735] Hardware name:  , BIOS HixxxxFPGA 1P B600 V121-1
      [ 1591.778872] pstate: 40400009 (nZcv daif +PAN -UAO -TCO BTYPE=--)
      [ 1591.786134] pc : remap_pfn_range+0x214/0x340
      [ 1591.793564] lr : remap_pfn_range+0x1b8/0x340
      [ 1591.799117] sp : ffff80001068bbd0
      [ 1591.803476] x29: ffff80001068bbd0 x28: 0000042eff6f0000
      [ 1591.810404] x27: 0000001100910000 x26: 0000001300910000
      [ 1591.817457] x25: 0068000000000fd3 x24: ffffa92f1338e358
      [ 1591.825144] x23: 0000001140000000 x22: 0000000000000041
      [ 1591.832506] x21: 0000001300910000 x20: ffffa92f141a4000
      [ 1591.839520] x19: 0000001100a00000 x18: 0000000000000000
      [ 1591.846108] x17: 0000000000000000 x16: ffffa92f11844540
      [ 1591.853570] x15: 0000000000000000 x14: 0000000000000000
      [ 1591.860768] x13: fffffc0000000000 x12: 0000000000000880
      [ 1591.868053] x11: ffff0821bf3d01d0 x10: ffff5ef2abd89000
      [ 1591.875932] x9 : ffffa92f12ab0064 x8 : ffffa92f136471c0
      [ 1591.883208] x7 : 0000001140910000 x6 : 0000000200000000
      [ 1591.890177] x5 : 0000000000000001 x4 : 0000000000000001
      [ 1591.896656] x3 : 0000000000000000 x2 : 0168044000000fd3
      [ 1591.903215] x1 : ffff082126261880 x0 : fffffc2084989868
      [ 1591.910234] Call trace:
      [ 1591.914837]  remap_pfn_range+0x214/0x340
      [ 1591.921765]  vfio_pci_mmap_fault+0xac/0x130 [vfio_pci]
      [ 1591.931200]  __do_fault+0x44/0x12c
      [ 1591.937031]  handle_mm_fault+0xcc8/0x1230
      [ 1591.942475]  do_page_fault+0x16c/0x484
      [ 1591.948635]  do_translation_fault+0xbc/0xd8
      [ 1591.954171]  do_mem_abort+0x4c/0xc0
      [ 1591.960316]  el0_da+0x40/0x80
      [ 1591.965585]  el0_sync_handler+0x168/0x1b0
      [ 1591.971608]  el0_sync+0x174/0x180
      [ 1591.978312] Code: eb1b027f 540000c0 f9400022 b4fffe02 (d4210000)
      
      Fixes: 11c4cd07 ("vfio-pci: Fault mmaps to enable vma tracking")
      Reported-by: NZeng Tao <prime.zeng@hisilicon.com>
      Suggested-by: NZeng Tao <prime.zeng@hisilicon.com>
      Link: https://lore.kernel.org/r/162497742783.3883260.3282953006487785034.stgit@omenSigned-off-by: NAlex Williamson <alex.williamson@redhat.com>
      6a45ece4
  6. 25 6月, 2021 1 次提交
  7. 16 6月, 2021 1 次提交
  8. 13 4月, 2021 1 次提交
  9. 07 4月, 2021 9 次提交
  10. 20 2月, 2021 1 次提交
  11. 03 12月, 2020 2 次提交
  12. 04 11月, 2020 1 次提交
    • F
      vfio/pci: Bypass IGD init in case of -ENODEV · e4eccb85
      Fred Gao 提交于
      Bypass the IGD initialization when -ENODEV returns,
      that should be the case if opregion is not available for IGD
      or within discrete graphics device's option ROM,
      or host/lpc bridge is not found.
      
      Then use of -ENODEV here means no special device resources found
      which needs special care for VFIO, but we still allow other normal
      device resource access.
      
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Xiong Zhang <xiong.y.zhang@intel.com>
      Cc: Hang Yuan <hang.yuan@linux.intel.com>
      Cc: Stuart Summers <stuart.summers@intel.com>
      Signed-off-by: NFred Gao <fred.gao@intel.com>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      e4eccb85
  13. 17 10月, 2020 1 次提交
  14. 13 10月, 2020 1 次提交
  15. 22 9月, 2020 1 次提交
  16. 24 8月, 2020 1 次提交
  17. 28 7月, 2020 4 次提交
  18. 17 7月, 2020 1 次提交
    • Z
      vfio/pci: fix racy on error and request eventfd ctx · b872d064
      Zeng Tao 提交于
      The vfio_pci_release call will free and clear the error and request
      eventfd ctx while these ctx could be in use at the same time in the
      function like vfio_pci_request, and it's expected to protect them under
      the vdev->igate mutex, which is missing in vfio_pci_release.
      
      This issue is introduced since commit 1518ac27 ("vfio/pci: fix memory
      leaks of eventfd ctx"),and since commit 5c5866c5 ("vfio/pci: Clear
      error and request eventfd ctx after releasing"), it's very easily to
      trigger the kernel panic like this:
      
      [ 9513.904346] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
      [ 9513.913091] Mem abort info:
      [ 9513.915871]   ESR = 0x96000006
      [ 9513.918912]   EC = 0x25: DABT (current EL), IL = 32 bits
      [ 9513.924198]   SET = 0, FnV = 0
      [ 9513.927238]   EA = 0, S1PTW = 0
      [ 9513.930364] Data abort info:
      [ 9513.933231]   ISV = 0, ISS = 0x00000006
      [ 9513.937048]   CM = 0, WnR = 0
      [ 9513.940003] user pgtable: 4k pages, 48-bit VAs, pgdp=0000007ec7d12000
      [ 9513.946414] [0000000000000008] pgd=0000007ec7d13003, p4d=0000007ec7d13003, pud=0000007ec728c003, pmd=0000000000000000
      [ 9513.956975] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [ 9513.962521] Modules linked in: vfio_pci vfio_virqfd vfio_iommu_type1 vfio hclge hns3 hnae3 [last unloaded: vfio_pci]
      [ 9513.972998] CPU: 4 PID: 1327 Comm: bash Tainted: G        W         5.8.0-rc4+ #3
      [ 9513.980443] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B270.01 05/08/2020
      [ 9513.989274] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--)
      [ 9513.994827] pc : _raw_spin_lock_irqsave+0x48/0x88
      [ 9513.999515] lr : eventfd_signal+0x6c/0x1b0
      [ 9514.003591] sp : ffff800038a0b960
      [ 9514.006889] x29: ffff800038a0b960 x28: ffff007ef7f4da10
      [ 9514.012175] x27: ffff207eefbbfc80 x26: ffffbb7903457000
      [ 9514.017462] x25: ffffbb7912191000 x24: ffff007ef7f4d400
      [ 9514.022747] x23: ffff20be6e0e4c00 x22: 0000000000000008
      [ 9514.028033] x21: 0000000000000000 x20: 0000000000000000
      [ 9514.033321] x19: 0000000000000008 x18: 0000000000000000
      [ 9514.038606] x17: 0000000000000000 x16: ffffbb7910029328
      [ 9514.043893] x15: 0000000000000000 x14: 0000000000000001
      [ 9514.049179] x13: 0000000000000000 x12: 0000000000000002
      [ 9514.054466] x11: 0000000000000000 x10: 0000000000000a00
      [ 9514.059752] x9 : ffff800038a0b840 x8 : ffff007ef7f4de60
      [ 9514.065038] x7 : ffff007fffc96690 x6 : fffffe01faffb748
      [ 9514.070324] x5 : 0000000000000000 x4 : 0000000000000000
      [ 9514.075609] x3 : 0000000000000000 x2 : 0000000000000001
      [ 9514.080895] x1 : ffff007ef7f4d400 x0 : 0000000000000000
      [ 9514.086181] Call trace:
      [ 9514.088618]  _raw_spin_lock_irqsave+0x48/0x88
      [ 9514.092954]  eventfd_signal+0x6c/0x1b0
      [ 9514.096691]  vfio_pci_request+0x84/0xd0 [vfio_pci]
      [ 9514.101464]  vfio_del_group_dev+0x150/0x290 [vfio]
      [ 9514.106234]  vfio_pci_remove+0x30/0x128 [vfio_pci]
      [ 9514.111007]  pci_device_remove+0x48/0x108
      [ 9514.115001]  device_release_driver_internal+0x100/0x1b8
      [ 9514.120200]  device_release_driver+0x28/0x38
      [ 9514.124452]  pci_stop_bus_device+0x68/0xa8
      [ 9514.128528]  pci_stop_and_remove_bus_device+0x20/0x38
      [ 9514.133557]  pci_iov_remove_virtfn+0xb4/0x128
      [ 9514.137893]  sriov_disable+0x3c/0x108
      [ 9514.141538]  pci_disable_sriov+0x28/0x38
      [ 9514.145445]  hns3_pci_sriov_configure+0x48/0xb8 [hns3]
      [ 9514.150558]  sriov_numvfs_store+0x110/0x198
      [ 9514.154724]  dev_attr_store+0x44/0x60
      [ 9514.158373]  sysfs_kf_write+0x5c/0x78
      [ 9514.162018]  kernfs_fop_write+0x104/0x210
      [ 9514.166010]  __vfs_write+0x48/0x90
      [ 9514.169395]  vfs_write+0xbc/0x1c0
      [ 9514.172694]  ksys_write+0x74/0x100
      [ 9514.176079]  __arm64_sys_write+0x24/0x30
      [ 9514.179987]  el0_svc_common.constprop.4+0x110/0x200
      [ 9514.184842]  do_el0_svc+0x34/0x98
      [ 9514.188144]  el0_svc+0x14/0x40
      [ 9514.191185]  el0_sync_handler+0xb0/0x2d0
      [ 9514.195088]  el0_sync+0x140/0x180
      [ 9514.198389] Code: b9001020 d2800000 52800022 f9800271 (885ffe61)
      [ 9514.204455] ---[ end trace 648de00c8406465f ]---
      [ 9514.212308] note: bash[1327] exited with preempt_count 1
      
      Cc: Qian Cai <cai@lca.pw>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Fixes: 1518ac27 ("vfio/pci: fix memory leaks of eventfd ctx")
      Signed-off-by: NZeng Tao <prime.zeng@hisilicon.com>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      b872d064