linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org, Artemy Kovalyov <artemyko@mellanox.com>
Subject: Re: [PATCH 2/6] RDMA/mlx5: Fix a race with mlx5_ib_update_xlt on an implicit MR
Date: Thu, 3 Oct 2019 09:48:40 -0300	[thread overview]
Message-ID: <20191003124840.GB26135@ziepe.ca> (raw)
In-Reply-To: <20191002154114.GF5855@unreal>

On Wed, Oct 02, 2019 at 06:41:14PM +0300, Leon Romanovsky wrote:
> On Wed, Oct 02, 2019 at 11:39:28AM -0300, Jason Gunthorpe wrote:
> > On Wed, Oct 02, 2019 at 11:18:26AM +0300, Leon Romanovsky wrote:
> > > > @@ -202,15 +225,22 @@ static void mr_leaf_free_action(struct work_struct *work)
> > > >  	struct ib_umem_odp *odp = container_of(work, struct ib_umem_odp, work);
> > > >  	int idx = ib_umem_start(odp) >> MLX5_IMR_MTT_SHIFT;
> > > >  	struct mlx5_ib_mr *mr = odp->private, *imr = mr->parent;
> > > > +	struct ib_umem_odp *odp_imr = to_ib_umem_odp(imr->umem);
> > > > +	int srcu_key;
> > > >
> > > >  	mr->parent = NULL;
> > > >  	synchronize_srcu(&mr->dev->mr_srcu);
> > >
> > > Are you sure that this line is still needed?
> >
> > Yes, in this case the mr->parent is the SRCU 'update' and it blocks
> > seeing this MR in the pagefault handler.
> >
> > It is necessary before calling ib_umem_odp_release below that frees
> > the memory
> 
> sorry for not being clear, I thought that synchronize_srcu() should be
> moved after your read_lock/unlock additions to reuse grace period.

It has to be before to ensure that the page fault handler does not
undo the invaliate below with new pages

Jason

  reply	other threads:[~2019-10-03 12:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 15:38 [PATCH -rc 0/6] Bug fixes for odp Jason Gunthorpe
2019-10-01 15:38 ` [PATCH 1/6] RDMA/mlx5: Do not allow rereg of a ODP MR Jason Gunthorpe
2019-10-01 15:38 ` [PATCH 2/6] RDMA/mlx5: Fix a race with mlx5_ib_update_xlt on an implicit MR Jason Gunthorpe
2019-10-02  8:18   ` Leon Romanovsky
2019-10-02 14:39     ` Jason Gunthorpe
2019-10-02 15:41       ` Leon Romanovsky
2019-10-03 12:48         ` Jason Gunthorpe [this message]
2019-10-01 15:38 ` [PATCH 3/6] RDMA/odp: Lift umem_mutex out of ib_umem_odp_unmap_dma_pages() Jason Gunthorpe
2019-10-01 15:38 ` [PATCH 4/6] RDMA/mlx5: Order num_pending_prefetch properly with synchronize_srcu Jason Gunthorpe
2019-10-01 15:38 ` [PATCH 5/6] RDMA/mlx5: Put live in the correct place for ODP MRs Jason Gunthorpe
2019-10-01 15:38 ` [PATCH 6/6] RDMA/mlx5: Add missing synchronize_srcu() for MW cases Jason Gunthorpe
2019-10-03  8:54   ` Leon Romanovsky
2019-10-03 12:33     ` Jason Gunthorpe
2019-10-04 18:55 ` [PATCH -rc 0/6] Bug fixes for odp 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=20191003124840.GB26135@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=artemyko@mellanox.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).