Skip to content

Commit 12d23a9

Browse files
Leon Romanovskydledford
authored andcommitted
RDMA/uverbs: Annotate alloc/deallloc paths with context tracking
Add restrack annotations to track allocations of ucontexts. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 6061521 commit 12d23a9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/infiniband/core/rdma_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ static void ufile_destroy_ucontext(struct ib_uverbs_file *ufile,
820820
ib_rdmacg_uncharge(&ucontext->cg_obj, ib_dev,
821821
RDMACG_RESOURCE_HCA_HANDLE);
822822

823+
rdma_restrack_del(&ucontext->res);
824+
823825
/*
824826
* FIXME: Drivers are not permitted to fail dealloc_ucontext, remove
825827
* the error return.

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
259259

260260
fd_install(resp.async_fd, filp);
261261

262+
ucontext->res.type = RDMA_RESTRACK_CTX;
263+
rdma_restrack_add(&ucontext->res);
264+
262265
/*
263266
* Make sure that ib_uverbs_get_ucontext() sees the pointer update
264267
* only after all writes to setup the ucontext have completed

0 commit comments

Comments
 (0)