From patchwork Fri Oct 21 19:42:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 9390019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31E8460231 for ; Fri, 21 Oct 2016 19:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CAD82A275 for ; Fri, 21 Oct 2016 19:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A6FA2A272; Fri, 21 Oct 2016 19:47:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AABC82A272 for ; Fri, 21 Oct 2016 19:47:40 +0000 (UTC) Received: from localhost ([::1]:34105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxfn1-0000ci-Vr for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Oct 2016 15:47:40 -0400 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) Received: from emacs.mitica (ovpn-116-122.ams2.redhat.com [10.36.116.122]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9LJgLri018033; Fri, 21 Oct 2016 15:42:38 -0400 From: Juan Quintela To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 21 Oct 2016 19:42:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 11/13] 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: amit.shah@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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;