From: Peter Xu <peterx@redhat.com>
To: Bin Guo <guobin@linux.alibaba.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH 1/2] migration/rdma: honor blocking mode in QIOChannelRDMA readv
Date: Tue, 16 Jun 2026 15:09:21 -0400 [thread overview]
Message-ID: <ajGfYYFrhlEaklig@x1.local> (raw)
In-Reply-To: <20260529070408.92651-2-guobin@linux.alibaba.com>
On Fri, May 29, 2026 at 03:04:07PM +0800, Bin Guo wrote:
> QIOChannelRDMA's readv ignored the blocking flag set via
> io_set_blocking. In blocking mode it returned immediately instead
> of waiting for data, unlike other QIOChannel implementations.
>
> Loop on qemu_rdma_exchange_recv() when the channel is blocking and
> the receive buffer cannot satisfy the request. Also remove the
> stale XXX comments about unimplemented blocking support.
Zhijian would be the best to comment on this, but based on my limited
understanding, this patch made it the other way round: the channel didn't
respect blocking mode because it always blocks, not always non-block.
>
> Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
> ---
> migration/rdma.c | 46 +++++++++++++++++++++-------------------------
> 1 file changed, 21 insertions(+), 25 deletions(-)
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 3e37a1d440..201cb9eb12 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -388,7 +388,7 @@ struct QIOChannelRDMA {
> QIOChannel parent;
> RDMAContext *rdmain;
> RDMAContext *rdmaout;
> - bool blocking; /* XXX we don't actually honour this yet */
> + bool blocking;
> };
>
> /*
> @@ -2710,32 +2710,29 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *ioc,
> break;
> }
>
> -
> - /* We've got nothing at all, so lets wait for
> - * more to arrive
> - */
> - ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE,
> - errp);
> -
> - if (ret < 0) {
> - rdma->errored = true;
> - return -1;
> - }
> -
> /*
> - * SEND was received with new bytes, now try again.
> + * We've got nothing at all, so lets wait for
> + * more to arrive.
> */
> - len = qemu_rdma_fill(rdma, data, want, 0);
> - done += len;
> - want -= len;
> -
> - /* Still didn't get enough, so lets just return */
> - if (want) {
> - if (done == 0) {
> - return QIO_CHANNEL_ERR_BLOCK;
> - } else {
> - break;
> + do {
> + ret = qemu_rdma_exchange_recv(rdma, &head,
> + RDMA_CONTROL_QEMU_FILE, errp);
IIUC this is the function that always blocks. If to support non-blocking,
my understanding is we need to make this return immediately when no data.
Also, this is only the read path; there's also write.
I'm not sure if supporting non-blocking is trivial to RDMA..
Thanks,
> + if (ret < 0) {
> + rdma->errored = true;
> + return -1;
> }
> +
> + /*
> + * SEND was received with new bytes, now try again.
> + */
> + len = qemu_rdma_fill(rdma, data, want, 0);
> + done += len;
> + want -= len;
> + data += len;
> + } while (want && rioc->blocking);
> +
> + if (want && done == 0) {
> + return QIO_CHANNEL_ERR_BLOCK;
> }
> }
> return done;
> @@ -2771,7 +2768,6 @@ static int qio_channel_rdma_set_blocking(QIOChannel *ioc,
> Error **errp)
> {
> QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(ioc);
> - /* XXX we should make readv/writev actually honour this :-) */
> rioc->blocking = blocking;
> return 0;
> }
> --
> 2.50.1 (Apple Git-155)
>
--
Peter Xu
next prev parent reply other threads:[~2026-06-16 19:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 7:04 [PATCH 0/2] migration/rdma: fix blocking readv and zero-page accounting Bin Guo
2026-05-29 7:04 ` [PATCH 1/2] migration/rdma: honor blocking mode in QIOChannelRDMA readv Bin Guo
2026-06-16 19:09 ` Peter Xu [this message]
2026-05-29 7:04 ` [PATCH 2/2] migration/rdma: account transferred bytes for zero page compression Bin Guo
2026-06-08 1:51 ` [PATCH 0/2] migration/rdma: fix blocking readv and zero-page accounting Zhijian Li (Fujitsu)
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=ajGfYYFrhlEaklig@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=guobin@linux.alibaba.com \
--cc=lizhijian@fujitsu.com \
--cc=qemu-devel@nongnu.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 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.