From: Bob Pearson <rpearsonhpe@gmail.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next v13 03/10] RDMA/rxe: Check rxe_get() return value
Date: Wed, 20 Apr 2022 17:47:38 -0500 [thread overview]
Message-ID: <7100b58c-80e5-486c-eadd-5d082f4f6142@gmail.com> (raw)
In-Reply-To: <20220408175251.GA3644777@nvidia.com>
On 4/8/22 12:52, Jason Gunthorpe wrote:
> On Mon, Apr 04, 2022 at 04:50:53PM -0500, Bob Pearson wrote:
>> In the tasklets (completer, responder, and requester) check the
>> return value from rxe_get() to detect failures to get a reference.
>> This only occurs if the qp has had its reference count drop to
>> zero which indicates that it no longer should be used. This is
>> in preparation to an upcoming change that will move the qp cleanup
>> code to rxe_qp_cleanup().
>
> These need some comments explaining how this is safe..
>
> It looks to me like it works because the 0 ref keeps the memory alive
> while a work queue triggers rxe_cleanup_task() (though who fences the
> responder task?)
>
> At least after the next patch, I'm a little unclear how this works
> at this moment..
>
> Jason
I started writing the comment (here)
If rxe_get() fails qp is not going to be around for long
because its ref count has gone to zero and rxe_complete()
is cleaning up and returning to rdma-core which will
free the qp. However rxe_do_qp_cleanup() has to finish first
and it will wait for the tasklets to finish running.
This fixes a hard bug to solve since the code calling
rxe_run_task() will hold a valid reference on qp but the
tasklet can be deferred until later and that reference may
be gone when the tasklet starts.
but I realized that at the end of the day there isn't a problem because
complete/wait_for_completion together with qp cleanup code shutting down
the tasklets means that the race won't happen once the series is all in
place. So I will just drop that patch.
Bob
next prev parent reply other threads:[~2022-04-20 22:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 21:50 [PATCH for-next v13 00/10] Fix race conditions in rxe_pool Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 01/10] RDMA/rxe: Remove IB_SRQ_INIT_MASK Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 02/10] RDMA/rxe: Add rxe_srq_cleanup() Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 03/10] RDMA/rxe: Check rxe_get() return value Bob Pearson
2022-04-08 17:52 ` Jason Gunthorpe
2022-04-20 22:47 ` Bob Pearson [this message]
2022-04-04 21:50 ` [PATCH for-next v13 04/10] RDMA/rxe: Move qp cleanup code to rxe_qp_do_cleanup() Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 05/10] RDMA/rxe: Move mr cleanup code to rxe_mr_cleanup() Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 06/10] RDMA/rxe: Move mw cleanup code to rxe_mw_cleanup() Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 07/10] RDMA/rxe: Enforce IBA C11-17 Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 08/10] RDMA/rxe: Stop lookup of partially built objects Bob Pearson
2022-04-04 21:50 ` [PATCH for-next v13 09/10] RDMA/rxe: Convert read side locking to rcu Bob Pearson
2022-04-04 21:51 ` [PATCH for-next v13 10/10] RDMA/rxe: Cleanup rxe_pool.c Bob Pearson
2022-04-08 18:06 ` [PATCH for-next v13 00/10] Fix race conditions in rxe_pool Jason Gunthorpe
2022-04-08 18:15 ` Bob Pearson
2022-04-20 23:04 ` Bob Pearson
2022-04-21 2:13 ` Zhu Yanjun
2022-04-21 16:09 ` Pearson, Robert B
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=7100b58c-80e5-486c-eadd-5d082f4f6142@gmail.com \
--to=rpearsonhpe@gmail.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=zyjzyj2000@gmail.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