From: Bob Pearson <rpearsonhpe@gmail.com>
To: Md Haris Iqbal <haris.phnx@gmail.com>, linux-rdma@vger.kernel.org
Cc: leon@kernel.org, jgg@ziepe.ca, haris.iqbal@ionos.com
Subject: Re: [PATCH for-next] RDMA/rxe: rxe_get_av always receives ahp hence no put is needed
Date: Fri, 21 Oct 2022 00:58:53 -0500 [thread overview]
Message-ID: <2ead1fb9-853d-a326-0038-69122e0a0bbb@gmail.com> (raw)
In-Reply-To: <20221020151345.412731-1-haris.phnx@gmail.com>
On 10/20/22 10:13, Md Haris Iqbal wrote:
> The function rxe_get_av is only used by rxe_requester, and the ahp double
> pointer is always sent. Hence there is no need to do the check.
> rxe_requester also always performs the put for ah, hence that is also not
> needed.
>
> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
> ---
> drivers/infiniband/sw/rxe/rxe_av.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_av.c b/drivers/infiniband/sw/rxe/rxe_av.c
> index 3b05314ca739..0780ffcf24a6 100644
> --- a/drivers/infiniband/sw/rxe/rxe_av.c
> +++ b/drivers/infiniband/sw/rxe/rxe_av.c
> @@ -130,11 +130,7 @@ struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt, struct rxe_ah **ahp)
> rxe_put(ah);
> return NULL;
> }
> -
> - if (ahp)
> - *ahp = ah;
> - else
> - rxe_put(ah);
> + *ahp = ah;
>
> return &ah->av;
> }
That doesn't sound right. There are several cases depending on the version of the user library
and whether the QP is UD or RC/UC. The old driver/library computed the address vector in
user space and passed it back to the kernel in the WR. If both the kernel and user library are using
the new API the user space passes back the AH# in the WR for UD commands. In both cases for
connected QPs the AV is stored in the rxe_struct_qp and there is no AH. At the point where
rxe_get_av is called the requester needs the AV it gets it from one of the three places:
the QP, the WR (old), or the kernel AH after looking up the AH#. If the kernel AH was involved
its pointer is returned so the requester can continue to hold a reference to it until it
is through sending the packet and then it can drop the reference. This to protect from
someone calling destroy_ah in a race with the send queue. Hope this makes it clearer.
Bob
next prev parent reply other threads:[~2022-10-21 5:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 15:13 [PATCH for-next] RDMA/rxe: rxe_get_av always receives ahp hence no put is needed Md Haris Iqbal
2022-10-21 5:58 ` Bob Pearson [this message]
2022-10-26 9:37 ` [kbuild] " Dan Carpenter
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=2ead1fb9-853d-a326-0038-69122e0a0bbb@gmail.com \
--to=rpearsonhpe@gmail.com \
--cc=haris.iqbal@ionos.com \
--cc=haris.phnx@gmail.com \
--cc=jgg@ziepe.ca \
--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