From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554293139066794.9018784110664; Wed, 3 Apr 2019 05:05:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:54316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeds-0008IU-SN for importer@patchew.org; Wed, 03 Apr 2019 08:05:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeYa-0004ou-OG for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeYZ-0005FO-S6 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeYZ-0005D2-LL for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:51 -0400 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 AA67C8553D for ; Wed, 3 Apr 2019 11:51:31 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC28D6402C; Wed, 3 Apr 2019 11:51:29 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:51 +0200 Message-Id: <20190403114958.3705-2-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 03 Apr 2019 11:51:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 1/8] migration: Fix migrate_set_parameter 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Otherwise we are setting err twice, what is wrong and causes an abort. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- hmp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hmp.c b/hmp.c index 92941142af..8eec768088 100644 --- a/hmp.c +++ b/hmp.c @@ -1825,8 +1825,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: p->has_xbzrle_cache_size =3D true; visit_type_size(v, param, &cache_size, &err); - if (err || cache_size > INT64_MAX - || (size_t)cache_size !=3D cache_size) { + if (err) { + break; + } + if (cache_size > INT64_MAX || (size_t)cache_size !=3D cache_size) { error_setg(&err, "Invalid size %s", valuestr); break; } --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15542929496941003.2771257134581; Wed, 3 Apr 2019 05:02:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:53555 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeb4-0006Kz-O2 for importer@patchew.org; Wed, 03 Apr 2019 08:02:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeYd-0004rE-Q3 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeYc-0005Qm-Rl for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeYc-0005OP-Kq for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:59:54 -0400 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 E8A5C30821A5 for ; Wed, 3 Apr 2019 11:51:33 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09A06608DD; Wed, 3 Apr 2019 11:51:31 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:52 +0200 Message-Id: <20190403114958.3705-3-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 03 Apr 2019 11:51:33 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 2/8] migration: fix multifd_recv event typo 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It uses num in multifd_send(). Make it coherent. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/trace-events b/migration/trace-events index de2e136e57..cd50a1e659 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -80,7 +80,7 @@ get_queued_page_not_dirty(const char *block_name, uint64_= t tmp_offset, unsigned migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_throttle(void) "" -multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet number %" PRIu64 " pages %= d flags 0x%x next packet size %d" +multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" multifd_recv_sync_main(long packet_num) "packet num %ld" multifd_recv_sync_main_signal(uint8_t id) "channel %d" multifd_recv_sync_main_wait(uint8_t id) "channel %d" --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554292950504133.3297149703069; Wed, 3 Apr 2019 05:02:30 -0700 (PDT) Received: from localhost ([127.0.0.1]:53547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeb4-0006K7-FR for importer@patchew.org; Wed, 03 Apr 2019 08:02:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeX7-0003jc-DX for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeWz-0002Fv-45 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37956) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeWx-0002EF-Pc for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:12 -0400 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 324BA3086204 for ; Wed, 3 Apr 2019 11:51:36 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A356608D3; Wed, 3 Apr 2019 11:51:34 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:53 +0200 Message-Id: <20190403114958.3705-4-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 03 Apr 2019 11:51:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 3/8] migration-test: rename parameter to parameter_int 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We would need _str ones on the next patch. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 49 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index bd3f5c3125..0b25aa3d6c 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -392,7 +392,8 @@ static char *migrate_get_socket_address(QTestState *who= , const char *parameter) return result; } =20 -static long long migrate_get_parameter(QTestState *who, const char *parame= ter) +static long long migrate_get_parameter_int(QTestState *who, + const char *parameter) { QDict *rsp; long long result; @@ -403,17 +404,17 @@ static long long migrate_get_parameter(QTestState *wh= o, const char *parameter) return result; } =20 -static void migrate_check_parameter(QTestState *who, const char *parameter, - long long value) +static void migrate_check_parameter_int(QTestState *who, const char *param= eter, + long long value) { long long result; =20 - result =3D migrate_get_parameter(who, parameter); + result =3D migrate_get_parameter_int(who, parameter); g_assert_cmpint(result, =3D=3D, value); } =20 -static void migrate_set_parameter(QTestState *who, const char *parameter, - long long value) +static void migrate_set_parameter_int(QTestState *who, const char *paramet= er, + long long value) { QDict *rsp; =20 @@ -423,7 +424,7 @@ static void migrate_set_parameter(QTestState *who, cons= t char *parameter, parameter, value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); - migrate_check_parameter(who, parameter, value); + migrate_check_parameter_int(who, parameter, value); } =20 static void migrate_pause(QTestState *who) @@ -672,7 +673,7 @@ static void deprecated_set_downtime(QTestState *who, co= nst double value) " 'arguments': { 'value': %f } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); - migrate_check_parameter(who, "downtime-limit", value * 1000); + migrate_check_parameter_int(who, "downtime-limit", value * 1000); } =20 static void deprecated_set_speed(QTestState *who, long long value) @@ -683,7 +684,7 @@ static void deprecated_set_speed(QTestState *who, long = long value) "'arguments': { 'value': %lld } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); - migrate_check_parameter(who, "max-bandwidth", value); + migrate_check_parameter_int(who, "max-bandwidth", value); } =20 static void deprecated_set_cache_size(QTestState *who, long long value) @@ -694,7 +695,7 @@ static void deprecated_set_cache_size(QTestState *who, = long long value) "'arguments': { 'value': %lld } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); - migrate_check_parameter(who, "xbzrle-cache-size", value); + migrate_check_parameter_int(who, "xbzrle-cache-size", value); } =20 static void test_deprecated(void) @@ -729,8 +730,8 @@ static int migrate_postcopy_prepare(QTestState **from_p= tr, * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. */ - migrate_set_parameter(from, "max-bandwidth", 100000000); - migrate_set_parameter(from, "downtime-limit", 1); + migrate_set_parameter_int(from, "max-bandwidth", 100000000); + migrate_set_parameter_int(from, "downtime-limit", 1); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -781,7 +782,7 @@ static void test_postcopy_recovery(void) } =20 /* Turn postcopy speed down, 4K/s is slow enough on any machines */ - migrate_set_parameter(from, "max-postcopy-bandwidth", 4096); + migrate_set_parameter_int(from, "max-postcopy-bandwidth", 4096); =20 /* Now we start the postcopy */ migrate_postcopy_start(from, to); @@ -822,7 +823,7 @@ static void test_postcopy_recovery(void) g_free(uri); =20 /* Restore the postcopy bandwidth to unlimited */ - migrate_set_parameter(from, "max-postcopy-bandwidth", 0); + migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); =20 migrate_postcopy_complete(from, to); } @@ -868,9 +869,9 @@ static void test_precopy_unix(void) * machine, so also set the downtime. */ /* 1 ms should make it not converge*/ - migrate_set_parameter(from, "downtime-limit", 1); + migrate_set_parameter_int(from, "downtime-limit", 1); /* 1GB/s */ - migrate_set_parameter(from, "max-bandwidth", 1000000000); + migrate_set_parameter_int(from, "max-bandwidth", 1000000000); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -880,7 +881,7 @@ static void test_precopy_unix(void) wait_for_migration_pass(from); =20 /* 300 ms should converge */ - migrate_set_parameter(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", 300); =20 if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -947,11 +948,11 @@ static void test_xbzrle(const char *uri) * machine, so also set the downtime. */ /* 1 ms should make it not converge*/ - migrate_set_parameter(from, "downtime-limit", 1); + migrate_set_parameter_int(from, "downtime-limit", 1); /* 1GB/s */ - migrate_set_parameter(from, "max-bandwidth", 1000000000); + migrate_set_parameter_int(from, "max-bandwidth", 1000000000); =20 - migrate_set_parameter(from, "xbzrle-cache-size", 33554432); + migrate_set_parameter_int(from, "xbzrle-cache-size", 33554432); =20 migrate_set_capability(from, "xbzrle", "true"); migrate_set_capability(to, "xbzrle", "true"); @@ -963,7 +964,7 @@ static void test_xbzrle(const char *uri) wait_for_migration_pass(from); =20 /* 300ms should converge */ - migrate_set_parameter(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", 300); =20 if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); @@ -999,9 +1000,9 @@ static void test_precopy_tcp(void) * machine, so also set the downtime. */ /* 1 ms should make it not converge*/ - migrate_set_parameter(from, "downtime-limit", 1); + migrate_set_parameter_int(from, "downtime-limit", 1); /* 1GB/s */ - migrate_set_parameter(from, "max-bandwidth", 1000000000); + migrate_set_parameter_int(from, "max-bandwidth", 1000000000); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -1013,7 +1014,7 @@ static void test_precopy_tcp(void) wait_for_migration_pass(from); =20 /* 300ms should converge */ - migrate_set_parameter(from, "downtime-limit", 300); + migrate_set_parameter_int(from, "downtime-limit", 300); =20 if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554293289362845.6252190220564; Wed, 3 Apr 2019 05:08:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:55123 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBegY-00020P-7g for importer@patchew.org; Wed, 03 Apr 2019 08:08:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeZE-0005SO-OH for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeZ9-0006MH-SA for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41342) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeZ9-0006LK-KS for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:27 -0400 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 8C1F9307D850 for ; Wed, 3 Apr 2019 11:51:38 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id A15F86402C; Wed, 3 Apr 2019 11:51:36 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:54 +0200 Message-Id: <20190403114958.3705-5-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 03 Apr 2019 11:51:38 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 4/8] tests: Add migration multifd test 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We set multifd-channels. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- tests/migration-test.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 0b25aa3d6c..ff480e0682 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -1028,6 +1028,53 @@ static void test_precopy_tcp(void) g_free(uri); } =20 +static void test_multifd_tcp(void) +{ + char *uri; + QTestState *from, *to; + + if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false, false)) { + return; + } + + /* + * We want to pick a speed slow enough that the test completes + * quickly, but that it doesn't complete precopy even on a slow + * machine, so also set the downtime. + */ + /* 1 ms should make it not converge*/ + migrate_set_parameter_int(from, "downtime-limit", 1); + /* 1GB/s */ + migrate_set_parameter_int(from, "max-bandwidth", 1000000000); + + migrate_set_parameter_int(from, "multifd-channels", 2); + migrate_set_parameter_int(to, "multifd-channels", 2); + + migrate_set_capability(from, "multifd", "true"); + migrate_set_capability(to, "multifd", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + uri =3D migrate_get_socket_address(to, "socket-address"); + + migrate(from, uri, "{}"); + + wait_for_migration_pass(from); + + /* 300ms it should converge */ + migrate_set_parameter_int(from, "downtime-limit", 600); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to, true); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -1082,6 +1129,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */ qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); + qtest_add_func("/migration/multifd/tcp", test_multifd_tcp); =20 ret =3D g_test_run(); =20 --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554292961635915.4691551876076; Wed, 3 Apr 2019 05:02:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:53597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBebG-0006Yl-IH for importer@patchew.org; Wed, 03 Apr 2019 08:02:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeYq-000510-Dg for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeYp-0005q2-DS for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeYp-0005m5-5t for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:07 -0400 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 CEEB3C049E22 for ; Wed, 3 Apr 2019 11:51:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id E36D2608D3; Wed, 3 Apr 2019 11:51:38 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:55 +0200 Message-Id: <20190403114958.3705-6-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 03 Apr 2019 11:51:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 5/8] migration-test: introduce functions to handle string parameters 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/migration-test.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index ff480e0682..65d5e256a7 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -427,6 +427,43 @@ static void migrate_set_parameter_int(QTestState *who,= const char *parameter, migrate_check_parameter_int(who, parameter, value); } =20 +static char *migrate_get_parameter_str(QTestState *who, + const char *parameter) +{ + QDict *rsp; + char *result; + + rsp =3D wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + result =3D g_strdup(qdict_get_str(rsp, parameter)); + qobject_unref(rsp); + return result; +} + +static void migrate_check_parameter_str(QTestState *who, const char *param= eter, + const char *value) +{ + char *result; + + result =3D migrate_get_parameter_str(who, parameter); + g_assert_cmpstr(result, =3D=3D, value); + g_free(result); +} + +__attribute__((unused)) +static void migrate_set_parameter_str(QTestState *who, const char *paramet= er, + const char *value) +{ + QDict *rsp; + + rsp =3D qtest_qmp(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: %s } }", + parameter, value); + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); + migrate_check_parameter_str(who, parameter, value); +} + static void migrate_pause(QTestState *who) { QDict *rsp; --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554293302893377.9376191174365; Wed, 3 Apr 2019 05:08:22 -0700 (PDT) Received: from localhost ([127.0.0.1]:55178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBegn-00028k-LZ for importer@patchew.org; Wed, 03 Apr 2019 08:08:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeaI-00065x-CT for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:01:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeaB-0008NR-S1 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:01:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60508) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBea9-00086Q-3k for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:01:29 -0400 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 1BFE35D5F6 for ; Wed, 3 Apr 2019 11:51:43 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3198A6402C; Wed, 3 Apr 2019 11:51:41 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:56 +0200 Message-Id: <20190403114958.3705-7-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 03 Apr 2019 11:51:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 6/8] migration: Add multifd-compress parameter 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- Rename it to NONE --- hmp.c | 17 +++++++++++++++++ hw/core/qdev-properties.c | 11 +++++++++++ include/hw/qdev-properties.h | 1 + migration/migration.c | 16 ++++++++++++++++ qapi/common.json | 13 +++++++++++++ qapi/migration.json | 19 +++++++++++++++---- tests/migration-test.c | 13 ++++++++++--- 7 files changed, 83 insertions(+), 7 deletions(-) diff --git a/hmp.c b/hmp.c index 8eec768088..02fbe27757 100644 --- a/hmp.c +++ b/hmp.c @@ -435,6 +435,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), params->multifd_channels); + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESS), + MultifdCompress_str(params->multifd_compress)); monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); @@ -1737,6 +1740,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) MigrateSetParameters *p =3D g_new0(MigrateSetParameters, 1); uint64_t valuebw =3D 0; uint64_t cache_size; + int compress_type; Error *err =3D NULL; int val, ret; =20 @@ -1822,6 +1826,19 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) p->has_multifd_channels =3D true; visit_type_int(v, param, &p->multifd_channels, &err); break; + case MIGRATION_PARAMETER_MULTIFD_COMPRESS: + p->has_multifd_compress =3D true; + visit_type_enum(v, param, &compress_type, + &MultifdCompress_lookup, &err); + if (err) { + break; + } + if (compress_type < 0 || compress_type > MULTIFD_COMPRESS__MAX) { + error_setg(&err, "Invalid multifd_compress option %s", valuest= r); + break; + } + p->multifd_compress =3D compress_type; + break; case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: p->has_xbzrle_cache_size =3D true; visit_type_size(v, param, &cache_size, &err); diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5da1439a8b..7c8e71532f 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -645,6 +645,17 @@ const PropertyInfo qdev_prop_fdc_drive_type =3D { .set_default_value =3D set_default_value_enum, }; =20 +/* --- MultifdCompress --- */ + +const PropertyInfo qdev_prop_multifd_compress =3D { + .name =3D "MultifdCompress", + .description =3D "multifd_compress values", + .enum_table =3D &MultifdCompress_lookup, + .get =3D get_enum, + .set =3D set_enum, + .set_default_value =3D set_default_value_enum, +}; + /* --- pci address --- */ =20 /* diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index b6758c852e..ac452d8f2c 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -23,6 +23,7 @@ extern const PropertyInfo qdev_prop_tpm; extern const PropertyInfo qdev_prop_ptr; extern const PropertyInfo qdev_prop_macaddr; extern const PropertyInfo qdev_prop_on_off_auto; +extern const PropertyInfo qdev_prop_multifd_compress; extern const PropertyInfo qdev_prop_losttickpolicy; extern const PropertyInfo qdev_prop_blockdev_on_error; extern const PropertyInfo qdev_prop_bios_chs_trans; diff --git a/migration/migration.c b/migration/migration.c index 609e0df5d0..d6f8ef342a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -82,6 +82,7 @@ /* The delay time (in ms) between two COLO checkpoints */ #define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) #define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 +#define DEFAULT_MIGRATE_MULTIFD_COMPRESS MULTIFD_COMPRESS_NONE =20 /* Background transfer rate for postcopy, 0 means unlimited, note * that page requests can still exceed this limit. @@ -769,6 +770,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->block_incremental =3D s->parameters.block_incremental; params->has_multifd_channels =3D true; params->multifd_channels =3D s->parameters.multifd_channels; + params->has_multifd_compress =3D true; + params->multifd_compress =3D s->parameters.multifd_compress; params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; params->has_max_postcopy_bandwidth =3D true; @@ -1268,6 +1271,9 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, if (params->has_multifd_channels) { dest->multifd_channels =3D params->multifd_channels; } + if (params->has_multifd_compress) { + dest->multifd_compress =3D params->multifd_compress; + } if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size =3D params->xbzrle_cache_size; } @@ -1364,6 +1370,9 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) if (params->has_multifd_channels) { s->parameters.multifd_channels =3D params->multifd_channels; } + if (params->has_multifd_compress) { + s->parameters.multifd_compress =3D params->multifd_compress; + } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; xbzrle_cache_resize(params->xbzrle_cache_size, errp); @@ -3353,6 +3362,9 @@ void migration_global_dump(Monitor *mon) #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) =20 +#define DEFINE_PROP_MULTIFD_COMPRESS(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compress, Multifd= Compress) + static Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), @@ -3392,6 +3404,9 @@ static Property migration_properties[] =3D { DEFINE_PROP_UINT8("multifd-channels", MigrationState, parameters.multifd_channels, DEFAULT_MIGRATE_MULTIFD_CHANNELS), + DEFINE_PROP_MULTIFD_COMPRESS("multifd-compress", MigrationState, + parameters.multifd_compress, + DEFAULT_MIGRATE_MULTIFD_COMPRESS), DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, parameters.xbzrle_cache_size, DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), @@ -3481,6 +3496,7 @@ static void migration_instance_init(Object *obj) params->has_x_checkpoint_delay =3D true; params->has_block_incremental =3D true; params->has_multifd_channels =3D true; + params->has_multifd_compress =3D true; params->has_xbzrle_cache_size =3D true; params->has_max_postcopy_bandwidth =3D true; params->has_max_cpu_throttle =3D true; diff --git a/qapi/common.json b/qapi/common.json index 99d313ef3b..7248172792 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -193,3 +193,16 @@ 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] } + +## +# @MultifdCompress: +# +# An enumeration of multifd compression. +# +# @none: no compression. +# +# Since: 4.1 +# +## +{ 'enum': 'MultifdCompress', + 'data': [ 'none' ] } diff --git a/qapi/migration.json b/qapi/migration.json index 9cfbaf8c6c..629795fd30 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -580,6 +580,9 @@ # @max-cpu-throttle: maximum cpu throttle percentage. # Defaults to 99. (Since 3.1) # +# @multifd-compress: What compression method to use. +# Defaults to none. (Since 4.1) +# # Since: 2.4 ## { 'enum': 'MigrationParameter', @@ -592,7 +595,7 @@ 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', - 'max-cpu-throttle' ] } + 'max-cpu-throttle', 'multifd-compress' ] } =20 ## # @MigrateSetParameters: @@ -680,7 +683,10 @@ # (Since 3.0) # # @max-cpu-throttle: maximum cpu throttle percentage. -# The default value is 99. (Since 3.1) +# The default value is 99. (Since 4.0) +# +# @multifd-compress: What compression method to use. +# Defaults to none. (Since 4.1) # # Since: 2.4 ## @@ -707,7 +713,8 @@ '*multifd-channels': 'int', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle': 'int' } } + '*max-cpu-throttle': 'int', + '*multifd-compress': 'MultifdCompress' } } =20 ## # @migrate-set-parameters: @@ -817,6 +824,9 @@ # Defaults to 99. # (Since 3.1) # +# @multifd-compress: What compression method to use. +# Defaults to none. (Since 4.1) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -840,7 +850,8 @@ '*multifd-channels': 'uint8', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', - '*max-cpu-throttle':'uint8'} } + '*max-cpu-throttle': 'uint8', + '*multifd-compress': 'MultifdCompress' } } =20 ## # @query-migrate-parameters: diff --git a/tests/migration-test.c b/tests/migration-test.c index 65d5e256a7..8a1ccc2516 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -449,7 +449,6 @@ static void migrate_check_parameter_str(QTestState *who= , const char *parameter, g_free(result); } =20 -__attribute__((unused)) static void migrate_set_parameter_str(QTestState *who, const char *paramet= er, const char *value) { @@ -1065,7 +1064,7 @@ static void test_precopy_tcp(void) g_free(uri); } =20 -static void test_multifd_tcp(void) +static void test_multifd_tcp(const char *method) { char *uri; QTestState *from, *to; @@ -1087,6 +1086,9 @@ static void test_multifd_tcp(void) migrate_set_parameter_int(from, "multifd-channels", 2); migrate_set_parameter_int(to, "multifd-channels", 2); =20 + migrate_set_parameter_str(from, "multifd-compress", method); + migrate_set_parameter_str(to, "multifd-compress", method); + migrate_set_capability(from, "multifd", "true"); migrate_set_capability(to, "multifd", "true"); /* Wait for the first serial output from the source */ @@ -1112,6 +1114,11 @@ static void test_multifd_tcp(void) test_migrate_end(from, to, true); } =20 +static void test_multifd_tcp_none(void) +{ + test_multifd_tcp("none"); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -1166,7 +1173,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */ qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); - qtest_add_func("/migration/multifd/tcp", test_multifd_tcp); + qtest_add_func("/migration/multifd/tcp/none", test_multifd_tcp_none); =20 ret =3D g_test_run(); =20 --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554293134888174.30268024960822; Wed, 3 Apr 2019 05:05:34 -0700 (PDT) Received: from localhost ([127.0.0.1]:54362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBee1-0008PW-HF for importer@patchew.org; Wed, 03 Apr 2019 08:05:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeZ8-0005NV-JL for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeZ7-0006Hy-2J for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60196) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeZ6-0006Gr-N2 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 08:00:24 -0400 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 5F916307CDEA for ; Wed, 3 Apr 2019 11:51:45 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72C8D6402C; Wed, 3 Apr 2019 11:51:43 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:57 +0200 Message-Id: <20190403114958.3705-8-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 03 Apr 2019 11:51:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 7/8] multifd: Add zlib compression support 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 9 ++++++++ migration/migration.h | 1 + migration/ram.c | 47 ++++++++++++++++++++++++++++++++++++++++++ qapi/common.json | 4 +++- tests/migration-test.c | 6 ++++++ 5 files changed, 66 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index d6f8ef342a..69d85cbe5e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2141,6 +2141,15 @@ bool migrate_use_multifd(void) return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 +bool migrate_use_multifd_zlib(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_compress =3D=3D MULTIFD_COMPRESS_ZLIB; +} + bool migrate_pause_before_switchover(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 438f17edad..fc4fb841d4 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -269,6 +269,7 @@ bool migrate_ignore_shared(void); =20 bool migrate_auto_converge(void); bool migrate_use_multifd(void); +bool migrate_use_multifd_zlib(void); bool migrate_pause_before_switchover(void); int migrate_multifd_channels(void); =20 diff --git a/migration/ram.c b/migration/ram.c index d7f8fe45a8..06b25ac66d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -582,6 +582,7 @@ exit: #define MULTIFD_VERSION 1 =20 #define MULTIFD_FLAG_SYNC (1 << 0) +#define MULTIFD_FLAG_ZLIB (1 << 1) =20 /* This value needs to be a multiple of qemu_target_page_size() */ #define MULTIFD_PACKET_SIZE (512 * 1024) @@ -663,6 +664,12 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* stream for compression */ + z_stream zs; + /* compressed buffer */ + uint8_t *zbuff; + /* size of compressed buffer */ + uint32_t zbuff_len; } MultiFDSendParams; =20 typedef struct { @@ -698,6 +705,12 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* stream for compression */ + z_stream zs; + /* compressed buffer */ + uint8_t *zbuff; + /* size of compressed buffer */ + uint32_t zbuff_len; } MultiFDRecvParams; =20 static int multifd_send_initial_packet(MultiFDSendParams *p, Error **errp) @@ -1035,6 +1048,9 @@ void multifd_save_cleanup(void) p->packet_len =3D 0; g_free(p->packet); p->packet =3D NULL; + deflateEnd(&p->zs); + g_free(p->zbuff); + p->zbuff =3D NULL; } qemu_sem_destroy(&multifd_send_state->channels_ready); qemu_sem_destroy(&multifd_send_state->sem_sync); @@ -1198,6 +1214,7 @@ int multifd_save_setup(void) =20 for (i =3D 0; i < thread_count; i++) { MultiFDSendParams *p =3D &multifd_send_state->params[i]; + z_stream *zs =3D &p->zs; =20 qemu_mutex_init(&p->mutex); qemu_sem_init(&p->sem, 0); @@ -1211,6 +1228,17 @@ int multifd_save_setup(void) p->packet =3D g_malloc0(p->packet_len); p->name =3D g_strdup_printf("multifdsend_%d", i); socket_send_channel_create(multifd_new_send_channel_async, p); + zs->zalloc =3D Z_NULL; + zs->zfree =3D Z_NULL; + zs->opaque =3D Z_NULL; + if (deflateInit(zs, migrate_compress_level()) !=3D Z_OK) { + printf("deflate init failed\n"); + return -1; + } + /* We will never have more than page_count pages */ + p->zbuff_len =3D page_count * qemu_target_page_size(); + p->zbuff_len *=3D 2; + p->zbuff =3D g_malloc0(p->zbuff_len); } return 0; } @@ -1278,6 +1306,9 @@ int multifd_load_cleanup(Error **errp) p->packet_len =3D 0; g_free(p->packet); p->packet =3D NULL; + inflateEnd(&p->zs); + g_free(p->zbuff); + p->zbuff =3D NULL; } qemu_sem_destroy(&multifd_recv_state->sem_sync); g_free(multifd_recv_state->params); @@ -1396,6 +1427,7 @@ int multifd_load_setup(void) =20 for (i =3D 0; i < thread_count; i++) { MultiFDRecvParams *p =3D &multifd_recv_state->params[i]; + z_stream *zs =3D &p->zs; =20 qemu_mutex_init(&p->mutex); qemu_sem_init(&p->sem_sync, 0); @@ -1405,6 +1437,21 @@ int multifd_load_setup(void) + sizeof(ram_addr_t) * page_count; p->packet =3D g_malloc0(p->packet_len); p->name =3D g_strdup_printf("multifdrecv_%d", i); + + zs->zalloc =3D Z_NULL; + zs->zfree =3D Z_NULL; + zs->opaque =3D Z_NULL; + zs->avail_in =3D 0; + zs->next_in =3D Z_NULL; + if (inflateInit(zs) !=3D Z_OK) { + printf("inflate init failed\n"); + return -1; + } + /* We will never have more than page_count pages */ + p->zbuff_len =3D page_count * qemu_target_page_size(); + /* We know compression "could" use more space */ + p->zbuff_len *=3D 2; + p->zbuff =3D g_malloc0(p->zbuff_len); } return 0; } diff --git a/qapi/common.json b/qapi/common.json index 7248172792..89df6854cb 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -201,8 +201,10 @@ # # @none: no compression. # +# @zlib: Compress using zlib. +# # Since: 4.1 # ## { 'enum': 'MultifdCompress', - 'data': [ 'none' ] } + 'data': [ 'none', 'zlib' ] } diff --git a/tests/migration-test.c b/tests/migration-test.c index 8a1ccc2516..2dd4d4c5b4 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -1119,6 +1119,11 @@ static void test_multifd_tcp_none(void) test_multifd_tcp("none"); } =20 +static void test_multifd_tcp_zlib(void) +{ + test_multifd_tcp("zlib"); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -1174,6 +1179,7 @@ int main(int argc, char **argv) /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */ qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); qtest_add_func("/migration/multifd/tcp/none", test_multifd_tcp_none); + qtest_add_func("/migration/multifd/tcp/zlib", test_multifd_tcp_zlib); =20 ret =3D g_test_run(); =20 --=20 2.20.1 From nobody Sun May 5 06:58:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554292797287240.9416107683453; Wed, 3 Apr 2019 04:59:57 -0700 (PDT) Received: from localhost ([127.0.0.1]:52991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeYb-0004aK-8U for importer@patchew.org; Wed, 03 Apr 2019 07:59:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBeXF-0003qH-KA for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBeXE-0002cc-Gx for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36834) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBeXA-0002Jh-8i for qemu-devel@nongnu.org; Wed, 03 Apr 2019 07:58:25 -0400 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 BA904308FC23 for ; Wed, 3 Apr 2019 11:51:47 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-49.ams2.redhat.com [10.36.117.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7655608D3; Wed, 3 Apr 2019 11:51:45 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 3 Apr 2019 13:49:58 +0200 Message-Id: <20190403114958.3705-9-quintela@redhat.com> In-Reply-To: <20190403114958.3705-1-quintela@redhat.com> References: <20190403114958.3705-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 03 Apr 2019 11:51:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 8/8] multifd: rest of zlib compression (WIP) 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: Laurent Vivier , Thomas Huth , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is still a work in progress, but get everything sent as expected and it is faster than the code that is already there. Signed-off-by: Juan Quintela --- migration/ram.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 06b25ac66d..1b3b88d711 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1118,7 +1118,41 @@ static void *multifd_send_thread(void *opaque) uint64_t packet_num =3D p->packet_num; uint32_t flags =3D p->flags; =20 - p->next_packet_size =3D used * qemu_target_page_size(); + if (used) { + if (migrate_use_multifd_zlib()) { + struct iovec *iov =3D p->pages->iov; + z_stream *zs =3D &p->zs; + uint32_t out_size =3D 0; + int i; + + for (i =3D 0; i < used; i++ ) { + uint32_t available =3D p->zbuff_len - out_size; + int flush =3D Z_NO_FLUSH; + + if (i =3D=3D used - 1) { + flush =3D Z_SYNC_FLUSH; + } + + zs->avail_in =3D iov[i].iov_len; + zs->next_in =3D iov[i].iov_base; + + zs->avail_out =3D available; + zs->next_out =3D p->zbuff + out_size; + + ret =3D deflate(zs, flush); + if (ret !=3D Z_OK) { + printf("problem with deflate? %d\n", ret); + qemu_mutex_unlock(&p->mutex); + break; + } + out_size +=3D available - zs->avail_out; + } + p->next_packet_size =3D out_size; + } else { + p->next_packet_size =3D used * qemu_target_page_size(); + } + } + multifd_send_fill_packet(p); p->flags =3D 0; p->num_packets++; @@ -1136,8 +1170,13 @@ static void *multifd_send_thread(void *opaque) } =20 if (used) { - ret =3D qio_channel_writev_all(p->c, p->pages->iov, - used, &local_err); + if (migrate_use_multifd_zlib()) { + ret =3D qio_channel_write_all(p->c, (void *)p->zbuff, + p->next_packet_size, &local= _err); + } else { + ret =3D qio_channel_writev_all(p->c, p->pages->iov, + used, &local_err); + } if (ret !=3D 0) { break; } @@ -1384,8 +1423,52 @@ static void *multifd_recv_thread(void *opaque) qemu_mutex_unlock(&p->mutex); =20 if (used) { - ret =3D qio_channel_readv_all(p->c, p->pages->iov, - used, &local_err); + uint32_t in_size =3D p->next_packet_size; + uint32_t out_size =3D 0; + uint32_t expected_size =3D used * qemu_target_page_size(); + int i; + + if (migrate_use_multifd_zlib()) { + z_stream *zs =3D &p->zs; + + ret =3D qio_channel_read_all(p->c, (void *)p->zbuff, + in_size, &local_err); + + if (ret !=3D 0) { + break; + } + + zs->avail_in =3D in_size; + zs->next_in =3D p->zbuff; + + for (i =3D 0; i < used; i++ ) { + struct iovec *iov =3D &p->pages->iov[i]; + int flush =3D Z_NO_FLUSH; + + if (i =3D=3D used - 1) { + flush =3D Z_SYNC_FLUSH; + } + + zs->avail_out =3D iov->iov_len; + zs->next_out =3D iov->iov_base; + + ret =3D inflate(zs, flush); + if (ret !=3D Z_OK) { + printf("%d: problem with inflate? %d\n", p->id, re= t); + qemu_mutex_unlock(&p->mutex); + break; + } + out_size +=3D iov->iov_len; + } + if (out_size !=3D expected_size) { + printf("out size %d expected size %d\n", + out_size, expected_size); + break; + } + } else { + ret =3D qio_channel_readv_all(p->c, p->pages->iov, + used, &local_err); + } if (ret !=3D 0) { break; } --=20 2.20.1