From: Jason Gunthorpe <jgg@nvidia.com>
To: Haakon Bugge <haakon.bugge@oracle.com>
Cc: Leon Romanovsky <leon@kernel.org>,
Dmitry Vyukov <dvyukov@google.com>,
OFED mailing list <linux-rdma@vger.kernel.org>,
"syzbot+dc3dfba010d7671e05f5@syzkaller.appspotmail.com"
<syzbot+dc3dfba010d7671e05f5@syzkaller.appspotmail.com>
Subject: Re: [PATCH rc] RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests
Date: Wed, 22 Sep 2021 11:44:17 -0300 [thread overview]
Message-ID: <20210922144417.GW327412@nvidia.com> (raw)
In-Reply-To: <27C1E678-2EC4-4916-9720-00C1B69EA5AA@oracle.com>
On Wed, Sep 22, 2021 at 09:38:40AM +0000, Haakon Bugge wrote:
> >> @@ -3413,6 +3421,15 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
> >> if (dst_addr->sa_family == AF_IB) {
> >> ret = cma_resolve_ib_addr(id_priv);
> >> } else {
> >> + /* The FSM can return back to RDMA_CM_ADDR_BOUND after
> >> + * rdma_resolve_ip() is called, eg through the error
> >> + * path in addr_handler. If this happens the existing
> >> + * request must be canceled before issuing a new one.
> >> + */
> >> + if (id_priv->used_resolve_ip)
> >> + rdma_addr_cancel(&id->route.addr.dev_addr);
> >> + else
> >> + id_priv->used_resolve_ip = 1;
> >
> > Why don't you never clear this field? If you assume that this is one lifetime
> > event, can you please add a comment with an explanation "why"?
>
> Adding to that, don't you need {READ,WRITE}_ONCE when accessing
> used_resolve_ip?
The FSM logic guarentees there is no concurrent access here, this is
the only thread that can be in this state at this point.
> Or will the write to it obtain global visibility because
> mutex_unlock(&ctx->mutex) is executed before any other context can
> read it?
Global visibility flows indirectly through the rdma_resolve_ip() to
the work. Basically when the rdma_resolve_ip schedules the work it
does a full release, then the work does a spinlock/unlock which is
another full release, finally the next time we go through this
function it does another spinlock/unlock which will act as ancquire
for this store.
Jason
next prev parent reply other threads:[~2021-09-22 14:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 18:34 [PATCH rc] RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests Jason Gunthorpe
2021-09-22 8:01 ` Leon Romanovsky
2021-09-22 9:38 ` Haakon Bugge
2021-09-22 14:44 ` Jason Gunthorpe [this message]
2021-09-22 14:41 ` Jason Gunthorpe
2021-09-23 5:49 ` Leon Romanovsky
2021-09-23 11:45 ` Jason Gunthorpe
2021-09-23 18:15 ` Leon Romanovsky
2021-09-23 20:03 ` Jason Gunthorpe
2021-09-23 23:17 ` Leon Romanovsky
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=20210922144417.GW327412@nvidia.com \
--to=jgg@nvidia.com \
--cc=dvyukov@google.com \
--cc=haakon.bugge@oracle.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=syzbot+dc3dfba010d7671e05f5@syzkaller.appspotmail.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;
as well as URLs for NNTP newsgroup(s).