From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxfiD-0005JQ-Jr for qemu-devel@nongnu.org; Fri, 21 Oct 2016 15:42:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxfiC-0007ZW-Fx for qemu-devel@nongnu.org; Fri, 21 Oct 2016 15:42:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45666) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxfiC-0007ZE-8W for qemu-devel@nongnu.org; Fri, 21 Oct 2016 15:42:40 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DC4B635F3 for ; Fri, 21 Oct 2016 19:42:39 +0000 (UTC) From: Juan Quintela Date: Fri, 21 Oct 2016 21:42:13 +0200 Message-Id: <1477078935-7182-12-git-send-email-quintela@redhat.com> In-Reply-To: <1477078935-7182-1-git-send-email-quintela@redhat.com> References: <1477078935-7182-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 11/13] migration: Test new fd infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, dgilbert@redhat.com We just send the address through the alternate channels and test that it is ok. Signed-off-by: Juan Quintela --- migration/ram.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 294a99e..2ead443 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -421,6 +421,7 @@ QemuCond multifd_send_cond; static void *multifd_send_thread(void *opaque) { MultiFDSendParams *params = opaque; + uint8_t *address; char start = 's'; qio_channel_write(params->c, &start, 1, &error_abort); @@ -432,8 +433,16 @@ static void *multifd_send_thread(void *opaque) qemu_mutex_lock(¶ms->mutex); while (!params->quit){ if (params->address) { + address = params->address; params->address = 0; qemu_mutex_unlock(¶ms->mutex); + + if (qio_channel_write(params->c, (const char *)&address, + sizeof(uint8_t *), &error_abort) + != sizeof(uint8_t*)) { + /* Shuoudn't ever happen */ + exit(-1); + } qemu_mutex_lock(&multifd_send_mutex); params->done = true; qemu_cond_signal(&multifd_send_cond); @@ -565,6 +574,8 @@ QemuCond multifd_recv_cond; static void *multifd_recv_thread(void *opaque) { MultiFDRecvParams *params = opaque; + uint8_t *address; + uint8_t *recv_address; char start; qio_channel_read(params->c, &start, 1, &error_abort); @@ -576,8 +587,23 @@ static void *multifd_recv_thread(void *opaque) qemu_mutex_lock(¶ms->mutex); while (!params->quit){ if (params->address) { + address = params->address; params->address = 0; qemu_mutex_unlock(¶ms->mutex); + + if (qio_channel_read(params->c, (char *)&recv_address, + sizeof(uint8_t*), &error_abort) + != sizeof(uint8_t *)) { + /* shouldn't ever happen */ + exit(-1); + } + + if (address != recv_address) { + printf("We received %p what we were expecting %p\n", + recv_address, address); + exit(-1); + } + qemu_mutex_lock(&multifd_recv_mutex); params->done = true; qemu_cond_signal(&multifd_recv_cond); @@ -2888,10 +2914,6 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) case RAM_SAVE_FLAG_MULTIFD_PAGE: fd_num = qemu_get_be16(f); - if (fd_num != 0) { - /* this is yet an unused variable, changed later */ - fd_num = 0; - } multifd_recv_page(host, fd_num); qemu_get_buffer(f, host, TARGET_PAGE_SIZE); break; -- 2.7.4