On Wed, May 22, 2019 at 06:27:45AM -0700, Nirranjan Kirubaharan wrote: > In iw_cxgb4, Added wait in destroy_qp() so that all references to > qp are dereferenced and qp is freed in destroy_qp() itself. > This ensures freeing of all QPs before invocation of > dealloc_ucontext(), which prevents loss of in use qpids stored > in ucontext. > > Signed-off-by: Nirranjan Kirubaharan <nirranjan@xxxxxxxxxxx> > Reviewed-by: Potnuri Bharat Teja <bharat@xxxxxxxxxxx> > v2: > - Used kref instead of qid count. > v3: > - Ensured freeing of qp in destroy_qp() itself. > v4: > - Change c4iw_qp_rem_ref() to use a refcount not kref and trigger > complete() when the refcount goes to 0. > - Move all of queue_qp_free into c4iw_destroy_qp() > drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 4 +-- > drivers/infiniband/hw/cxgb4/qp.c | 48 ++++++++++++---------------------- > 2 files changed, 19 insertions(+), 33 deletions(-) > > diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h > index 916ef982172e..b8e90eaf4a03 100644 > +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h > @@ -490,13 +490,13 @@ struct c4iw_qp { > struct t4_wq wq; > spinlock_t lock; > struct mutex mutex; > - struct kref kref; > wait_queue_head_t wait; > int sq_sig_all; > struct c4iw_srq *srq; > - struct work_struct free_work; > struct c4iw_ucontext *ucontext; > struct c4iw_wr_wait *wr_waitp; > + struct completion qp_rel_comp; > + atomic_t qp_refcnt; no, refcount_t But oterhwise OK Jason