RDMA/uverbs: Annotate alloc/deallloc paths with context tracking
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 28 Nov 2018 11:16:44 +0000 (13:16 +0200)
committerDoug Ledford <dledford@redhat.com>
Mon, 3 Dec 2018 19:58:25 +0000 (14:58 -0500)
Add restrack annotations to track allocations of ucontexts.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/rdma_core.c
drivers/infiniband/core/uverbs_cmd.c

index efa2924892713f6737ade75ad0d619db8203581a..54d4e15217703d376d0c8fa3398d3ef98c60707f 100644 (file)
@@ -820,6 +820,8 @@ static void ufile_destroy_ucontext(struct ib_uverbs_file *ufile,
        ib_rdmacg_uncharge(&ucontext->cg_obj, ib_dev,
                           RDMACG_RESOURCE_HCA_HANDLE);
 
+       rdma_restrack_del(&ucontext->res);
+
        /*
         * FIXME: Drivers are not permitted to fail dealloc_ucontext, remove
         * the error return.
index 4dab9f7e1f94967dc0a6910b449861a09bed1279..b707495424719fd3a885a53c98b7ae8eb22a18a1 100644 (file)
@@ -259,6 +259,9 @@ static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
 
        fd_install(resp.async_fd, filp);
 
+       ucontext->res.type = RDMA_RESTRACK_CTX;
+       rdma_restrack_add(&ucontext->res);
+
        /*
         * Make sure that ib_uverbs_get_ucontext() sees the pointer update
         * only after all writes to setup the ucontext have completed