On Thu, Dec 20, 2018 at 6:43 PM Jason Gunthorpe <jgg@xxxxxxxxxxxx> wrote: > > On Thu, Dec 20, 2018 at 05:00:49PM +0200, Shamir Rabinovitch wrote: > > > The immediate step beyond this is to make rdma_get_ucontext into a > > > driver exported function and replace all *->uobject->context with > > > it. Maybe also adjust things so it can't fail, hard to say right now > > > if failure will be inconvenient. > > > > > > > I did something like this based on your recent work to unify the uverbs > > & ioctl code path. Will add the patches to this email and if they are > > fine with you we could use them to fill the ucontext in the udata from > > uverbs & ioctl. > > This isn't enough, it doesn't do the ioctl path and maybe more. > The ucontext should be stored in the attr_bundle not the udata.. > > I'm not totally sure we need this or not - I was going to look at the > drivers and see if accommodating failure would be easy or not.. > > So lets go through updating the core APIs like I sent and then lets > see what is left.. > > Jason I plan to make reg_user_mr() accessible from kernel. Something like this struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt_addr, int mr_access_flags) { struct ib_mr *mr; mr = mr = pd->device->ops.reg_user_m(pd, start, length, virt_addr, access_flags, NULL); if (IS_ERR(mr)) return mr; mr->device = pd->device; mr->pd = pd; mr->dm = NULL; mr->uobject = NULL; atomic_inc(&pd->usecnt); mr->res.type = RDMA_RESTRACK_MR; return mr; } For that to work I will need to eliminate the assumption that ucontext exists inside ib_umem_get() so maybe its a good idea to take everything that is hung on ib_ucontext which ib_umem_get() uses and put it under pd. Than modify ib_umem_get() to take ib_pd instead of ib_ucontext (or ib_udata as in this proposal)