Re: [PATCH rdma-next v1 2/2] RDMA/core: Optimize XRC target lookup

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

 



On Tue, Jun 23, 2020 at 02:52:00PM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 23, 2020 at 02:15:31PM +0300, Leon Romanovsky wrote:
> > From: Maor Gottlieb <maorg@xxxxxxxxxxxx>
> >
> > Replace the mutex with read write semaphore and use xarray instead
> > of linked list for XRC target QPs. This will give faster XRC target
> > lookup. In addition, when QP is closed, don't insert it back to the
> > xarray if the destroy command failed.
> >
> > Signed-off-by: Maor Gottlieb <maorg@xxxxxxxxxxxx>
> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> >  drivers/infiniband/core/verbs.c | 57 ++++++++++++---------------------
> >  include/rdma/ib_verbs.h         |  5 ++-
> >  2 files changed, 23 insertions(+), 39 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> > index d66a0ad62077..1ccbe43e33cd 100644
> > +++ b/drivers/infiniband/core/verbs.c
> > @@ -1090,13 +1090,6 @@ static void __ib_shared_qp_event_handler(struct ib_event *event, void *context)
> >  	spin_unlock_irqrestore(&qp->device->qp_open_list_lock, flags);
> >  }
> >
> > -static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp)
> > -{
> > -	mutex_lock(&xrcd->tgt_qp_mutex);
> > -	list_add(&qp->xrcd_list, &xrcd->tgt_qp_list);
> > -	mutex_unlock(&xrcd->tgt_qp_mutex);
> > -}
> > -
> >  static struct ib_qp *__ib_open_qp(struct ib_qp *real_qp,
> >  				  void (*event_handler)(struct ib_event *, void *),
> >  				  void *qp_context)
> > @@ -1139,16 +1132,15 @@ struct ib_qp *ib_open_qp(struct ib_xrcd *xrcd,
> >  	if (qp_open_attr->qp_type != IB_QPT_XRC_TGT)
> >  		return ERR_PTR(-EINVAL);
> >
> > -	qp = ERR_PTR(-EINVAL);
> > -	mutex_lock(&xrcd->tgt_qp_mutex);
> > -	list_for_each_entry(real_qp, &xrcd->tgt_qp_list, xrcd_list) {
> > -		if (real_qp->qp_num == qp_open_attr->qp_num) {
> > -			qp = __ib_open_qp(real_qp, qp_open_attr->event_handler,
> > -					  qp_open_attr->qp_context);
> > -			break;
> > -		}
> > +	down_read(&xrcd->tgt_qps_rwsem);
> > +	real_qp = xa_load(&xrcd->tgt_qps, qp_open_attr->qp_num);
> > +	if (!real_qp) {
>
> Don't we already have a xarray indexed against qp_num in res_track?
> Can we use it somehow?

We don't have restrack for XRC, we will need somehow manage QP-to-XRC
connection there.

Thanks

>
> Jason



[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