RE: [PATCH rdma-next v3 1/7] RDMA/restrack: Add general infrastructure to track RDMA resources

Steve Wise
2018-01-11T19:39:08Z

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> The RDMA subsystem has very strict set of objects to work on it,
> but it completely lacks tracking facilities and no visibility of
> resource utilization.
>
> The following patch adds such infrastructure to keep track of RDMA
> resources to help with debugging of user space applications. The primary
> user of this infrastructure is RDMA nldev netlink (following patches),
> but it is not limited too.
>
> At this stage, the main three objects (PD, CQ and QP) are added,
> and more will be added later.
>
> There are four new functions in use by RDMA/core:
> * rdma_restrack_init(...) - initializes restrack database
> * rdma_restrack_clean(...) - cleans restrack database
> * rdma_restrack_add(...) - adds object to be tracked
> * rdma_restrack_del(...) - removes object from tracking
>
> 3 functions and one iterator visible to kernel users:
> * rdma_restrack_count(...) - returns number of allocated objects of
> specific type
> * rdma_restrack_lock(...) - Lock primitive to protect access to list
> of resources
> * rdma_restrack_unlock(...)- Unlock primitive to protect access to list
> of resources
> * for_each_res_safe(...) - iterates over all relevant objects in
> the restrack database.
>
> Reviewed-by: Mark Bloch <markb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>