public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
	andrew.gospodarek@broadcom.com,
	Kashyap Desai <kashyap.desai@broadcom.com>
Subject: Re: [PATCH for-next 2/2] RDMA/bnxt_re: Protect the PD table bitmap
Date: Fri, 18 Aug 2023 13:20:54 -0300	[thread overview]
Message-ID: <ZN+aZiK+BJY98vmb@nvidia.com> (raw)
In-Reply-To: <1692032419-21680-2-git-send-email-selvin.xavier@broadcom.com>

On Mon, Aug 14, 2023 at 10:00:19AM -0700, Selvin Xavier wrote:
> Syncrhonization is required to avoid simultaneous allocation
> of the PD. Add a new mutex lock to handle allocation from
> the PD table.
> 
> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c  |  2 +-
>  drivers/infiniband/hw/bnxt_re/qplib_res.c | 26 ++++++++++++++++++++------
>  drivers/infiniband/hw/bnxt_re/qplib_res.h |  4 +++-
>  3 files changed, 24 insertions(+), 8 deletions(-)

This needs a fixes line, it seems like a serious bug??

> diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> index 6f1e8b7..79c43c2 100644
> --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c
> +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c
> @@ -642,31 +642,44 @@ static void bnxt_qplib_init_sgid_tbl(struct bnxt_qplib_sgid_tbl *sgid_tbl,
>  }
>  
>  /* PDs */
> -int bnxt_qplib_alloc_pd(struct bnxt_qplib_pd_tbl *pdt, struct bnxt_qplib_pd *pd)
> +int bnxt_qplib_alloc_pd(struct bnxt_qplib_res  *res, struct bnxt_qplib_pd *pd)
>  {
> +	struct bnxt_qplib_pd_tbl *pdt = &res->pd_tbl;
>  	u32 bit_num;
> +	int rc = 0;
>  
> +	mutex_lock(&res->pd_tbl_lock);
>  	bit_num = find_first_bit(pdt->tbl, pdt->max);

Please make a followup patch to change this into an IDA unless the pd
max is really small. Don't opencode IDAs in drivers..

Jason

  reply	other threads:[~2023-08-18 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 17:00 [PATCH for-next 1/2] RDMA/bnxt_re: Initialize mutex dbq_lock Selvin Xavier
2023-08-14 17:00 ` [PATCH for-next 2/2] RDMA/bnxt_re: Protect the PD table bitmap Selvin Xavier
2023-08-18 16:20   ` Jason Gunthorpe [this message]
2023-08-19 20:04     ` Selvin Xavier
2023-08-20  9:32       ` Leon Romanovsky
2023-08-21 12:37         ` Selvin Xavier

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=ZN+aZiK+BJY98vmb@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=leon@kernel.org \
    --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