diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-03-04 14:07:44 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2021-03-11 20:03:25 -0400 |
commit | e6fb246ccafbdfc86e0750af021628132fdbceac (patch) | |
tree | 5da08817a6e203606013f76eca45790eae0b64df /drivers/infiniband/core/umem_dmabuf.c | |
parent | RDMA/mlx5: Use a union inside mlx5_ib_mr (diff) | |
download | linux-dev-e6fb246ccafbdfc86e0750af021628132fdbceac.tar.xz linux-dev-e6fb246ccafbdfc86e0750af021628132fdbceac.zip |
RDMA/mlx5: Consolidate MR destruction to mlx5_ib_dereg_mr()
Now that the SRCU stuff has been removed the entire MR destroy logic can
be made a lot simpler. Currently there are many different ways to destroy a
MR and it makes it really hard to do this task correctly. Route all
destruction through mlx5_ib_dereg_mr() and make it work for all
situations.
Since it turns out all the different MR types do basically the same thing
this removes a lot of knowledge of MR internals from ODP and leaves ODP
just exporting an operation to clean up children.
This fixes a few weird corner cases bugs and firmly uses the correct
ordering of the MR destruction:
- Stop parallel access to the mkey via the ODP xarray
- Stop DMA
- Release the umem
- Clean up ODP children
- Free/Recycle the MR
Link: https://lore.kernel.org/r/20210304120745.1090751-4-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/umem_dmabuf.c')
-rw-r--r-- | drivers/infiniband/core/umem_dmabuf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem_dmabuf.c b/drivers/infiniband/core/umem_dmabuf.c index f9b5162d9260..0d65ce146fc4 100644 --- a/drivers/infiniband/core/umem_dmabuf.c +++ b/drivers/infiniband/core/umem_dmabuf.c @@ -168,6 +168,10 @@ void ib_umem_dmabuf_release(struct ib_umem_dmabuf *umem_dmabuf) { struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf; + dma_resv_lock(dmabuf->resv, NULL); + ib_umem_dmabuf_unmap_pages(umem_dmabuf); + dma_resv_unlock(dmabuf->resv); + dma_buf_detach(dmabuf, umem_dmabuf->attach); dma_buf_put(dmabuf); kfree(umem_dmabuf); |