On Fri, Apr 27, 2018 at 04:36:15AM +0000, Rohit Zambre wrote: > By creating a QP within a thread domain the application is guaranteeing > that the QP will not be accessed concurrently from multiple user threads. > Hence, a lock is not needed for QP that is assigned to a thread domain. > > This patch disables locking on the QP if a thread domain is passed during > QP-creation. > > Signed-off-by: Rohit Zambre <rzambre@xxxxxxx> > providers/mlx5/verbs.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c > index 9fd765e..f7132e4 100644 > +++ b/providers/mlx5/verbs.c > @@ -1607,6 +1607,7 @@ static struct ibv_qp *create_qp(struct ibv_context *context, > struct mlx5_create_qp_ex_resp resp_ex; > struct mlx5_qp *qp; > int ret; > + int thread_safe; > struct mlx5_context *ctx = to_mctx(context); > struct ibv_qp *ibqp; > int32_t usr_idx = 0; > @@ -1751,8 +1752,14 @@ static struct ibv_qp *create_qp(struct ibv_context *context, > > mlx5_init_qp_indices(qp); > > - if (mlx5_spinlock_init(&qp->sq.lock, !mlx5_single_threaded) || > - mlx5_spinlock_init(&qp->rq.lock, !mlx5_single_threaded)) > + mparent_domain = to_mparent_domain(attr->pd); > + if (mparent_domain && mparent_domain->mtd) > + thread_safe = 1; > + else > + thread_safe = mlx5_single_threaded; > + > + if (mlx5_spinlock_init(&qp->sq.lock, !thread_safe) || > + mlx5_spinlock_init(&qp->rq.lock, !thread_safe)) > goto err_free_qp_buf; This would be nicer to have a 'mlx5_spinlock_init_pd' that takes the object's pd and does the above calcuations. All the remaining uses should be revised at once to use a pd if it makes sense during the init.. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html