Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: jgg@ziepe.ca, dledford@redhat.com, linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-rc 1/6] RDMA/bnxt_re: Remove the qp from list only if the qp destroy succeeds
Date: Mon, 24 Aug 2020 22:01:41 +0300	[thread overview]
Message-ID: <20200824190141.GL571722@unreal> (raw)
In-Reply-To: <1598292876-26529-2-git-send-email-selvin.xavier@broadcom.com>

On Mon, Aug 24, 2020 at 11:14:31AM -0700, Selvin Xavier wrote:
> Driver crashes when destroy_qp is re-tried because of an
> error returned. This is because the qp entry was  removed
> from the qp list during the first call.

How is it possible that destroy_qp fail?

>
> Remove qp from the list only if destroy_qp returns success.
>
> Fixes: 8dae419f9ec7 ("RDMA/bnxt_re: Refactor queue pair creation code")
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 3f18efc..2f5aac0 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -752,12 +752,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
>  	gsi_sqp = rdev->gsi_ctx.gsi_sqp;
>  	gsi_sah = rdev->gsi_ctx.gsi_sah;
>
> -	/* remove from active qp list */
> -	mutex_lock(&rdev->qp_lock);
> -	list_del(&gsi_sqp->list);
> -	mutex_unlock(&rdev->qp_lock);
> -	atomic_dec(&rdev->qp_count);
> -
>  	ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n");
>  	bnxt_qplib_destroy_ah(&rdev->qplib_res,
>  			      &gsi_sah->qplib_ah,
> @@ -772,6 +766,12 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp)
>  	}
>  	bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp);
>
> +	/* remove from active qp list */
> +	mutex_lock(&rdev->qp_lock);
> +	list_del(&gsi_sqp->list);
> +	mutex_unlock(&rdev->qp_lock);
> +	atomic_dec(&rdev->qp_count);
> +
>  	kfree(rdev->gsi_ctx.sqp_tbl);
>  	kfree(gsi_sah);
>  	kfree(gsi_sqp);
> @@ -792,11 +792,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
>  	unsigned int flags;
>  	int rc;
>
> -	mutex_lock(&rdev->qp_lock);
> -	list_del(&qp->list);
> -	mutex_unlock(&rdev->qp_lock);
> -	atomic_dec(&rdev->qp_count);
> -
>  	bnxt_qplib_flush_cqn_wq(&qp->qplib_qp);
>
>  	rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp);
> @@ -819,6 +814,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)
>  			goto sh_fail;
>  	}
>
> +	mutex_lock(&rdev->qp_lock);
> +	list_del(&qp->list);
> +	mutex_unlock(&rdev->qp_lock);
> +	atomic_dec(&rdev->qp_count);
> +
>  	ib_umem_release(qp->rumem);
>  	ib_umem_release(qp->sumem);
>
> --
> 2.5.5
>

  reply	other threads:[~2020-08-24 19:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 18:14 [PATCH for-rc 0/6] RDMA/bnxt_re: Bug fixes Selvin Xavier
2020-08-24 18:14 ` [PATCH for-rc 1/6] RDMA/bnxt_re: Remove the qp from list only if the qp destroy succeeds Selvin Xavier
2020-08-24 19:01   ` Leon Romanovsky [this message]
2020-08-24 19:36     ` Selvin Xavier
2020-08-24 22:00       ` Jason Gunthorpe
2020-08-25 11:44         ` Gal Pressman
2020-08-24 18:14 ` [PATCH for-rc 2/6] RDMA/bnxt_re: Do not report transparent vlan from QP1 Selvin Xavier
2020-08-24 18:14 ` [PATCH for-rc 3/6] RDMA/bnxt_re: Fix the qp table indexing Selvin Xavier
2020-08-24 18:14 ` [PATCH for-rc 4/6] RDMA/bnxt_re: Static NQ depth allocation Selvin Xavier
2020-08-24 18:14 ` [PATCH for-rc 5/6] RDMA/bnxt_re: Restrict the max_gids to 256 Selvin Xavier
2020-08-24 18:14 ` [PATCH for-rc 6/6] RDMA/bnxt_re: Fix driver crash on unaligned PSN entry address Selvin Xavier
2020-08-27 12:31 ` [PATCH for-rc 0/6] RDMA/bnxt_re: Bug fixes Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200824190141.GL571722@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=selvin.xavier@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox