Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/umem: Move umem dmabuf revoke logic into helper function

This same logic will eventually be reused from within the
invalidate_mappings callback which already has the dma_resv_lock
held, so break it out into a separate function so it can be reused.

Signed-off-by: Jacob Moroni <jmoroni@google.com>
Link: https://patch.msgid.link/20260305170826.3803155-3-jmoroni@google.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Jacob Moroni and committed by
Leon Romanovsky
797291a6 553dfa8c

+17 -9
+17 -9
drivers/infiniband/core/umem_dmabuf.c
··· 195 195 .move_notify = ib_umem_dmabuf_unsupported_move_notify, 196 196 }; 197 197 198 + static void ib_umem_dmabuf_revoke_locked(struct dma_buf_attachment *attach) 199 + { 200 + struct ib_umem_dmabuf *umem_dmabuf = attach->importer_priv; 201 + 202 + dma_resv_assert_held(attach->dmabuf->resv); 203 + 204 + if (umem_dmabuf->revoked) 205 + return; 206 + ib_umem_dmabuf_unmap_pages(umem_dmabuf); 207 + if (umem_dmabuf->pinned) { 208 + dma_buf_unpin(umem_dmabuf->attach); 209 + umem_dmabuf->pinned = 0; 210 + } 211 + umem_dmabuf->revoked = 1; 212 + } 213 + 198 214 static struct ib_umem_dmabuf * 199 215 ib_umem_dmabuf_get_pinned_and_lock(struct ib_device *device, 200 216 struct device *dma_device, ··· 278 262 struct dma_buf *dmabuf = umem_dmabuf->attach->dmabuf; 279 263 280 264 dma_resv_lock(dmabuf->resv, NULL); 281 - if (umem_dmabuf->revoked) 282 - goto end; 283 - ib_umem_dmabuf_unmap_pages(umem_dmabuf); 284 - if (umem_dmabuf->pinned) { 285 - dma_buf_unpin(umem_dmabuf->attach); 286 - umem_dmabuf->pinned = 0; 287 - } 288 - umem_dmabuf->revoked = 1; 289 - end: 265 + ib_umem_dmabuf_revoke_locked(umem_dmabuf->attach); 290 266 dma_resv_unlock(dmabuf->resv); 291 267 } 292 268 EXPORT_SYMBOL(ib_umem_dmabuf_revoke);