All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Doug Ledford <dledford@redhat.com>, Shay Drory <shayd@nvidia.com>,
	linux-rdma@vger.kernel.org, Maor Gottlieb <maorg@nvidia.com>
Subject: Re: [PATCH rdma-next 2/3] RDMA/mlx5: Create ODP EQ only when ODP MR is created
Date: Fri, 12 Mar 2021 08:36:39 +0200	[thread overview]
Message-ID: <YEsL9z9DCw6EGYJ7@unreal> (raw)
In-Reply-To: <20210312000739.GA2773739@nvidia.com>

On Thu, Mar 11, 2021 at 08:07:39PM -0400, Jason Gunthorpe wrote:
> On Thu, Mar 04, 2021 at 02:45:16PM +0200, Leon Romanovsky wrote:
> > -static int
> > -mlx5_ib_create_pf_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)
> > +int mlx5r_odp_create_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)
> >  {
> >  	struct mlx5_eq_param param = {};
> > -	int err;
> > +	int err = 0;
> >
> > +	if (eq->core)
> > +		return 0;
> > +
> > +	mutex_lock(&dev->odp_eq_mutex);
>
> The above if is locked wrong.

It is not wrong, but this is optimization for the case that will be always.

We are creating one ODP EQ for the whole life of the device. It means that
once it is created it will always exist and won't be destroyed till device
is destroyed. We don't need lock to check it.

We need lock only for first ODP EQ creation.

Thanks

>
> Jason

  reply	other threads:[~2021-03-12  6:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 12:45 [PATCH rdma-next 0/3] Batch independent fixes to mlx5_ib Leon Romanovsky
2021-03-04 12:45 ` [PATCH rdma-next 1/3] RDMA/mlx5: Fix query RoCE port Leon Romanovsky
2021-03-04 12:45 ` [PATCH rdma-next 2/3] RDMA/mlx5: Create ODP EQ only when ODP MR is created Leon Romanovsky
2021-03-12  0:07   ` Jason Gunthorpe
2021-03-12  6:36     ` Leon Romanovsky [this message]
2021-03-12 13:03       ` Jason Gunthorpe
2021-03-04 12:45 ` [PATCH rdma-next 3/3] RDMA/mlx5: Fix mlx5 rates to IB rates map Leon Romanovsky
2021-03-12  0:30 ` [PATCH rdma-next 0/3] Batch independent fixes to mlx5_ib Jason Gunthorpe
2021-03-12  6:37   ` Leon Romanovsky

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=YEsL9z9DCw6EGYJ7@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=shayd@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.