From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Artemy Kovalyov <artemyko@mellanox.com>,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-rc] IB/mlx5: Fix implicit ODP race
Date: Wed, 4 Mar 2020 13:30:57 -0400 [thread overview]
Message-ID: <20200304173057.GA3963@ziepe.ca> (raw)
In-Reply-To: <20200227113918.94432-1-leon@kernel.org>
On Thu, Feb 27, 2020 at 01:39:18PM +0200, Leon Romanovsky wrote:
> From: Artemy Kovalyov <artemyko@mellanox.com>
>
> Following race may occur because of the call_srcu and the placement of
> the synchronize_srcu vs the xa_erase.
>
> CPU0 CPU1
>
> mlx5_ib_free_implicit_mr: destroy_unused_implicit_child_mr:
> xa_erase(odp_mkeys)
> synchronize_srcu()
> xa_lock(implicit_children)
> if (still in xarray)
> atomic_inc()
> call_srcu()
> xa_unlock(implicit_children)
> xa_erase(implicit_children):
> xa_lock(implicit_children)
> __xa_erase()
> xa_unlock(implicit_children)
>
> flush_workqueue()
> [..]
> free_implicit_child_mr_rcu:
> (via call_srcu)
> queue_work()
>
> WARN_ON(atomic_read())
> [..]
> free_implicit_child_mr_work:
> (via wq)
> free_implicit_child_mr()
> mlx5_mr_cache_invalidate()
> mlx5_ib_update_xlt() <-- UMR QP fail
> atomic_dec()
>
> The wait_event() solves the race because it blocks until
> free_implicit_child_mr_work() completes.
>
> Fixes: 5256edcb98a1 ("RDMA/mlx5: Rework implicit ODP destroy")
> Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 +
> drivers/infiniband/hw/mlx5/odp.c | 17 +++++++----------
> 2 files changed, 8 insertions(+), 10 deletions(-)
Applied to for-rc, thanks
Jason
prev parent reply other threads:[~2020-03-04 17:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 11:39 [PATCH rdma-rc] IB/mlx5: Fix implicit ODP race Leon Romanovsky
2020-03-04 17:30 ` Jason Gunthorpe [this message]
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=20200304173057.GA3963@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=artemyko@mellanox.com \
--cc=dledford@redhat.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 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.