From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521045815117642.3231909177413; Wed, 14 Mar 2018 09:43:35 -0700 (PDT) Received: from localhost ([::1]:47312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9V0-0003Sw-B9 for importer@patchew.org; Wed, 14 Mar 2018 12:43:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QT-0007aB-HT for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QQ-0004L0-8o for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35946 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QQ-0004K3-3H for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04C88406E968 for ; Wed, 14 Mar 2018 16:38:46 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB4E32166BAE; Wed, 14 Mar 2018 16:38:44 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:31 +0100 Message-Id: <20180314163838.7158-2-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:46 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 1/8] qemu-sockets: Export SocketAddress_to_str 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" Migration code needs that function in hmp.c (so we need to export it), and it needs it on tests/migration-test.c, so we need to move it to a place where it is compiled into the test framework. Signed-off-by: Juan Quintela --- chardev/char-socket.c | 29 ----------------------------- include/qemu/sockets.h | 3 +++ util/qemu-sockets.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index a220803c01..dc27ecce81 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -373,35 +373,6 @@ static void tcp_chr_free_connection(Chardev *chr) s->connected =3D 0; } =20 -static char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, - bool is_listen, bool is_telnet) -{ - switch (addr->type) { - case SOCKET_ADDRESS_TYPE_INET: - return g_strdup_printf("%s%s:%s:%s%s", prefix, - is_telnet ? "telnet" : "tcp", - addr->u.inet.host, - addr->u.inet.port, - is_listen ? ",server" : ""); - break; - case SOCKET_ADDRESS_TYPE_UNIX: - return g_strdup_printf("%sunix:%s%s", prefix, - addr->u.q_unix.path, - is_listen ? ",server" : ""); - break; - case SOCKET_ADDRESS_TYPE_FD: - return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.str, - is_listen ? ",server" : ""); - break; - case SOCKET_ADDRESS_TYPE_VSOCK: - return g_strdup_printf("%svsock:%s:%s", prefix, - addr->u.vsock.cid, - addr->u.vsock.port); - default: - abort(); - } -} - static void update_disconnected_filename(SocketChardev *s) { Chardev *chr =3D CHARDEV(s); diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index e88d4c37ab..a8bc2d7cfb 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -109,4 +109,7 @@ SocketAddress *socket_remote_address(int fd, Error **er= rp); */ SocketAddress *socket_address_flatten(SocketAddressLegacy *addr); =20 +char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, + bool is_listen, bool is_telnet); + #endif /* QEMU_SOCKETS_H */ diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 7f13e8a338..25965c6ee1 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1301,3 +1301,32 @@ SocketAddress *socket_address_flatten(SocketAddressL= egacy *addr_legacy) =20 return addr; } + +char *SocketAddress_to_str(const char *prefix, SocketAddress *addr, + bool is_listen, bool is_telnet) +{ + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: + return g_strdup_printf("%s%s:%s:%s%s", prefix, + is_telnet ? "telnet" : "tcp", + addr->u.inet.host, + addr->u.inet.port, + is_listen ? ",server" : ""); + break; + case SOCKET_ADDRESS_TYPE_UNIX: + return g_strdup_printf("%sunix:%s%s", prefix, + addr->u.q_unix.path, + is_listen ? ",server" : ""); + break; + case SOCKET_ADDRESS_TYPE_FD: + return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.str, + is_listen ? ",server" : ""); + break; + case SOCKET_ADDRESS_TYPE_VSOCK: + return g_strdup_printf("%svsock:%s:%s", prefix, + addr->u.vsock.cid, + addr->u.vsock.port); + default: + abort(); + } +} --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521045662680179.69644250002602; Wed, 14 Mar 2018 09:41:02 -0700 (PDT) Received: from localhost ([::1]:47300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9SU-0000gM-P2 for importer@patchew.org; Wed, 14 Mar 2018 12:40:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QT-0007aA-HR for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QQ-0004Ki-7t for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49288 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QQ-0004K0-2t for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54B6F8182D2A for ; Wed, 14 Mar 2018 16:38:47 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47F41215CDBE; Wed, 14 Mar 2018 16:38:46 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:32 +0100 Message-Id: <20180314163838.7158-3-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 14 Mar 2018 16:38:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 14 Mar 2018 16:38:47 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 2/8] tests: Add migration precopy 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: 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" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- tests/migration-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 422bf1afdf..834cdf50f2 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -524,7 +524,7 @@ static void test_deprecated(void) qtest_quit(from); } =20 -static void test_migrate(void) +static void test_postcopy(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -595,6 +595,45 @@ static void test_baddest(void) test_migrate_end(from, to, false); } =20 +static void test_precopy_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + QTestState *from, *to; + + test_migrate_start(&from, &to, uri, false); + + /* 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(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300 ms should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + 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); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -614,9 +653,10 @@ int main(int argc, char **argv) =20 module_call_init(MODULE_INIT_QOM); =20 - qtest_add_func("/migration/postcopy/unix", test_migrate); + qtest_add_func("/migration/postcopy/unix", test_postcopy); qtest_add_func("/migration/deprecated", test_deprecated); qtest_add_func("/migration/bad_dest", test_baddest); + qtest_add_func("/migration/precopy/unix", test_precopy_unix); =20 ret =3D g_test_run(); =20 --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521045654020453.1226611494294; Wed, 14 Mar 2018 09:40:54 -0700 (PDT) Received: from localhost ([::1]:47298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9SO-0000a4-Cw for importer@patchew.org; Wed, 14 Mar 2018 12:40:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QT-0007aD-IH for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QQ-0004Kp-8a for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35947 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QQ-0004K1-3E for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5DE9406E946 for ; Wed, 14 Mar 2018 16:38:48 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 980AE215CDBE; Wed, 14 Mar 2018 16:38:47 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:33 +0100 Message-Id: <20180314163838.7158-4-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:48 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 3/8] tests: Add migration xbzrle 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: 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" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/migration-test.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 64 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 834cdf50f2..fd885ba909 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -512,6 +512,20 @@ static void deprecated_set_speed(QTestState *who, cons= t char *value) migrate_check_parameter(who, "max-bandwidth", value); } =20 +static void deprecated_set_cache_size(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate-set-cache-size'," + "'arguments': { 'value': %s } }", value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); + migrate_check_parameter(who, "xbzrle-cache-size", value); +} + static void test_deprecated(void) { QTestState *from; @@ -520,6 +534,7 @@ static void test_deprecated(void) =20 deprecated_set_downtime(from, 0.12345); deprecated_set_speed(from, "12345"); + deprecated_set_cache_size(from, "4096"); =20 qtest_quit(from); } @@ -634,6 +649,54 @@ static void test_precopy_unix(void) g_free(uri); } =20 +static void test_xbzrle(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri, false); + + /* 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(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + migrate_set_parameter(from, "xbzrle-cache-size", "33554432"); + + migrate_set_capability(from, "xbzrle", "true"); + migrate_set_capability(to, "xbzrle", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + 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); +} + +static void test_xbzrle_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_xbzrle(uri); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -657,6 +720,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/deprecated", test_deprecated); qtest_add_func("/migration/bad_dest", test_baddest); qtest_add_func("/migration/precopy/unix", test_precopy_unix); + qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); =20 ret =3D g_test_run(); =20 --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15210456577831015.583336688302; Wed, 14 Mar 2018 09:40:57 -0700 (PDT) Received: from localhost ([::1]:47299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9SS-0000eX-Ks for importer@patchew.org; Wed, 14 Mar 2018 12:40:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QT-0007aC-Ha for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QQ-0004LM-HL for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45792 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QQ-0004KX-D3 for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 020134068036 for ; Wed, 14 Mar 2018 16:38:50 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8E38215CDAF; Wed, 14 Mar 2018 16:38:48 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:34 +0100 Message-Id: <20180314163838.7158-5-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 14 Mar 2018 16:38:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 14 Mar 2018 16:38:50 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 4/8] migration: Create x-socket-address 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: 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" It will be used to store the uri parameter. We want this only for tcp, so we don't set it for other uris. We need it to know what port is migration running. Signed-off-by: Juan Quintela -- This used to be uri parameter, but it has so many troubles to reproduce that it don't just make sense. This used to be a port parameter. I was asked to move to SocketAddress, done. I also merged the setting of the migration tcp port in this one because now I need to free the address, and this makes it easier. --- hmp.c | 6 ++++++ migration/migration.c | 18 ++++++++++++++++++ migration/migration.h | 2 ++ migration/socket.c | 27 ++++++++++++++++++++++----- qapi/migration.json | 14 ++++++++++++-- 5 files changed, 60 insertions(+), 7 deletions(-) diff --git a/hmp.c b/hmp.c index ba9e299ee2..eee84cfd5f 100644 --- a/hmp.c +++ b/hmp.c @@ -355,6 +355,12 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); + if (params->has_x_socket_address) { + monitor_printf(mon, "%s: %s\n", + MigrationParameter_str(MIGRATION_PARAMETER_X_SOCKET_ADDRES= S), + SocketAddress_to_str("", params->x_socket_address, + false, false)); + } } =20 qapi_free_MigrationParameters(params); diff --git a/migration/migration.c b/migration/migration.c index 6a4780ef6f..3b811c213a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -31,6 +31,8 @@ #include "migration/vmstate.h" #include "block/block.h" #include "qapi/error.h" +#include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-events-migration.h" #include "qapi/qmp/qerror.h" @@ -268,6 +270,14 @@ int migrate_send_rp_req_pages(MigrationIncomingState *= mis, const char *rbname, return migrate_send_rp_message(mis, msg_type, msglen, bufc); } =20 +void migrate_set_address(SocketAddress *address) +{ + MigrationState *s =3D migrate_get_current(); + + s->parameters.has_x_socket_address =3D true; + s->parameters.x_socket_address =3D address; +} + void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; @@ -545,6 +555,11 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) params->x_multifd_page_count =3D s->parameters.x_multifd_page_count; params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; + if (s->parameters.x_socket_address) { + params->has_x_socket_address =3D true; + params->x_socket_address =3D QAPI_CLONE(SocketAddress, + s->parameters.x_socket_addre= ss); + } =20 return params; } @@ -2542,6 +2557,9 @@ static void migration_instance_finalize(Object *obj) qemu_mutex_destroy(&ms->error_mutex); g_free(params->tls_hostname); g_free(params->tls_creds); + if (params->x_socket_address) { + qapi_free_SocketAddress(params->x_socket_address); + } qemu_sem_destroy(&ms->pause_sem); error_free(ms->error); } diff --git a/migration/migration.h b/migration/migration.h index 08c5d2ded1..36b9c70fd6 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -234,4 +234,6 @@ void migrate_send_rp_pong(MigrationIncomingState *mis, int migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbn= ame, ram_addr_t start, size_t len); =20 +void migrate_set_address(SocketAddress *address); + #endif diff --git a/migration/socket.c b/migration/socket.c index 8a93fb1af5..52db0c0c09 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -15,6 +15,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/cutils.h" =20 #include "qemu-common.h" #include "qemu/error-report.h" @@ -161,17 +162,24 @@ out: } =20 =20 -static void socket_start_incoming_migration(SocketAddress *saddr, - Error **errp) +static SocketAddress *socket_start_incoming_migration(SocketAddress *saddr, + Error **errp) { QIOChannelSocket *listen_ioc =3D qio_channel_socket_new(); + SocketAddress *address; =20 qio_channel_set_name(QIO_CHANNEL(listen_ioc), "migration-socket-listener"); =20 if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) { object_unref(OBJECT(listen_ioc)); - return; + return NULL; + } + + address =3D qio_channel_socket_get_local_address(listen_ioc, errp); + if (address < 0) { + object_unref(OBJECT(listen_ioc)); + return NULL; } =20 qio_channel_add_watch(QIO_CHANNEL(listen_ioc), @@ -179,14 +187,20 @@ static void socket_start_incoming_migration(SocketAdd= ress *saddr, socket_accept_incoming_migration, listen_ioc, (GDestroyNotify)object_unref); + return address; } =20 void tcp_start_incoming_migration(const char *host_port, Error **errp) { Error *err =3D NULL; SocketAddress *saddr =3D tcp_build_address(host_port, &err); + if (!err) { - socket_start_incoming_migration(saddr, &err); + SocketAddress *address =3D socket_start_incoming_migration(saddr, = &err); + + if (address) { + migrate_set_address(address); + } } qapi_free_SocketAddress(saddr); error_propagate(errp, err); @@ -195,6 +209,9 @@ void tcp_start_incoming_migration(const char *host_port= , Error **errp) void unix_start_incoming_migration(const char *path, Error **errp) { SocketAddress *saddr =3D unix_build_address(path); - socket_start_incoming_migration(saddr, errp); + SocketAddress *address; + + address =3D socket_start_incoming_migration(saddr, errp); + qapi_free_SocketAddress(address); qapi_free_SocketAddress(saddr); } diff --git a/qapi/migration.json b/qapi/migration.json index 7f465a1902..a881321de2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -6,6 +6,7 @@ ## =20 { 'include': 'common.json' } +{ 'include': 'sockets.json' } =20 ## # @MigrationStats: @@ -490,6 +491,9 @@ # and a power of 2 # (Since 2.11) # +# @x-socket-address: Only used for tcp, to know what the real port is +# (Since 2.12) +# # Since: 2.4 ## { 'enum': 'MigrationParameter', @@ -498,7 +502,7 @@ 'tls-creds', 'tls-hostname', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', 'x-multifd-channels', 'x-multifd-page-count', - 'xbzrle-cache-size' ] } + 'xbzrle-cache-size', 'x-socket-address' ] } =20 ## # @MigrateSetParameters: @@ -566,6 +570,7 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# # Since: 2.4 ## # TODO either fuse back into MigrationParameters, or make @@ -667,6 +672,10 @@ # needs to be a multiple of the target page size # and a power of 2 # (Since 2.11) +# +# @x-socket-address: Only used for tcp, to know what the real port is +# (Since 2.12) +# # Since: 2.4 ## { 'struct': 'MigrationParameters', @@ -683,7 +692,8 @@ '*block-incremental': 'bool' , '*x-multifd-channels': 'uint8', '*x-multifd-page-count': 'uint32', - '*xbzrle-cache-size': 'size' } } + '*xbzrle-cache-size': 'size', + '*x-socket-address': 'SocketAddress'} } =20 ## # @query-migrate-parameters: --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521045814202308.426557359697; Wed, 14 Mar 2018 09:43:34 -0700 (PDT) Received: from localhost ([::1]:47309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9Uu-0003L5-Vm for importer@patchew.org; Wed, 14 Mar 2018 12:43:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QT-0007a9-Gj for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QR-0004MO-Th for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35956 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QR-0004M2-OV for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 538C5406E968 for ; Wed, 14 Mar 2018 16:38:51 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 459872166BAE; Wed, 14 Mar 2018 16:38:50 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:35 +0100 Message-Id: <20180314163838.7158-6-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:51 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 5/8] tests: Migration ppc now inlines its program 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" No need to write it to a file. Just need a proper firmware O:-) Signed-off-by: Juan Quintela CC: Laurent Vivier --- tests/migration-test.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index fd885ba909..4a94d3d598 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -19,9 +19,6 @@ #include "qemu/sockets.h" #include "chardev/char.h" #include "sysemu/sysemu.h" -#include "hw/nvram/chrp_nvram.h" - -#define MIN_NVRAM_SIZE 8192 /* from spapr_nvram.c */ =20 const unsigned start_address =3D 1024 * 1024; const unsigned end_address =3D 100 * 1024 * 1024; @@ -90,36 +87,6 @@ static void init_bootfile_x86(const char *bootpath) fclose(bootfile); } =20 -static void init_bootfile_ppc(const char *bootpath) -{ - FILE *bootfile; - char buf[MIN_NVRAM_SIZE]; - ChrpNvramPartHdr *header =3D (ChrpNvramPartHdr *)buf; - - memset(buf, 0, MIN_NVRAM_SIZE); - - /* Create a "common" partition in nvram to store boot-command property= */ - - header->signature =3D CHRP_NVPART_SYSTEM; - memcpy(header->name, "common", 6); - chrp_nvram_finish_partition(header, MIN_NVRAM_SIZE); - - /* FW_MAX_SIZE is 4MB, but slof.bin is only 900KB, - * so let's modify memory between 1MB and 100MB - * to do like PC bootsector - */ - - sprintf(buf + 16, - "boot-command=3Dhex .\" _\" begin %x %x do i c@ 1 + i c! 1000 = +loop " - ".\" B\" 0 until", end_address, start_address); - - /* Write partition to the NVRAM file */ - - bootfile =3D fopen(bootpath, "wb"); - g_assert_cmpint(fwrite(buf, MIN_NVRAM_SIZE, 1, bootfile), =3D=3D, 1); - fclose(bootfile); -} - /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -410,12 +377,14 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, if (access("/sys/module/kvm_hv", F_OK)) { accel =3D "tcg"; } - init_bootfile_ppc(bootpath); cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 256M" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" - " -drive file=3D%s,if=3Dpflash,format=3D= raw", - accel, tmpfs, bootpath); + " -prom-env '" + "boot-command=3Dhex .\" _\" begin %x %x " + "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " + "until'", accel, tmpfs, end_address, + start_address); cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 256M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 152104581751489.99179656207161; Wed, 14 Mar 2018 09:43:37 -0700 (PDT) Received: from localhost ([::1]:47310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9Uv-0003M4-Va for importer@patchew.org; Wed, 14 Mar 2018 12:43:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QU-0007ar-Kb for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QT-0004NS-8W for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35962 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QT-0004My-3A for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A156B406E946 for ; Wed, 14 Mar 2018 16:38:52 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92C35215CDBE; Wed, 14 Mar 2018 16:38:51 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:36 +0100 Message-Id: <20180314163838.7158-7-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 6/8] tests: Add basic migration precopy tcp 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: 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" Not sharing code from precopy/unix because we have to read back the tcp parameter. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- tests/migration-test.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 4a94d3d598..8f367ea1d7 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -19,6 +19,9 @@ #include "qemu/sockets.h" #include "chardev/char.h" #include "sysemu/sysemu.h" +#include "qapi/qapi-visit-sockets.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/qobject-output-visitor.h" =20 const unsigned start_address =3D 1024 * 1024; const unsigned end_address =3D 100 * 1024 * 1024; @@ -277,8 +280,28 @@ static void cleanup(const char *filename) g_free(path); } =20 -static void migrate_check_parameter(QTestState *who, const char *parameter, - const char *value) +static char *migrate_get_socket_address(QTestState *who, const char *param= eter) +{ + QDict *rsp, *rsp_return; + char *result; + Error *local_err =3D NULL; + SocketAddress *saddr =3D NULL; + Visitor *iv =3D NULL; + QObject *object; + + rsp =3D wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + rsp_return =3D qdict_get_qdict(rsp, "return"); + object =3D qdict_get(rsp_return, parameter); + + iv =3D qobject_input_visitor_new(object); + visit_type_SocketAddress(iv, NULL, &saddr, &local_err); + result =3D g_strdup_printf("%s", + SocketAddress_to_str("", saddr, false, false)= ); + QDECREF(rsp); + return result; +} + +static char *migrate_get_parameter(QTestState *who, const char *parameter) { QDict *rsp, *rsp_return; char *result; @@ -287,9 +310,18 @@ static void migrate_check_parameter(QTestState *who, c= onst char *parameter, rsp_return =3D qdict_get_qdict(rsp, "return"); result =3D g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, parameter, -1)= ); + QDECREF(rsp); + return result; +} + +static void migrate_check_parameter(QTestState *who, const char *parameter, + const char *value) +{ + char *result; + + result =3D migrate_get_parameter(who, parameter); g_assert_cmpstr(result, =3D=3D, value); g_free(result); - QDECREF(rsp); } =20 static void migrate_set_parameter(QTestState *who, const char *parameter, @@ -666,6 +698,46 @@ static void test_xbzrle_unix(void) g_free(uri); } =20 +static void test_precopy_tcp(void) +{ + char *uri; + QTestState *from, *to; + + test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false); + + /* 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(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + uri =3D migrate_get_socket_address(to, "x-socket-address"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + 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); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -689,6 +761,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/deprecated", test_deprecated); qtest_add_func("/migration/bad_dest", test_baddest); qtest_add_func("/migration/precopy/unix", test_precopy_unix); + qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); =20 ret =3D g_test_run(); --=20 2.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521045814153866.1959059040693; Wed, 14 Mar 2018 09:43:34 -0700 (PDT) Received: from localhost ([::1]:47311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9Uz-0003Of-1y for importer@patchew.org; Wed, 14 Mar 2018 12:43:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QV-0007b2-Fb for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QU-0004Ov-HE for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35964 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QU-0004OY-Cw for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFC82406E946 for ; Wed, 14 Mar 2018 16:38:53 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4192215CDBE; Wed, 14 Mar 2018 16:38:52 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:37 +0100 Message-Id: <20180314163838.7158-8-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:53 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 7/8] migration: Add 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: 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 set the x-multifd-page-count and x-multifd-channels. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++= ++ 1 file changed, 48 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 8f367ea1d7..eba40812fc 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -738,6 +738,53 @@ static void test_precopy_tcp(void) g_free(uri); } =20 +static void test_multifd_tcp(void) +{ + char *uri; + QTestState *from, *to; + + test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false); + + /* 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(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + migrate_set_parameter(from, "x-multifd-channels", "4"); + migrate_set_parameter(to, "x-multifd-channels", "4"); + + migrate_set_parameter(from, "x-multifd-page-count", "64"); + migrate_set_parameter(to, "x-multifd-page-count", "64"); + + migrate_set_capability(from, "x-multifd", "true"); + migrate_set_capability(to, "x-multifd", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + uri =3D migrate_get_socket_address(to, "x-socket-address"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms it should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + 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"; @@ -763,6 +810,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/unix", test_precopy_unix); qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); 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.14.3 From nobody Sat Oct 25 11:05:04 2025 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15210459579356.217953757604391; Wed, 14 Mar 2018 09:45:57 -0700 (PDT) Received: from localhost ([::1]:47331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9XJ-00066K-3B for importer@patchew.org; Wed, 14 Mar 2018 12:45:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9QW-0007bA-Qy for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9QV-0004Q7-V6 for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:56 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35966 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew9QV-0004Ph-Px for qemu-devel@nongnu.org; Wed, 14 Mar 2018 12:38:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4ADCE406E946 for ; Wed, 14 Mar 2018 16:38:55 +0000 (UTC) Received: from secure.mitica (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DDA22166BAE; Wed, 14 Mar 2018 16:38:54 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 14 Mar 2018 17:38:38 +0100 Message-Id: <20180314163838.7158-9-quintela@redhat.com> In-Reply-To: <20180314163838.7158-1-quintela@redhat.com> References: <20180314163838.7158-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 14 Mar 2018 16:38:55 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 8/8] [RFH] tests: Add migration compress threads tests 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" Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness. For some reason, compression is not working at the moment, test is disabled until I found why. Signed-off-by: Juan Quintela --- tests/migration-test.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 52 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index eba40812fc..38c6d281c7 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -785,6 +785,55 @@ static void test_multifd_tcp(void) test_migrate_end(from, to, true); } =20 +static void test_compress(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri, false); + + /* 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(from, "downtime-limit", "1"); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + migrate_set_parameter(from, "compress-threads", "4"); + migrate_set_parameter(to, "decompress-threads", "3"); + + migrate_set_capability(from, "compress", "true"); + migrate_set_capability(to, "compress", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms it should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + 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); +} + +static void test_compress_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_compress(uri); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -811,6 +860,9 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); qtest_add_func("/migration/multifd/tcp", test_multifd_tcp); + if (0) { + qtest_add_func("/migration/compress/unix", test_compress_unix); + } =20 ret =3D g_test_run(); =20 --=20 2.14.3