From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>, <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-rc] RDMA/ucma: Do not miss ctx destruction steps in some cases
Date: Wed, 6 Jan 2021 17:18:11 -0400 [thread overview]
Message-ID: <20210106211811.GA824299@nvidia.com> (raw)
In-Reply-To: <20210105111327.230270-1-leon@kernel.org>
On Tue, Jan 05, 2021 at 01:13:27PM +0200, Leon Romanovsky wrote:
> From: Jason Gunthorpe <jgg@nvidia.com>
>
> The destruction flow is very complicated here because the cm_id can be
> destroyed from the event handler at any time if the device is
> hot-removed. This leaves behind a partial ctx with no cm_id in the xarray.
>
> Make everything consistent in this flow in all places:
>
> - Return the xarray back to XA_ZERO_ENTRY before beginning any
> destruction. The thread that reaches this first is responsible to
> kfree, everyone else does nothing.
>
> - Test the xarray during the special hot-removal case to block the
> queue_work, this has much simpler locking and doesn't require a
> 'destroying'
>
> - Fix the ref initialization so that it is only positive if cm_id !=
> NULL, then rely on that to guide the destruction process in all cases.
>
> Now the new ucma_destroy_private_ctx() can be called in all places that
> want to free the ctx, including all the error unwinds, and none of the
> details are missed.
>
> Fixes: a1d33b70dbbc ("RDMA/ucma: Rework how new connections are passed through event delivery")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/core/ucma.c | 135 ++++++++++++++++++---------------
> 1 file changed, 72 insertions(+), 63 deletions(-)
Applied to for-rc, thanks
Jason
prev parent reply other threads:[~2021-01-06 21:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 11:13 [PATCH rdma-rc] RDMA/ucma: Do not miss ctx destruction steps in some cases Leon Romanovsky
2021-01-06 21:18 ` 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=20210106211811.GA824299@nvidia.com \
--to=jgg@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox