Re: [PATCH rdma-next v1 3/3] RDMA: Handle ucontext allocations by IB/core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 11, 2019 at 01:53:09PM -0600, Shiraz Saleem wrote:
> On Mon, Feb 11, 2019 at 08:21:18PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >
> > Follow PD conversion patch, do the same for ucontext allocations.
> >
> >  /**
> >   * i40iw_dealloc_ucontext - deallocate the user context data structure
> >   * @context: user context created during alloc
> >   */
> > -static int i40iw_dealloc_ucontext(struct ib_ucontext *context)
> > +static void i40iw_dealloc_ucontext(struct ib_ucontext *context)
> >  {
> >  	struct i40iw_ucontext *ucontext = to_ucontext(context);
> > -	unsigned long flags;
> > -
> > -	spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
> > -	if (!list_empty(&ucontext->cq_reg_mem_list)) {
> > -		spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags);
> > -		return -EBUSY;
> > -	}
> > -	spin_unlock_irqrestore(&ucontext->cq_reg_mem_list_lock, flags);
> > -	spin_lock_irqsave(&ucontext->qp_reg_mem_list_lock, flags);
> > -	if (!list_empty(&ucontext->qp_reg_mem_list)) {
> > -		spin_unlock_irqrestore(&ucontext->qp_reg_mem_list_lock, flags);
> > -		return -EBUSY;
> > -	}
> > -	spin_unlock_irqrestore(&ucontext->qp_reg_mem_list_lock, flags);
> >
> > -	kfree(ucontext);
> > -	return 0;
> > +	/*
> > +	 * dealloc is supposed to be called after all MRs QPs
> > +	 * were already freed, No need to grab XXX_reg_mem_list_lock
> > +	 * locks, in order to check lists, because it is too late now
> > +	 * and the warning below symbol of bug in the driver.
> > +	 */
> > +	WARN_ON_ONCE(!list_empty(&ucontext->cq_reg_mem_list));
> > +	WARN_ON_ONCE(!list_empty(&ucontext->qp_reg_mem_list));
> >  }
>
> Lets remove the comment and WARN_ON. I believe this list empty check
> was added during early dev. and should go away.

No problem

>
> >  /**
> > @@ -2742,6 +2728,7 @@ static const struct ib_device_ops i40iw_dev_ops = {
> >  	.reg_user_mr = i40iw_reg_user_mr,
> >  	.req_notify_cq = i40iw_req_notify_cq,
> >  	INIT_RDMA_OBJ_SIZE(ib_pd, i40iw_pd, ibpd),
> > +	INIT_RDMA_OBJ_SIZE(ib_ucontext, i40iw_ucontext, ibucontext),
> >  };
> >
> >  /**
>
> Are you planning to convert other objects too?

Yes, most probably CQ will be next object.

>
> Shiraz
>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux