On Mon, May 20, 2019 at 12:18:40PM +0300, Leon Romanovsky wrote: > On Mon, May 20, 2019 at 10:53:20AM +0300, Shamir Rabinovitch wrote: > > In shared object model ib_pd can belong to 1 or more ib_ucontext. > > Fix the nldev code so it could report multiple context ids. > > > > Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@xxxxxxxxxx> > > --- > > drivers/infiniband/core/nldev.c | 93 +++++++++++++++++++++++++++++++-- > > 1 file changed, 88 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c > > index cbd712f5f8b2..f4cc92b897ff 100644 > > --- a/drivers/infiniband/core/nldev.c > > +++ b/drivers/infiniband/core/nldev.c > > @@ -41,6 +41,9 @@ > > #include "core_priv.h" > > #include "cma_priv.h" > > #include "restrack.h" > > +#include "uverbs.h" > > + > > +static bool is_visible_in_pid_ns(struct rdma_restrack_entry *res); > > Mark needed it too. > https://patchwork.kernel.org/patch/10921419/ > I see. So follow Mark patch the above hunk is not needed. Should I apply Mark patch before this series? > > + if (!rdma_is_kernel_res(res)) { > > + pd_context(pd, &pd_context_ids); > > + list_for_each_entry(ctx_id, &pd_context_ids, list) { > > + if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_CTXN, > > + ctx_id->id)) > > Did it work? You are overwriting RDMA_NLDEV_ATTR_RES_CTXN entry in the > loop. You need to add RDMA_NLDEV_ATTR_RES_CTX and > RDMA_NLDEV_ATTR_RES_CTX_ENTRY to include/uapi/rdma_netlink.h and > open nested table here (inside of PD) with list of contexts. I tested with only 1 context per pd (what we have today). Thanks for comment. I'll try to follow what you wrote here.