Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Aharon Landau <aharonl@nvidia.com>,
	linux-rdma@vger.kernel.org,
	Michael Guralnik <michaelgur@nvidia.com>
Subject: Re: [PATCH rdma-next] RDMA/mlx5: Add a umr recovery flow
Date: Thu, 26 May 2022 19:29:20 +0300	[thread overview]
Message-ID: <Yo+q4KQ2JU92XZlh@unreal> (raw)
In-Reply-To: <20220526143212.GA3078527@nvidia.com>

On Thu, May 26, 2022 at 11:32:12AM -0300, Jason Gunthorpe wrote:
> On Sun, May 15, 2022 at 07:19:53AM +0300, Leon Romanovsky wrote:
> > @@ -270,17 +296,49 @@ static int mlx5r_umr_post_send_wait(struct mlx5_ib_dev *dev, u32 mkey,
> >  	mlx5r_umr_init_context(&umr_context);
> >  
> >  	down(&umrc->sem);
> > +	while (true) {
> > +		mutex_lock(&umrc->lock);
> 
> You need to test this with lockdep, nesing a mutex under a semaphor is
> not allowed, AFAIK.

We are running with lockdep all our tests.

> 
> > +		err = mlx5r_umr_post_send(umrc->qp, mkey, &umr_context.cqe, wqe,
> > +					  with_data);
> > +		mutex_unlock(&umrc->lock);
> > +		if (err) {
> > +			mlx5_ib_warn(dev, "UMR post send failed, err %d\n",
> > +				     err);
> > +			break;
> >  		}
> > +
> > +		wait_for_completion(&umr_context.done);
> 
> Nor is sleeping under a semaphore.

Not according to the kernel/locking/semaphore.c. Semaphores can sleep
and the code protected by semaphores can sleep too.

   53 void down(struct semaphore *sem)
   54 {
   55         unsigned long flags;
   56
   57         might_sleep();
   ....
   64 }
   65 EXPORT_SYMBOL(down);

> 
> And, I'm pretty sure, this entire function is called under a spinlock
> in some cases.

Can you point to such flow?

Thanks

> 
> Jason

  reply	other threads:[~2022-05-26 16:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-15  4:19 [PATCH rdma-next] RDMA/mlx5: Add a umr recovery flow Leon Romanovsky
2022-05-26 14:32 ` Jason Gunthorpe
2022-05-26 16:29   ` Leon Romanovsky [this message]
2022-05-26 17:21     ` Jason Gunthorpe
2022-05-26 17:33       ` Leon Romanovsky
2022-06-07  9:58 ` 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=Yo+q4KQ2JU92XZlh@unreal \
    --to=leon@kernel.org \
    --cc=aharonl@nvidia.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michaelgur@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox