All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org, michael@hinespot.com, quintela@redhat.com,
	lvivier@redhat.com, berrange@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/5] migration/rdma: Fix race on source
Date: Wed, 12 Jul 2017 11:13:17 +0800	[thread overview]
Message-ID: <20170712031317.GC29326@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170704184915.31586-2-dgilbert@redhat.com>

On Tue, Jul 04, 2017 at 07:49:11PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Fix a race where the destination might try and send the source a
> WRID_READY before the source has done a post-recv for it.
> 
> rdma_post_recv has to happen after the qp exists, and we're
> OK since we've already called qemu_rdma_source_init that calls
> qemu_alloc_qp.

Though I am not very familiar with the whole RDMA path, this makes
sense to me.

> 
> This corresponds to:
> https://bugzilla.redhat.com/show_bug.cgi?id=1285044
> 
> The race can be triggered by adding a few ms wait before this
> post_recv_control (which was originally due to me turning on loads of
> debug).
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

> ---
>  migration/rdma.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/migration/rdma.c b/migration/rdma.c
> index c6bc607a03..6111e10c70 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -2365,6 +2365,12 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
>  
>      caps_to_network(&cap);
>  
> +    ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY);
> +    if (ret) {
> +        ERROR(errp, "posting second control recv");
> +        goto err_rdma_source_connect;
> +    }
> +
>      ret = rdma_connect(rdma->cm_id, &conn_param);
>      if (ret) {
>          perror("rdma_connect");
> @@ -2405,12 +2411,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
>  
>      rdma_ack_cm_event(cm_event);
>  
> -    ret = qemu_rdma_post_recv_control(rdma, RDMA_WRID_READY);
> -    if (ret) {
> -        ERROR(errp, "posting second control recv!");
> -        goto err_rdma_source_connect;
> -    }
> -
>      rdma->control_ready_expected = 1;
>      rdma->nb_sent = 0;
>      return 0;
> -- 
> 2.13.0
> 

-- 
Peter Xu

  reply	other threads:[~2017-07-12  3:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 18:49 [Qemu-devel] [PATCH 0/5] A bunch of RDMA fixes Dr. David Alan Gilbert (git)
2017-07-04 18:49 ` [Qemu-devel] [PATCH 1/5] migration/rdma: Fix race on source Dr. David Alan Gilbert (git)
2017-07-12  3:13   ` Peter Xu [this message]
2017-07-04 18:49 ` [Qemu-devel] [PATCH 2/5] migration: Close file on failed migration load Dr. David Alan Gilbert (git)
2017-07-12  3:20   ` Peter Xu
2017-07-12 11:00     ` Dr. David Alan Gilbert
2017-07-14  2:51       ` Peter Xu
2017-07-04 18:49 ` [Qemu-devel] [PATCH 3/5] migration/rdma: Allow cancelling while waiting for wrid Dr. David Alan Gilbert (git)
2017-07-12  9:32   ` Peter Xu
2017-07-12 12:36     ` Dr. David Alan Gilbert
2017-07-14  2:57       ` Peter Xu
2017-07-04 18:49 ` [Qemu-devel] [PATCH 4/5] migration/rdma: Safely convert control types Dr. David Alan Gilbert (git)
2017-07-12  3:24   ` Peter Xu
2017-07-04 18:49 ` [Qemu-devel] [PATCH 5/5] migration/rdma: Send error during cancelling Dr. David Alan Gilbert (git)
2017-07-12  3:42   ` Peter Xu

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=20170712031317.GC29326@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=michael@hinespot.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.