From: Bob Pearson <rpearsonhpe@gmail.com>
To: Haris Iqbal <haris.iqbal@ionos.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Zhu Yanjun <zyjzyj2000@gmail.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Aleksei Marov <aleksei.marov@ionos.com>,
Jinpu Wang <jinpu.wang@ionos.com>
Subject: Re: RDME/rxe: Fast reg with local access rights and invalidation for that MR
Date: Tue, 31 May 2022 12:12:01 -0500 [thread overview]
Message-ID: <bb958406-14a1-e785-a525-9c1d5132f10e@gmail.com> (raw)
In-Reply-To: <CAJpMwyjL4iWSSLh_pgWEqLT7oCLgMAFCAdZTJ0w1Rv-gkDNDFQ@mail.gmail.com>
On 5/30/22 06:05, Haris Iqbal wrote:
> Hi Bob,
>
> I have a query. After the following patch,
>
> https://marc.info/?l=linux-rdma&m=163163776430842&w=2
>
> If I send a IB_WR_REG_MR wr with flag set to IB_ACCESS_LOCAL_WRITE,
> rxe will set the mr->rkey to 0 (mr->lkey will be set to the key I send
> in wr).
>
> Afterwards, If I have to invalidate that mr with IB_WR_LOCAL_INV,
> setting the .ex.invalidate_rkey to the key I sent previously in the
> IB_WR_REG_MR wr, the invalidate would fail with the following error.
>
> rkey (%#x) doesn't match mr->rkey
> (function rxe_invalidate_mr)
>
> Is this desired behaviour? If so, how would I go about invalidating
> the above MR?
>
> Regards
> -Haris
I think that the first behavior is correct. If you don't do this then the
MR is open for RDMA operations which you didn't allow.
The second behavior is more interesting. If you are doing a send_with_invalidate
from a remote node then no reason you should allow the remote node to do
anything to the MR since it didn't have access to begin with. For a local invalidate MR
If you read the IBA it claims that local invalidate operations should provide
the lkey, rkey and memory handle as parameters to the operation and that the
lkey should be invalidated and the rkey if there is one should be invalidated. But
ib_verbs.h only has one parameter labeled rkey.
The rxe driver follows most other providers and always makes the lkey and rkey the same
if there is an rkey else the rkey is set to zero. So rxe_invalidate_mr should compare
to the lkey and not the rkey for local invalidate. And then move the MR to the FREE state.
This is a bug. Fortunately the majority of use cases for physical memory regions are
for RDMA access.
Feel free to submit a patch or I will if you don't care to. The rxe_invalidate_mr() subroutine
needs have a new parameter since it is shared by local and remote invalidate operations and
they need to behave differently. Easiest is to have an lkey and rkey parameter. The local
operation would set the lkey and the remote operation the rkey.
Bob
next prev parent reply other threads:[~2022-05-31 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-30 11:05 RDME/rxe: Fast reg with local access rights and invalidation for that MR Haris Iqbal
2022-05-31 17:12 ` Bob Pearson [this message]
2022-06-01 16:15 ` Haris Iqbal
2022-06-01 17:37 ` Bob Pearson
2022-06-02 11:04 ` Haris Iqbal
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=bb958406-14a1-e785-a525-9c1d5132f10e@gmail.com \
--to=rpearsonhpe@gmail.com \
--cc=aleksei.marov@ionos.com \
--cc=haris.iqbal@ionos.com \
--cc=jgg@nvidia.com \
--cc=jinpu.wang@ionos.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