From nobody Fri May 3 04:43:39 2024 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 154340520741975.74218024910351; Wed, 28 Nov 2018 03:40:07 -0800 (PST) Received: from localhost ([::1]:47264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRyCM-0007Oo-Cd for importer@patchew.org; Wed, 28 Nov 2018 06:40:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy6o-0002rd-GD for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRy6k-0002gx-AA for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55344) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRy6k-0002g3-2z for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 825F7307DABD for ; Wed, 28 Nov 2018 11:34:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AFB05DE89; Wed, 28 Nov 2018 11:34:06 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 28 Nov 2018 12:33:33 +0100 Message-Id: <20181128113337.7238-2-quintela@redhat.com> In-Reply-To: <20181128113337.7238-1-quintela@redhat.com> References: <20181128113337.7238-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 28 Nov 2018 11:34:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v10 1/5] 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" Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- tests/migration-test.c | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 06ca5068d8..d18e9b3709 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -584,6 +584,17 @@ static void deprecated_set_speed(QTestState *who, long= long value) migrate_check_parameter(who, "max-bandwidth", value); } =20 +static void deprecated_set_cache_size(QTestState *who, long long value) +{ + QDict *rsp; + + rsp =3D qtest_qmp(who, "{ 'execute': 'migrate-set-cache-size'," + "'arguments': { 'value': %lld } }", value); + g_assert(qdict_haskey(rsp, "return")); + qobject_unref(rsp); + migrate_check_parameter(who, "xbzrle-cache-size", value); +} + static void test_deprecated(void) { QTestState *from; @@ -592,6 +603,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); } @@ -781,6 +793,56 @@ static void test_precopy_unix(void) g_free(uri); } =20 +static void test_xbzrle(const char *uri) +{ + QTestState *from, *to; + + if (test_migrate_start(&from, &to, uri, 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(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"; @@ -832,6 +894,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.19.1 From nobody Fri May 3 04:43:39 2024 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 1543405072538764.0666329096595; Wed, 28 Nov 2018 03:37:52 -0800 (PST) Received: from localhost ([::1]:47254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRyAB-0004rB-BP for importer@patchew.org; Wed, 28 Nov 2018 06:37:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy6u-0002uy-QM for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRy6q-0002k3-LI for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55438) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRy6q-0002jZ-Dx for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:24 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCAA5308212A for ; Wed, 28 Nov 2018 11:34:23 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id D546C612AD; Wed, 28 Nov 2018 11:34:17 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 28 Nov 2018 12:33:34 +0100 Message-Id: <20181128113337.7238-3-quintela@redhat.com> In-Reply-To: <20181128113337.7238-1-quintela@redhat.com> References: <20181128113337.7238-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 28 Nov 2018 11:34:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v10 2/5] migration: Create 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" Content-Type: text/plain; charset="utf-8" It will be used to store the uri parameters. 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. This used to be x-socket-address with a single direction, now it is a list of addresses. Move SocketAddress_to_str here. I used to try to generalize the one in chardev/char-socket.c, but it is not worth it. Signed-off-by: Juan Quintela --- hmp.c | 31 +++++++++++++++++++++++++++++++ migration/migration.c | 24 ++++++++++++++++++++++++ migration/migration.h | 4 ++++ migration/socket.c | 11 +++++++++++ qapi/migration.json | 6 +++++- qapi/sockets.json | 13 +++++++++++++ 6 files changed, 88 insertions(+), 1 deletion(-) diff --git a/hmp.c b/hmp.c index 7828f93a39..2fd12a4a81 100644 --- a/hmp.c +++ b/hmp.c @@ -166,6 +166,26 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) qapi_free_MouseInfoList(mice_list); } =20 +static char *SocketAddress_to_str(SocketAddress *addr) +{ + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: + return g_strdup_printf("tcp:%s:%s", + addr->u.inet.host, + addr->u.inet.port); + break; + case SOCKET_ADDRESS_TYPE_UNIX: + return g_strdup_printf("unix:%s", + addr->u.q_unix.path); + break; + case SOCKET_ADDRESS_TYPE_FD: + return g_strdup_printf("fd:%s", addr->u.fd.str); + break; + default: + abort(); + } +} + void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; @@ -304,6 +324,17 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) g_free(str); visit_free(v); } + if (info->has_socket_address) { + SocketAddressList *addr; + + monitor_printf(mon, "socket address: [\n"); + + for (addr =3D info->socket_address; addr; addr =3D addr->next) { + char *s =3D SocketAddress_to_str(addr->value); + monitor_printf(mon, "\t%s\n", s); + } + monitor_printf(mon, "]\n"); + } qapi_free_MigrationInfo(info); qapi_free_MigrationCapabilityStatusList(caps); } diff --git a/migration/migration.c b/migration/migration.c index 49ffb9997a..22954dcabc 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" @@ -197,6 +199,11 @@ void migration_incoming_state_destroy(void) } =20 qemu_event_reset(&mis->main_thread_load_event); + + if (mis->socket_address) { + qapi_free_SocketAddressList(mis->socket_address); + mis->socket_address =3D NULL; + } } =20 static void migrate_generate_event(int new_state) @@ -312,6 +319,17 @@ void migration_incoming_enable_colo(void) migration_colo_enabled =3D true; } =20 +void migrate_add_address(SocketAddress *address) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + SocketAddressList *addrs; + + addrs =3D g_new0(SocketAddressList, 1); + addrs->next =3D mis->socket_address; + mis->socket_address =3D addrs; + addrs->value =3D QAPI_CLONE(SocketAddress, address); +} + void qemu_start_incoming_migration(const char *uri, Error **errp) { const char *p; @@ -960,6 +978,12 @@ static void fill_destination_migration_info(MigrationI= nfo *info) { MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + if (mis->socket_address) { + info->has_socket_address =3D true; + info->socket_address =3D + QAPI_CLONE(SocketAddressList, mis->socket_address); + } + switch (mis->state) { case MIGRATION_STATUS_NONE: return; diff --git a/migration/migration.h b/migration/migration.h index e413d4d8b6..324970433c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -80,6 +80,9 @@ struct MigrationIncomingState { bool postcopy_recover_triggered; QemuSemaphore postcopy_pause_sem_dst; QemuSemaphore postcopy_pause_sem_fault; + + /* List of listening socket addresses */ + SocketAddressList *socket_address; }; =20 MigrationIncomingState *migration_incoming_get_current(void); @@ -292,6 +295,7 @@ void migrate_send_rp_resume_ack(MigrationIncomingState = *mis, uint32_t value); =20 void dirty_bitmap_mig_before_vm_start(void); void init_dirty_bitmap_incoming_migration(void); +void migrate_add_address(SocketAddress *address); =20 #define qemu_ram_foreach_block \ #warning "Use qemu_ram_foreach_block_migratable in migration code" diff --git a/migration/socket.c b/migration/socket.c index f4c8174400..239527fb1f 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" @@ -177,6 +178,7 @@ static void socket_start_incoming_migration(SocketAddre= ss *saddr, Error **errp) { QIONetListener *listener =3D qio_net_listener_new(); + size_t i; =20 qio_net_listener_set_name(listener, "migration-socket-listener"); =20 @@ -189,6 +191,15 @@ static void socket_start_incoming_migration(SocketAddr= ess *saddr, socket_accept_incoming_migration, NULL, NULL, g_main_context_get_thread_defaul= t()); + + for (i =3D 0; i < listener->nsioc; i++) { + SocketAddress *address =3D + qio_channel_socket_get_local_address(listener->sioc[i], errp); + if (!address) { + return; + } + migrate_add_address(address); + } } =20 void tcp_start_incoming_migration(const char *host_port, Error **errp) diff --git a/qapi/migration.json b/qapi/migration.json index 38d4c41d88..631949796d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -6,6 +6,7 @@ ## =20 { 'include': 'common.json' } +{ 'include': 'sockets.json' } =20 ## # @MigrationStats: @@ -196,6 +197,8 @@ # @compression: migration compression statistics, only returned if compres= sion # feature is on and status is 'active' or 'completed' (Since 3.1) # +# @socket-address: Only used for tcp, to know what the real port is (Since= 3.1) +# # Since: 0.14.0 ## { 'struct': 'MigrationInfo', @@ -210,7 +213,8 @@ '*error-desc': 'str', '*postcopy-blocktime' : 'uint32', '*postcopy-vcpu-blocktime': ['uint32'], - '*compression': 'CompressionStats'} } + '*compression': 'CompressionStats', + '*socket-address': ['SocketAddress'] } } =20 ## # @query-migrate: diff --git a/qapi/sockets.json b/qapi/sockets.json index fc81d8d5e8..d7f77984af 100644 --- a/qapi/sockets.json +++ b/qapi/sockets.json @@ -152,3 +152,16 @@ 'unix': 'UnixSocketAddress', 'vsock': 'VsockSocketAddress', 'fd': 'String' } } + +## +# @DummyStruct: +# +# Both block-core and migration needs SocketAddressList +# I am open to comments about how to share it +# +# @dummy-list: A dummy list +# +# Since: 3.1 +## +{ 'struct': 'DummyStruct', + 'data': { 'dummy-list': ['SocketAddress'] } } --=20 2.19.1 From nobody Fri May 3 04:43:39 2024 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 15434050200314.324929985906238; Wed, 28 Nov 2018 03:37:00 -0800 (PST) Received: from localhost ([::1]:47251 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy9D-00048L-HF for importer@patchew.org; Wed, 28 Nov 2018 06:36:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy6t-0002sn-Bt for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRy6s-0002km-Cj for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44300) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRy6s-0002kS-5e for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:26 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0DF780E7B for ; Wed, 28 Nov 2018 11:34:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D6746837A; Wed, 28 Nov 2018 11:34:24 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 28 Nov 2018 12:33:35 +0100 Message-Id: <20181128113337.7238-4-quintela@redhat.com> In-Reply-To: <20181128113337.7238-1-quintela@redhat.com> References: <20181128113337.7238-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 28 Nov 2018 11:34:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v10 3/5] 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" 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 Signed-off-by: Juan Quintela --- tests/migration-test.c | 108 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index d18e9b3709..4557704d17 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -20,6 +20,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 #include "migration/migration-test.h" =20 @@ -332,15 +335,67 @@ static void cleanup(const char *filename) g_free(path); } =20 +static char *SocketAddress_to_str(SocketAddress *addr) +{ + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: + return g_strdup_printf("tcp:%s:%s", + addr->u.inet.host, + addr->u.inet.port); + break; + case SOCKET_ADDRESS_TYPE_UNIX: + return g_strdup_printf("unix:%s", + addr->u.q_unix.path); + break; + case SOCKET_ADDRESS_TYPE_FD: + return g_strdup_printf("fd:%s", addr->u.fd.str); + break; + default: + abort(); + } +} + +static char *migrate_get_socket_address(QTestState *who, const char *param= eter) +{ + QDict *rsp; + char *result; + Error *local_err =3D NULL; + SocketAddressList *addrs; + Visitor *iv =3D NULL; + QObject *object; + + rsp =3D migrate_query(who); + object =3D qdict_get(rsp, parameter); + + iv =3D qobject_input_visitor_new(object); + visit_type_SocketAddressList(iv, NULL, &addrs, &local_err); + + /* we are only using a single address */ + result =3D g_strdup_printf("%s", SocketAddress_to_str(addrs->value)); + + qapi_free_SocketAddressList(addrs); + qobject_unref(rsp); + return result; +} + +static long long migrate_get_parameter(QTestState *who, const char *parame= ter) +{ + QDict *rsp; + long long result; + + rsp =3D wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + result =3D qdict_get_int(rsp, parameter); + qobject_unref(rsp); + return result; +} + static void migrate_check_parameter(QTestState *who, const char *parameter, long long value) { - QDict *rsp_return; + long long result; =20 - rsp_return =3D wait_command(who, - "{ 'execute': 'query-migrate-parameters' }"); - g_assert_cmpint(qdict_get_int(rsp_return, parameter), =3D=3D, value); - qobject_unref(rsp_return); + result =3D migrate_get_parameter(who, parameter); + g_assert_cmpint(result, =3D=3D, value); } =20 static void migrate_set_parameter(QTestState *who, const char *parameter, @@ -843,6 +898,48 @@ static void test_xbzrle_unix(void) g_free(uri); } =20 +static void test_precopy_tcp(void) +{ + char *uri; + QTestState *from, *to; + + if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", 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(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, "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"; @@ -894,6 +991,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.19.1 From nobody Fri May 3 04:43:39 2024 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 1543405189466833.5888259938138; Wed, 28 Nov 2018 03:39:49 -0800 (PST) Received: from localhost ([::1]:47263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRyC4-00079w-74 for importer@patchew.org; Wed, 28 Nov 2018 06:39:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy6y-0002yj-Te for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRy6u-0002lw-FF for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRy6u-0002le-AV for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:28 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3D39CD162 for ; Wed, 28 Nov 2018 11:34:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 000BA5DE89; Wed, 28 Nov 2018 11:34:25 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 28 Nov 2018 12:33:36 +0100 Message-Id: <20181128113337.7238-5-quintela@redhat.com> In-Reply-To: <20181128113337.7238-1-quintela@redhat.com> References: <20181128113337.7238-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 28 Nov 2018 11:34:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v10 4/5] 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: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Juan Quintela --- tests/migration-test.c | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 4557704d17..010fe8b74d 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -940,6 +940,55 @@ 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)) { + 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(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, "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"; @@ -993,6 +1042,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.19.1 From nobody Fri May 3 04:43:39 2024 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 1543405044623494.8868204367816; Wed, 28 Nov 2018 03:37:24 -0800 (PST) Received: from localhost ([::1]:47253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy9j-0004Xw-F8 for importer@patchew.org; Wed, 28 Nov 2018 06:37:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRy6y-0002yk-Tn for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRy6w-0002nC-G1 for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45866) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRy6w-0002mc-0T for qemu-devel@nongnu.org; Wed, 28 Nov 2018 06:34:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7373DBF9F5 for ; Wed, 28 Nov 2018 11:34:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.118.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 100285DE89; Wed, 28 Nov 2018 11:34:27 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 28 Nov 2018 12:33:37 +0100 Message-Id: <20181128113337.7238-6-quintela@redhat.com> In-Reply-To: <20181128113337.7238-1-quintela@redhat.com> References: <20181128113337.7238-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 28 Nov 2018 11:34:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v10 5/5] [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" 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 | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index 010fe8b74d..3841ac9c87 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -989,6 +989,57 @@ static void test_multifd_tcp(void) test_migrate_end(from, to, true); } =20 +static void test_compress(const char *uri) +{ + QTestState *from, *to; + + if (test_migrate_start(&from, &to, uri, 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(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"; @@ -1043,6 +1094,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.19.1