History

IB/mlx5: Unmap DMA addr from HCA before IOMMU

The function that puts back the MR in cache also removes the DMA address from the HCA. Therefore we need to call this function before we remove the DMA mapping from MMU. Otherwise the HCA may access a memory that is no longer DMA mapped. Call trace: NMI: IOCK error (debug interrupt?) for reason 71 on CPU 0. CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.0-rc6+ #4 Hardware name: HP ProLiant DL360p Gen8, BIOS P71 08/20/2012 RIP: 0010:intel_idle+0x73/0x120 Code: 80 5c 01 00 0f ae 38 0f ae f0 31 d2 65 48 8b 04 25 80 5c 01 00 48 89 d1 0f 60 02 RSP: 0018:ffffffff9a403e38 EFLAGS: 00000046 RAX: 0000000000000030 RBX: 0000000000000005 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff9a5790c0 RDI: 0000000000000000 RBP: 0000000000000030 R08: 0000000000000000 R09: 0000000000007cf9 R10: 000000000000030a R11: 0000000000000018 R12: 0000000000000000 R13: ffffffff9a5792b8 R14: ffffffff9a5790c0 R15: 0000002b48471e4d FS: 0000000000000000(0000) GS:ffff9c6caf400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5737185000 CR3: 0000000590c0a002 CR4: 00000000000606f0 Call Trace: cpuidle_enter_state+0x7e/0x2e0 do_idle+0x1ed/0x290 cpu_startup_entry+0x6f/0x80 start_kernel+0x524/0x544 ? set_init_arg+0x55/0x55 secondary_startup_64+0xa4/0xb0 DMAR: DRHD: handling fault status reg 2 DMAR: [DMA Read] Request device [04:00.0] fault addr b34d2000 [fault reason 06] PTE Read access is not set DMAR: [DMA Read] Request device [01:00.2] fault addr bff8b000 [fault reason 06] PTE Read access is not set

Valentine Fatiev committed 8 years ago

Commit dd9a4031 parent 5c5702e1 file · +8 −4Browse files

Unified · Split

drivers/infiniband/hw/mlx5/mr.c+8−4
@@ -544,6 +544,9 @@ void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 543 unmodified lines
544 int shrink = 0;544 int shrink = 0;
545 int c;545 int c;
546 546
547 if (!mr->allocated_from_cache)
548 return;
549
547 c = order2idx(dev, mr->order);550 c = order2idx(dev, mr->order);
548 if (c < 0 || c >= MAX_MR_CACHE_ENTRIES) {551 if (c < 0 || c >= MAX_MR_CACHE_ENTRIES) {
549 mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c);552 mlx5_ib_warn(dev, "order %d, cache index %d\n", mr->order, c);
@@ -1647,18 +1650,19 @@ static void dereg_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr) · 1097 unmodified lines
1647 umem = NULL;1650 umem = NULL;
1648 }1651 }
1649#endif1652#endif
1650
1651 clean_mr(dev, mr);1653 clean_mr(dev, mr);
1652 1654
1655 /*
1656 * We should unregister the DMA address from the HCA before
1657 * remove the DMA mapping.
1658 */
1659 mlx5_mr_cache_free(dev, mr);
1653 if (umem) {1660 if (umem) {
1654 ib_umem_release(umem);1661 ib_umem_release(umem);
1655 atomic_sub(npages, &dev->mdev->priv.reg_pages);1662 atomic_sub(npages, &dev->mdev->priv.reg_pages);
1656 }1663 }
1657
1658 if (!mr->allocated_from_cache)1664 if (!mr->allocated_from_cache)
1659 kfree(mr);1665 kfree(mr);
1660 else
1661 mlx5_mr_cache_free(dev, mr);
1662}1666}
1663 1667
1664int mlx5_ib_dereg_mr(struct ib_mr *ibmr)1668int mlx5_ib_dereg_mr(struct ib_mr *ibmr)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t