From nobody Tue Feb 10 15:01:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507114308646699.3820064474701; Wed, 4 Oct 2017 03:51:48 -0700 (PDT) Received: from localhost ([::1]:34296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzhH7-0008Qf-1H for importer@patchew.org; Wed, 04 Oct 2017 06:51:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzhCc-0004yx-BT for qemu-devel@nongnu.org; Wed, 04 Oct 2017 06:46:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzhCb-000306-Hm for qemu-devel@nongnu.org; Wed, 04 Oct 2017 06:46:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38946) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dzhCb-0002z4-9S for qemu-devel@nongnu.org; Wed, 04 Oct 2017 06:46:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 414D7C058EAA for ; Wed, 4 Oct 2017 10:46:56 +0000 (UTC) Received: from secure.mitica (ovpn-116-75.ams2.redhat.com [10.36.116.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id B464C5D9CB; Wed, 4 Oct 2017 10:46:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 414D7C058EAA Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 4 Oct 2017 12:46:32 +0200 Message-Id: <20171004104636.7963-9-quintela@redhat.com> In-Reply-To: <20171004104636.7963-1-quintela@redhat.com> References: <20171004104636.7963-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Oct 2017 10:46:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v9 08/12] migration: Test new fd infrastructure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We just send the address through the alternate channels and test that it is ok. Signed-off-by: Juan Quintela -- Use qio_channel_*all functions --- migration/ram.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 745da2971d..4c16d0775b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -492,8 +492,24 @@ static void *multifd_send_thread(void *opaque) break; } if (p->pages.num) { + Error *local_err =3D NULL; + size_t ret; + int i; + int num; + + num =3D p->pages.num; p->pages.num =3D 0; qemu_mutex_unlock(&p->mutex); + + for (i =3D 0; i < num; i++) { + ret =3D qio_channel_write_all(p->c, + (const char *)&p->pages.iov[i].iov_base, + sizeof(uint8_t *), &local_err); + if (ret !=3D 0) { + terminate_multifd_send_threads(local_err); + return NULL; + } + } qemu_mutex_lock(&multifd_send_state->mutex); p->done =3D true; qemu_mutex_unlock(&multifd_send_state->mutex); @@ -675,6 +691,7 @@ int multifd_load_cleanup(Error **errp) static void *multifd_recv_thread(void *opaque) { MultiFDRecvParams *p =3D opaque; + uint8_t *recv_address; =20 qemu_sem_post(&p->ready); while (true) { @@ -684,7 +701,29 @@ static void *multifd_recv_thread(void *opaque) break; } if (p->pages.num) { + Error *local_err =3D NULL; + size_t ret; + int i; + int num; + + num =3D p->pages.num; p->pages.num =3D 0; + + for (i =3D 0; i < num; i++) { + ret =3D qio_channel_read_all(p->c, (char *)&recv_address, + sizeof(uint8_t *), &local_err); + if (ret !=3D 0) { + terminate_multifd_recv_threads(local_err); + return NULL; + } + if (recv_address !=3D p->pages.iov[i].iov_base) { + error_setg(&local_err, "received %p and expecting %p (= %d)", + recv_address, p->pages.iov[i].iov_base, i); + terminate_multifd_recv_threads(local_err); + return NULL; + } + } + p->done =3D true; qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->ready); --=20 2.13.5