Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: lizhijian@fujitsu.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next] RDMA/rxe: Guard mr state with spin lock
Date: Thu, 28 Jul 2022 13:42:54 -0300	[thread overview]
Message-ID: <YuK8jXgAncDlppm9@nvidia.com> (raw)
In-Reply-To: <20220725200114.2666-1-rpearsonhpe@gmail.com>

On Mon, Jul 25, 2022 at 03:01:15PM -0500, Bob Pearson wrote:
> Currently the rxe driver does not guard changes to the mr state
> against race conditions which can arise from races between
> local operations and remote invalidate operations. This patch
> adds a spinlock to the mr object and makes the state changes
> atomic.

This doesn't make it atomic..

> +	state = smp_load_acquire(&mr->state);
> +
>  	if (unlikely((type == RXE_LOOKUP_LOCAL && mr->lkey != key) ||
>  		     (type == RXE_LOOKUP_REMOTE && mr->rkey != key) ||
>  		     mr_pd(mr) != pd || (access && !(access & mr->access)) ||
> -		     mr->state != RXE_MR_STATE_VALID)) {
> +		     state != RXE_MR_STATE_VALID)) {
>  		rxe_put(mr);

This is still just differently racy

The whole point of invalidate is to say that when the invalidate
completion occurs there is absolutely no touching of the memory that
MR points to.

I don't see how this acheives this like this. You need a proper lock
spanning from the lookup here until all the "dma" is completed.

Jason

  reply	other threads:[~2022-07-28 17:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 20:01 [PATCH for-next] RDMA/rxe: Guard mr state with spin lock Bob Pearson
2022-07-28 16:42 ` Jason Gunthorpe [this message]
2022-07-28 17:54   ` Bob Pearson
2022-07-29 17:43     ` Jason Gunthorpe
2022-07-29 17:50     ` Bob Pearson

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=YuK8jXgAncDlppm9@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=rpearsonhpe@gmail.com \
    --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