Skip to content

Commit deaeb67

Browse files
Leon Romanovskygregkh
authored andcommitted
RDMA/core: Track device memory MRs
[ Upstream commit b47a98e ] Device memory (DM) are registered as MR during initialization flow, these MRs were not tracked by resource tracker and had res->valid set as a false. Update the code to manage them too. Before this change: $ ibv_rc_pingpong -j & $ rdma res show mr <-- shows nothing After this change: $ ibv_rc_pingpong -j & $ rdma res show mr dev ibp0s9 mrn 0 mrlen 4096 pdn 3 pid 734 comm ibv_rc_pingpong Fixes: be934cc ("IB/uverbs: Add device memory registration ioctl support") Link: https://lore.kernel.org/r/20201117070148.1974114-2-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent aaaa7a6 commit deaeb67

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/infiniband/core/uverbs_std_types_mr.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "rdma_core.h"
3434
#include "uverbs.h"
3535
#include <rdma/uverbs_std_types.h>
36+
#include "restrack.h"
3637

3738
static int uverbs_free_mr(struct ib_uobject *uobject,
3839
enum rdma_remove_reason why,
@@ -134,6 +135,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)(
134135
atomic_inc(&pd->usecnt);
135136
atomic_inc(&dm->usecnt);
136137

138+
rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR);
139+
rdma_restrack_set_name(&mr->res, NULL);
140+
rdma_restrack_add(&mr->res);
137141
uobj->object = mr;
138142

139143
uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_REG_DM_MR_HANDLE);

0 commit comments

Comments
 (0)