From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:35154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyx5N-00006U-Ao for qemu-devel@nongnu.org; Wed, 27 Feb 2019 06:09:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyx5M-0002dD-7G for qemu-devel@nongnu.org; Wed, 27 Feb 2019 06:09:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38370) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyx5L-0002W0-Vv for qemu-devel@nongnu.org; Wed, 27 Feb 2019 06:09:12 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0531730A9DFA for ; Wed, 27 Feb 2019 11:09:00 +0000 (UTC) From: Juan Quintela Date: Wed, 27 Feb 2019 12:08:05 +0100 Message-Id: <20190227110812.2185-2-quintela@redhat.com> In-Reply-To: <20190227110812.2185-1-quintela@redhat.com> References: <20190227110812.2185-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v3 1/8] multifd: Only send pages when packet are not empty List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Markus Armbruster , Eric Blake , "Dr. David Alan Gilbert" , Thomas Huth , Juan Quintela , Paolo Bonzini , Laurent Vivier We send packages without pages sometimes for sysnchronizanion. The iov functions do the right thing, but we will be changing this code in future patches. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 59191c1ed2..8b5fd67d66 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1025,9 +1025,12 @@ static void *multifd_send_thread(void *opaque) break; } =20 - ret =3D qio_channel_writev_all(p->c, p->pages->iov, used, &l= ocal_err); - if (ret !=3D 0) { - break; + if (used) { + ret =3D qio_channel_writev_all(p->c, p->pages->iov, + used, &local_err); + if (ret !=3D 0) { + break; + } } =20 qemu_mutex_lock(&p->mutex); @@ -1254,9 +1257,12 @@ static void *multifd_recv_thread(void *opaque) p->num_pages +=3D used; qemu_mutex_unlock(&p->mutex); =20 - ret =3D qio_channel_readv_all(p->c, p->pages->iov, used, &local_= err); - if (ret !=3D 0) { - break; + if (used) { + ret =3D qio_channel_readv_all(p->c, p->pages->iov, + used, &local_err); + if (ret !=3D 0) { + break; + } } =20 if (flags & MULTIFD_FLAG_SYNC) { --=20 2.20.1