From nobody Sun Nov 9 23:46:47 2025 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 15524791625301018.0852733428285; Wed, 13 Mar 2019 05:12:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:43143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42kN-0003j7-DL for importer@patchew.org; Wed, 13 Mar 2019 08:12:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Xb-0001aa-Fq for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42Xa-0004gW-1Z for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47190) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42XZ-0004fr-Pf for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 127F2307D843 for ; Wed, 13 Mar 2019 11:52:56 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F06C1001E69; Wed, 13 Mar 2019 11:52:53 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:12 +0100 Message-Id: <20190313115121.7611-2-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 13 Mar 2019 11:52:56 +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] [PULL 01/10] multifd: Only send pages when packet are not empty 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We send packages without pages sometimes for sysnchronizanion. The iov functions do the right thing, but we will be changing this code in future patches. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/ram.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 35bd6213e9..3034f862c1 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1088,9 +1088,12 @@ static void *multifd_send_thread(void *opaque) break; } =20 - ret =3D qio_channel_writev_all(p->c, p->pages->iov, used, &loc= al_err); - if (ret !=3D 0) { - break; + if (used) { + ret =3D qio_channel_writev_all(p->c, p->pages->iov, + used, &local_err); + if (ret !=3D 0) { + break; + } } =20 qemu_mutex_lock(&p->mutex); @@ -1317,9 +1320,12 @@ static void *multifd_recv_thread(void *opaque) p->num_pages +=3D used; qemu_mutex_unlock(&p->mutex); =20 - ret =3D qio_channel_readv_all(p->c, p->pages->iov, used, &local_er= r); - if (ret !=3D 0) { - break; + if (used) { + ret =3D qio_channel_readv_all(p->c, p->pages->iov, + used, &local_err); + if (ret !=3D 0) { + break; + } } =20 if (flags & MULTIFD_FLAG_SYNC) { --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552479209684942.319139353562; Wed, 13 Mar 2019 05:13:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:43245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42lC-0004Sa-Ft for importer@patchew.org; Wed, 13 Mar 2019 08:13:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42ad-000435-Ia for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42aX-0006Rl-UV for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42aX-0006RU-MV for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5892C308623F for ; Wed, 13 Mar 2019 11:52:58 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64C711001E70; Wed, 13 Mar 2019 11:52:56 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:13 +0100 Message-Id: <20190313115121.7611-3-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 13 Mar 2019 11:52:58 +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] [PULL 02/10] multifd: Rename "size" member to pages_alloc 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It really indicates what is the number of allocated pages for one packet. Once there rename "used" to "pages_used". Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/ram.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 3034f862c1..dc73829e25 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -594,8 +594,9 @@ typedef struct { uint32_t magic; uint32_t version; uint32_t flags; - uint32_t size; - uint32_t used; + /* maximum number of allocated pages */ + uint32_t pages_alloc; + uint32_t pages_used; uint64_t packet_num; char ramblock[256]; uint64_t offset[]; @@ -781,8 +782,8 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) packet->magic =3D cpu_to_be32(MULTIFD_MAGIC); packet->version =3D cpu_to_be32(MULTIFD_VERSION); packet->flags =3D cpu_to_be32(p->flags); - packet->size =3D cpu_to_be32(migrate_multifd_page_count()); - packet->used =3D cpu_to_be32(p->pages->used); + packet->pages_alloc =3D cpu_to_be32(migrate_multifd_page_count()); + packet->pages_used =3D cpu_to_be32(p->pages->used); packet->packet_num =3D cpu_to_be64(p->packet_num); =20 if (p->pages->block) { @@ -818,19 +819,19 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) =20 p->flags =3D be32_to_cpu(packet->flags); =20 - packet->size =3D be32_to_cpu(packet->size); - if (packet->size > migrate_multifd_page_count()) { + packet->pages_alloc =3D be32_to_cpu(packet->pages_alloc); + if (packet->pages_alloc > migrate_multifd_page_count()) { error_setg(errp, "multifd: received packet " "with size %d and expected maximum size %d", - packet->size, migrate_multifd_page_count()) ; + packet->pages_alloc, migrate_multifd_page_count()) ; return -1; } =20 - p->pages->used =3D be32_to_cpu(packet->used); - if (p->pages->used > packet->size) { + p->pages->used =3D be32_to_cpu(packet->pages_used); + if (p->pages->used > packet->pages_alloc) { error_setg(errp, "multifd: received packet " - "with size %d and expected maximum size %d", - p->pages->used, packet->size) ; + "with %d pages and expected maximum pages are %d", + p->pages->used, packet->pages_alloc) ; return -1; } =20 --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552479541981465.947437420146; Wed, 13 Mar 2019 05:19:01 -0700 (PDT) Received: from localhost ([127.0.0.1]:43537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42qY-0000RX-OH for importer@patchew.org; Wed, 13 Mar 2019 08:18:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42ZY-0003Ip-M2 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:01:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42ZW-0005zg-Az for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:01:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42ZU-0005yQ-9D for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:01:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C0DBC0B6148 for ; Wed, 13 Mar 2019 11:53:00 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB7B91001E6A; Wed, 13 Mar 2019 11:52:58 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:14 +0100 Message-Id: <20190313115121.7611-4-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 13 Mar 2019 11:53:00 +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] [PULL 03/10] multifd: Create new next_packet_size field 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We need to send this field when we add compression support. As we are still on x- stage, we can do this kind of changes. Signed-off-by: Juan Quintela --- migration/ram.c | 15 +++++++++++++-- migration/trace-events | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index dc73829e25..29f2823939 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -597,6 +597,8 @@ typedef struct { /* maximum number of allocated pages */ uint32_t pages_alloc; uint32_t pages_used; + /* size of the next packet that contains pages */ + uint32_t next_packet_size; uint64_t packet_num; char ramblock[256]; uint64_t offset[]; @@ -644,6 +646,8 @@ typedef struct { MultiFDPacket_t *packet; /* multifd flags for each packet */ uint32_t flags; + /* size of the next packet that contains pages */ + uint32_t next_packet_size; /* global number of generated multifd packets */ uint64_t packet_num; /* thread local variables */ @@ -680,6 +684,8 @@ typedef struct { /* global number of generated multifd packets */ uint64_t packet_num; /* thread local variables */ + /* size of the next packet that contains pages */ + uint32_t next_packet_size; /* packets sent through this channel */ uint64_t num_packets; /* pages sent through this channel */ @@ -784,6 +790,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) packet->flags =3D cpu_to_be32(p->flags); packet->pages_alloc =3D cpu_to_be32(migrate_multifd_page_count()); packet->pages_used =3D cpu_to_be32(p->pages->used); + packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); =20 if (p->pages->block) { @@ -835,6 +842,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } =20 + p->next_packet_size =3D be32_to_cpu(packet->next_packet_size); p->packet_num =3D be64_to_cpu(packet->packet_num); =20 if (p->pages->used) { @@ -1074,6 +1082,7 @@ 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(); multifd_send_fill_packet(p); p->flags =3D 0; p->num_packets++; @@ -1081,7 +1090,8 @@ static void *multifd_send_thread(void *opaque) p->pages->used =3D 0; qemu_mutex_unlock(&p->mutex); =20 - trace_multifd_send(p->id, packet_num, used, flags); + trace_multifd_send(p->id, packet_num, used, flags, + p->next_packet_size); =20 ret =3D qio_channel_write_all(p->c, (void *)p->packet, p->packet_len, &local_err); @@ -1316,7 +1326,8 @@ static void *multifd_recv_thread(void *opaque) =20 used =3D p->pages->used; flags =3D p->flags; - trace_multifd_recv(p->id, p->packet_num, used, flags); + trace_multifd_recv(p->id, p->packet_num, used, flags, + p->next_packet_size); p->num_packets++; p->num_pages +=3D used; qemu_mutex_unlock(&p->mutex); diff --git a/migration/trace-events b/migration/trace-events index 72e3fcb885..ef78dc21f8 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -76,13 +76,13 @@ get_queued_page_not_dirty(const char *block_name, uint6= 4_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) "channel %d packet number %" PRIu64 " pages %d flags 0x%x" +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_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" multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %d packets %" PRIu64 " pages %" PRIu64 multifd_recv_thread_start(uint8_t id) "%d" -multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s) "channel %d packet_num %" PRIu64 " pages %d flags 0x%x" +multifd_send(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_send_sync_main(long packet_num) "packet num %ld" multifd_send_sync_main_signal(uint8_t id) "channel %d" multifd_send_sync_main_wait(uint8_t id) "channel %d" --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552479076470107.29797951105434; Wed, 13 Mar 2019 05:11:16 -0700 (PDT) Received: from localhost ([127.0.0.1]:43048 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42j2-0002Rm-9U for importer@patchew.org; Wed, 13 Mar 2019 08:11:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42aE-0003jx-C5 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42a9-0006DY-4L for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42a8-0006Cz-On for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:02:01 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2219308626F for ; Wed, 13 Mar 2019 11:53:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id F245A1001E69; Wed, 13 Mar 2019 11:53:00 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:15 +0100 Message-Id: <20190313115121.7611-5-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 13 Mar 2019 11:53:02 +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] [PULL 04/10] multifd: Drop x-multifd-page-count 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Libvirt don't want to expose (and explain it). From now on we measure the number of packages in bytes instead of pages, so it is the same independently of architecture. We choose the page size of x86. Notice that in the following patch we make this variable. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Markus Armbruster Signed-off-by: Juan Quintela --- hmp.c | 7 ------- migration/migration.c | 30 ------------------------------ migration/migration.h | 1 - migration/ram.c | 15 ++++++++++----- qapi/migration.json | 13 +------------ 5 files changed, 11 insertions(+), 55 deletions(-) diff --git a/hmp.c b/hmp.c index 4a702d5b97..ddaf98d402 100644 --- a/hmp.c +++ b/hmp.c @@ -434,9 +434,6 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: %u\n", MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_CHANNELS), params->x_multifd_channels); - monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUN= T), - params->x_multifd_page_count); monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); @@ -1789,10 +1786,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) p->has_x_multifd_channels =3D true; visit_type_int(v, param, &p->x_multifd_channels, &err); break; - case MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUNT: - p->has_x_multifd_page_count =3D true; - visit_type_int(v, param, &p->x_multifd_page_count, &err); - 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/migration/migration.c b/migration/migration.c index df6fd8e0e5..52c8121628 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -82,7 +82,6 @@ /* 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_PAGE_COUNT 16 =20 /* Background transfer rate for postcopy, 0 means unlimited, note * that page requests can still exceed this limit. @@ -768,8 +767,6 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->block_incremental =3D s->parameters.block_incremental; params->has_x_multifd_channels =3D true; params->x_multifd_channels =3D s->parameters.x_multifd_channels; - params->has_x_multifd_page_count =3D true; - 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; params->has_max_postcopy_bandwidth =3D true; @@ -1158,14 +1155,6 @@ static bool migrate_params_check(MigrationParameters= *params, Error **errp) "is invalid, it should be in the range of 1 to 255"); return false; } - if (params->has_x_multifd_page_count && - (params->x_multifd_page_count < 1 || - params->x_multifd_page_count > 10000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_page_count", - "is invalid, it should be in the range of 1 to 10000"); - return false; - } =20 if (params->has_xbzrle_cache_size && (params->xbzrle_cache_size < qemu_target_page_size() || @@ -1277,9 +1266,6 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, if (params->has_x_multifd_channels) { dest->x_multifd_channels =3D params->x_multifd_channels; } - if (params->has_x_multifd_page_count) { - dest->x_multifd_page_count =3D params->x_multifd_page_count; - } if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size =3D params->xbzrle_cache_size; } @@ -1370,9 +1356,6 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) if (params->has_x_multifd_channels) { s->parameters.x_multifd_channels =3D params->x_multifd_channels; } - if (params->has_x_multifd_page_count) { - s->parameters.x_multifd_page_count =3D params->x_multifd_page_coun= t; - } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; xbzrle_cache_resize(params->xbzrle_cache_size, errp); @@ -2152,15 +2135,6 @@ int migrate_multifd_channels(void) return s->parameters.x_multifd_channels; } =20 -int migrate_multifd_page_count(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.x_multifd_page_count; -} - int migrate_use_xbzrle(void) { MigrationState *s; @@ -3403,9 +3377,6 @@ static Property migration_properties[] =3D { DEFINE_PROP_UINT8("x-multifd-channels", MigrationState, parameters.x_multifd_channels, DEFAULT_MIGRATE_MULTIFD_CHANNELS), - DEFINE_PROP_UINT32("x-multifd-page-count", MigrationState, - parameters.x_multifd_page_count, - DEFAULT_MIGRATE_MULTIFD_PAGE_COUNT), DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, parameters.xbzrle_cache_size, DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), @@ -3495,7 +3466,6 @@ static void migration_instance_init(Object *obj) params->has_x_checkpoint_delay =3D true; params->has_block_incremental =3D true; params->has_x_multifd_channels =3D true; - params->has_x_multifd_page_count =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/migration/migration.h b/migration/migration.h index 99e99e56bd..0f986935e1 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -274,7 +274,6 @@ bool migrate_auto_converge(void); bool migrate_use_multifd(void); bool migrate_pause_before_switchover(void); int migrate_multifd_channels(void); -int migrate_multifd_page_count(void); =20 int migrate_use_xbzrle(void); int64_t migrate_xbzrle_cache_size(void); diff --git a/migration/ram.c b/migration/ram.c index 29f2823939..454d3eb539 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -583,6 +583,9 @@ exit: =20 #define MULTIFD_FLAG_SYNC (1 << 0) =20 +/* This value needs to be a multiple of qemu_target_page_size() */ +#define MULTIFD_PACKET_SIZE (64 * 1024) + typedef struct { uint32_t magic; uint32_t version; @@ -783,12 +786,13 @@ static void multifd_pages_clear(MultiFDPages_t *pages) static void multifd_send_fill_packet(MultiFDSendParams *p) { MultiFDPacket_t *packet =3D p->packet; + uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); int i; =20 packet->magic =3D cpu_to_be32(MULTIFD_MAGIC); packet->version =3D cpu_to_be32(MULTIFD_VERSION); packet->flags =3D cpu_to_be32(p->flags); - packet->pages_alloc =3D cpu_to_be32(migrate_multifd_page_count()); + packet->pages_alloc =3D cpu_to_be32(page_count); packet->pages_used =3D cpu_to_be32(p->pages->used); packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); @@ -805,6 +809,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) { MultiFDPacket_t *packet =3D p->packet; + uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); RAMBlock *block; int i; =20 @@ -827,10 +832,10 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) p->flags =3D be32_to_cpu(packet->flags); =20 packet->pages_alloc =3D be32_to_cpu(packet->pages_alloc); - if (packet->pages_alloc > migrate_multifd_page_count()) { + if (packet->pages_alloc > page_count) { error_setg(errp, "multifd: received packet " "with size %d and expected maximum size %d", - packet->pages_alloc, migrate_multifd_page_count()) ; + packet->pages_alloc, page_count) ; return -1; } =20 @@ -1162,7 +1167,7 @@ static void multifd_new_send_channel_async(QIOTask *t= ask, gpointer opaque) int multifd_save_setup(void) { int thread_count; - uint32_t page_count =3D migrate_multifd_page_count(); + uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; =20 if (!migrate_use_multifd()) { @@ -1362,7 +1367,7 @@ static void *multifd_recv_thread(void *opaque) int multifd_load_setup(void) { int thread_count; - uint32_t page_count =3D migrate_multifd_page_count(); + uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; =20 if (!migrate_use_multifd()) { diff --git a/qapi/migration.json b/qapi/migration.json index 5684733754..7cd03596ae 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -562,9 +562,6 @@ # number of sockets used for migration. The # default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread. -# The default value is 16 (since 2.11) -# # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size # and a power of 2 @@ -587,7 +584,7 @@ 'cpu-throttle-initial', 'cpu-throttle-increment', 'tls-creds', 'tls-hostname', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', - 'x-multifd-channels', 'x-multifd-page-count', + 'x-multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle' ] } =20 @@ -667,9 +664,6 @@ # number of sockets used for migration. The # default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread. -# The default value is 16 (since 2.11) -# # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size # and a power of 2 @@ -704,7 +698,6 @@ '*x-checkpoint-delay': 'int', '*block-incremental': 'bool', '*x-multifd-channels': 'int', - '*x-multifd-page-count': 'int', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'int' } } @@ -800,9 +793,6 @@ # number of sockets used for migration. # The default value is 2 (since 2.11) # -# @x-multifd-page-count: Number of pages sent together to a thread. -# The default value is 16 (since 2.11) -# # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size # and a power of 2 @@ -836,7 +826,6 @@ '*x-checkpoint-delay': 'uint32', '*block-incremental': 'bool' , '*x-multifd-channels': 'uint8', - '*x-multifd-page-count': 'uint32', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle':'uint8'} } --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552478888584738.2468043100384; Wed, 13 Mar 2019 05:08:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:42945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42g1-0007xS-Fq for importer@patchew.org; Wed, 13 Mar 2019 08:08:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Xb-0001ab-Fy for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42Xa-0004ge-2S for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47182) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42XZ-0004fq-P5 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 350BD30EEF8A for ; Wed, 13 Mar 2019 11:53:05 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45C0F1001E69; Wed, 13 Mar 2019 11:53:03 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:16 +0100 Message-Id: <20190313115121.7611-6-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 13 Mar 2019 11:53:05 +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] [PULL 05/10] multifd: Be flexible about packet size 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This way we can change the packet size in the future and everything will work. We choose an arbitrary big number (100 times configured size) as a limit about how big we will reallocate. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/ram.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 454d3eb539..77c1878292 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -786,13 +786,13 @@ static void multifd_pages_clear(MultiFDPages_t *pages) static void multifd_send_fill_packet(MultiFDSendParams *p) { MultiFDPacket_t *packet =3D p->packet; - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); + uint32_t page_max =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); int i; =20 packet->magic =3D cpu_to_be32(MULTIFD_MAGIC); packet->version =3D cpu_to_be32(MULTIFD_VERSION); packet->flags =3D cpu_to_be32(p->flags); - packet->pages_alloc =3D cpu_to_be32(page_count); + packet->pages_alloc =3D cpu_to_be32(page_max); packet->pages_used =3D cpu_to_be32(p->pages->used); packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); @@ -809,7 +809,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) { MultiFDPacket_t *packet =3D p->packet; - uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); + uint32_t pages_max =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); RAMBlock *block; int i; =20 @@ -832,12 +832,24 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) p->flags =3D be32_to_cpu(packet->flags); =20 packet->pages_alloc =3D be32_to_cpu(packet->pages_alloc); - if (packet->pages_alloc > page_count) { + /* + * If we recevied a packet that is 100 times bigger than expected + * just stop migration. It is a magic number. + */ + if (packet->pages_alloc > pages_max * 100) { error_setg(errp, "multifd: received packet " - "with size %d and expected maximum size %d", - packet->pages_alloc, page_count) ; + "with size %d and expected a maximum size of %d", + packet->pages_alloc, pages_max * 100) ; return -1; } + /* + * We received a packet that is bigger than expected but inside + * reasonable limits (see previous comment). Just reallocate. + */ + if (packet->pages_alloc > p->pages->allocated) { + multifd_pages_clear(p->pages); + multifd_pages_init(packet->pages_alloc); + } =20 p->pages->used =3D be32_to_cpu(packet->pages_used); if (p->pages->used > packet->pages_alloc) { --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552478453191989.4497703929176; Wed, 13 Mar 2019 05:00:53 -0700 (PDT) Received: from localhost ([127.0.0.1]:42817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Yq-00028Y-UW for importer@patchew.org; Wed, 13 Mar 2019 08:00:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Wo-0000x8-BA for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42Wn-0004B3-KN for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53058) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42Wn-0004AM-CQ for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:33 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CDE633025C for ; Wed, 13 Mar 2019 11:53:07 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C0F21001E70; Wed, 13 Mar 2019 11:53:05 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:17 +0100 Message-Id: <20190313115121.7611-7-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Mar 2019 11:53:07 +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] [PULL 06/10] multifd: Change default packet size 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We moved from 64KB to 512KB, as it makes less locking contention without any downside in testing. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 77c1878292..700c345ec5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -584,7 +584,7 @@ exit: #define MULTIFD_FLAG_SYNC (1 << 0) =20 /* This value needs to be a multiple of qemu_target_page_size() */ -#define MULTIFD_PACKET_SIZE (64 * 1024) +#define MULTIFD_PACKET_SIZE (512 * 1024) =20 typedef struct { uint32_t magic; --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552478451159586.2855279604167; Wed, 13 Mar 2019 05:00:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:42833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Ys-0002Aw-V6 for importer@patchew.org; Wed, 13 Mar 2019 08:00:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Wo-0000x7-Aw for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42Wn-0004Av-J4 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42Wn-0004AI-CN for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:33 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C26BD330260 for ; Wed, 13 Mar 2019 11:53:09 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0F2B1001E70; Wed, 13 Mar 2019 11:53:07 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:18 +0100 Message-Id: <20190313115121.7611-8-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Mar 2019 11:53:09 +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] [PULL 07/10] multifd: Add some padding 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add some padding. MultifdInit_t is padded to 64 bytes. MultiFDPacket_t is padded to 320bytes (64 * 5). Signed-off-by: Juan Quintela --- migration/ram.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 700c345ec5..d7f8fe45a8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -591,6 +591,8 @@ typedef struct { uint32_t version; unsigned char uuid[16]; /* QemuUUID */ uint8_t id; + uint8_t unused1[7]; /* Reserved for future use */ + uint64_t unused2[4]; /* Reserved for future use */ } __attribute__((packed)) MultiFDInit_t; =20 typedef struct { @@ -603,6 +605,7 @@ typedef struct { /* size of the next packet that contains pages */ uint32_t next_packet_size; uint64_t packet_num; + uint64_t unused[4]; /* Reserved for future use */ char ramblock[256]; uint64_t offset[]; } __attribute__((packed)) MultiFDPacket_t; --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 1552479286256627.8342772258296; Wed, 13 Mar 2019 05:14:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:43319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42mQ-0005uV-4E for importer@patchew.org; Wed, 13 Mar 2019 08:14:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42Xn-0001lN-Mo for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42Xl-0004lW-34 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42Xk-0004lF-Oi for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:59:32 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13D933089EF6 for ; Wed, 13 Mar 2019 11:53:12 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 259461001E70; Wed, 13 Mar 2019 11:53:09 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:19 +0100 Message-Id: <20190313115121.7611-9-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 13 Mar 2019 11:53:12 +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] [PULL 08/10] multifd: Drop x- 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We make it supported from now on. Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Markus Armbruster Signed-off-by: Juan Quintela --- hmp.c | 10 +++++----- migration/migration.c | 26 +++++++++++++------------- qapi/migration.json | 34 +++++++++++++++++----------------- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/hmp.c b/hmp.c index ddaf98d402..876c656c94 100644 --- a/hmp.c +++ b/hmp.c @@ -432,8 +432,8 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL), params->block_incremental ? "on" : "off"); monitor_printf(mon, "%s: %u\n", - MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_CHANNELS), - params->x_multifd_channels); + MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), + params->multifd_channels); monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), params->xbzrle_cache_size); @@ -1782,9 +1782,9 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) p->has_block_incremental =3D true; visit_type_bool(v, param, &p->block_incremental, &err); break; - case MIGRATION_PARAMETER_X_MULTIFD_CHANNELS: - p->has_x_multifd_channels =3D true; - visit_type_int(v, param, &p->x_multifd_channels, &err); + case MIGRATION_PARAMETER_MULTIFD_CHANNELS: + p->has_multifd_channels =3D true; + visit_type_int(v, param, &p->multifd_channels, &err); break; case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: p->has_xbzrle_cache_size =3D true; diff --git a/migration/migration.c b/migration/migration.c index 52c8121628..b36cf9c9a0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -765,8 +765,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; params->has_block_incremental =3D true; params->block_incremental =3D s->parameters.block_incremental; - params->has_x_multifd_channels =3D true; - params->x_multifd_channels =3D s->parameters.x_multifd_channels; + params->has_multifd_channels =3D true; + params->multifd_channels =3D s->parameters.multifd_channels; params->has_xbzrle_cache_size =3D true; params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; params->has_max_postcopy_bandwidth =3D true; @@ -1149,7 +1149,7 @@ static bool migrate_params_check(MigrationParameters = *params, Error **errp) =20 /* x_checkpoint_delay is now always positive */ =20 - if (params->has_x_multifd_channels && (params->x_multifd_channels < 1)= ) { + if (params->has_multifd_channels && (params->multifd_channels < 1)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "is invalid, it should be in the range of 1 to 255"); @@ -1263,8 +1263,8 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, if (params->has_block_incremental) { dest->block_incremental =3D params->block_incremental; } - if (params->has_x_multifd_channels) { - dest->x_multifd_channels =3D params->x_multifd_channels; + if (params->has_multifd_channels) { + dest->multifd_channels =3D params->multifd_channels; } if (params->has_xbzrle_cache_size) { dest->xbzrle_cache_size =3D params->xbzrle_cache_size; @@ -1353,8 +1353,8 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) if (params->has_block_incremental) { s->parameters.block_incremental =3D params->block_incremental; } - if (params->has_x_multifd_channels) { - s->parameters.x_multifd_channels =3D params->x_multifd_channels; + if (params->has_multifd_channels) { + s->parameters.multifd_channels =3D params->multifd_channels; } if (params->has_xbzrle_cache_size) { s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; @@ -2113,7 +2113,7 @@ bool migrate_use_multifd(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_X_MULTIFD]; + return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 bool migrate_pause_before_switchover(void) @@ -2132,7 +2132,7 @@ int migrate_multifd_channels(void) =20 s =3D migrate_get_current(); =20 - return s->parameters.x_multifd_channels; + return s->parameters.multifd_channels; } =20 int migrate_use_xbzrle(void) @@ -3374,8 +3374,8 @@ static Property migration_properties[] =3D { DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, parameters.x_checkpoint_delay, DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), - DEFINE_PROP_UINT8("x-multifd-channels", MigrationState, - parameters.x_multifd_channels, + DEFINE_PROP_UINT8("multifd-channels", MigrationState, + parameters.multifd_channels, DEFAULT_MIGRATE_MULTIFD_CHANNELS), DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, parameters.xbzrle_cache_size, @@ -3411,7 +3411,7 @@ static Property migration_properties[] =3D { DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), - DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_X_MULTIFD), + DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), =20 DEFINE_PROP_END_OF_LIST(), }; @@ -3465,7 +3465,7 @@ static void migration_instance_init(Object *obj) params->has_downtime_limit =3D true; params->has_x_checkpoint_delay =3D true; params->has_block_incremental =3D true; - params->has_x_multifd_channels =3D true; + params->has_multifd_channels =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/migration.json b/qapi/migration.json index 7cd03596ae..ff3616f4c2 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -401,7 +401,7 @@ # @pause-before-switchover: Pause outgoing migration before serialising de= vice # state and before disabling block IO (since 2.11) # -# @x-multifd: Use more than one fd for migration (since 2.11) +# @multifd: Use more than one fd for migration (since 4.0) # # @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps. # (since 2.12) @@ -420,7 +420,7 @@ { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', - 'block', 'return-path', 'pause-before-switchover', 'x-multifd', + 'block', 'return-path', 'pause-before-switchover', 'multifd', 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', 'x-ignore-shared' ] } =20 @@ -557,10 +557,10 @@ # migrated and the destination must already have access to the # same backing chain as was used on the source. (since 2.10) # -# @x-multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the -# number of sockets used for migration. The -# default value is 2 (since 2.11) +# @multifd-channels: Number of channels used to migrate data in +# parallel. This is the same number that the +# number of sockets used for migration. The +# default value is 2 (since 4.0) # # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size @@ -584,7 +584,7 @@ 'cpu-throttle-initial', 'cpu-throttle-increment', 'tls-creds', 'tls-hostname', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', - 'x-multifd-channels', + 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle' ] } =20 @@ -659,10 +659,10 @@ # migrated and the destination must already have access to the # same backing chain as was used on the source. (since 2.10) # -# @x-multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the -# number of sockets used for migration. The -# default value is 2 (since 2.11) +# @multifd-channels: Number of channels used to migrate data in +# parallel. This is the same number that the +# number of sockets used for migration. The +# default value is 2 (since 4.0) # # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size @@ -697,7 +697,7 @@ '*downtime-limit': 'int', '*x-checkpoint-delay': 'int', '*block-incremental': 'bool', - '*x-multifd-channels': 'int', + '*multifd-channels': 'int', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle': 'int' } } @@ -788,10 +788,10 @@ # migrated and the destination must already have access to the # same backing chain as was used on the source. (since 2.10) # -# @x-multifd-channels: Number of channels used to migrate data in -# parallel. This is the same number that the -# number of sockets used for migration. -# The default value is 2 (since 2.11) +# @multifd-channels: Number of channels used to migrate data in +# parallel. This is the same number that the +# number of sockets used for migration. +# The default value is 2 (since 4.0) # # @xbzrle-cache-size: cache size to be used by XBZRLE migration. It # needs to be a multiple of the target page size @@ -825,7 +825,7 @@ '*downtime-limit': 'uint64', '*x-checkpoint-delay': 'uint32', '*block-incremental': 'bool' , - '*x-multifd-channels': 'uint8', + '*multifd-channels': 'uint8', '*xbzrle-cache-size': 'size', '*max-postcopy-bandwidth': 'size', '*max-cpu-throttle':'uint8'} } --=20 2.20.1 From nobody Sun Nov 9 23:46:47 2025 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 155247860182798.743619218969; Wed, 13 Mar 2019 05:03:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:42875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42bO-0004A4-PN for importer@patchew.org; Wed, 13 Mar 2019 08:03:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42XD-0001DR-5A for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42XC-0004Om-8i for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42X9-0004MZ-3S for qemu-devel@nongnu.org; Wed, 13 Mar 2019 07:58:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60DB930BC67B for ; Wed, 13 Mar 2019 11:53:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BF5B1001E70; Wed, 13 Mar 2019 11:53:12 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:20 +0100 Message-Id: <20190313115121.7611-10-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 13 Mar 2019 11:53:14 +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] [PULL 09/10] 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 , "Dr. David Alan Gilbert" , Markus Armbruster , 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 48dc20a2ae..cf26443056 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -1026,6 +1026,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(from, "downtime-limit", 1); + /* 1GB/s */ + migrate_set_parameter(from, "max-bandwidth", 1000000000); + + migrate_set_parameter(from, "multifd-channels", 2); + migrate_set_parameter(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(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"; @@ -1080,6 +1127,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 Nov 9 23:46:47 2025 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 1552479058914385.2078617839393; Wed, 13 Mar 2019 05:10:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:43040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42ih-00027J-OK for importer@patchew.org; Wed, 13 Mar 2019 08:10:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h42YN-0002Gk-Aa for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:00:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h42YI-0005DP-34 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:00:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h42YH-0005Ck-NN for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:00:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4DC7C066455 for ; Wed, 13 Mar 2019 11:53:16 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-118.ams2.redhat.com [10.36.116.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6AEA1001E70; Wed, 13 Mar 2019 11:53:14 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 12:51:21 +0100 Message-Id: <20190313115121.7611-11-quintela@redhat.com> In-Reply-To: <20190313115121.7611-1-quintela@redhat.com> References: <20190313115121.7611-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 13 Mar 2019 11:53:16 +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] [PULL 10/10] migration: add support for a "tls-authz" migration 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 , "Dr. David Alan Gilbert" , Markus Armbruster , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The QEMU instance that runs as the server for the migration data transport (ie the target QEMU) needs to be able to configure access control so it can prevent unauthorized clients initiating an incoming migration. This adds a new 'tls-authz' migration parameter that is used to provide the QOM ID of a QAuthZ subclass instance that provides the access control check. This is checked against the x509 certificate obtained during the TLS handshake. For example, when starting a QEMU for incoming migration, it is possible to give an example identity of the source QEMU that is intended to be connecting later: $QEMU \ -monitor stdio \ -incoming defer \ ...other args... (qemu) object_add tls-creds-x509,id=3Dtls0,dir=3D/home/berrange/qemutls,\ endpoint=3Dserver,verify-peer=3Dyes \ (qemu) object_add authz-simple,id=3Dauth0,identity=3DCN=3Dlaptop.example.= com,,\ O=3DExample Org,,L=3DLondon,,ST=3DLondon,,C=3DGB \ (qemu) migrate_incoming tcp:localhost:9000 Reviewed-by: Juan Quintela Signed-off-by: Daniel P. Berrange Signed-off-by: Juan Quintela --- hmp.c | 9 +++++++++ migration/migration.c | 8 ++++++++ migration/tls.c | 2 +- qapi/migration.json | 14 +++++++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hmp.c b/hmp.c index 876c656c94..c5c9d01491 100644 --- a/hmp.c +++ b/hmp.c @@ -440,6 +440,9 @@ void hmp_info_migrate_parameters(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "%s: %" PRIu64 "\n", MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWI= DTH), params->max_postcopy_bandwidth); + monitor_printf(mon, " %s: '%s'\n", + MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), + params->has_tls_authz ? params->tls_authz : ""); } =20 qapi_free_MigrationParameters(params); @@ -1756,6 +1759,12 @@ void hmp_migrate_set_parameter(Monitor *mon, const Q= Dict *qdict) p->tls_hostname->type =3D QTYPE_QSTRING; visit_type_str(v, param, &p->tls_hostname->u.s, &err); break; + case MIGRATION_PARAMETER_TLS_AUTHZ: + p->has_tls_authz =3D true; + p->tls_authz =3D g_new0(StrOrNull, 1); + p->tls_authz->type =3D QTYPE_QSTRING; + visit_type_str(v, param, &p->tls_authz->u.s, &err); + break; case MIGRATION_PARAMETER_MAX_BANDWIDTH: p->has_max_bandwidth =3D true; /* diff --git a/migration/migration.c b/migration/migration.c index b36cf9c9a0..d5c218a22b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -757,6 +757,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) params->tls_creds =3D g_strdup(s->parameters.tls_creds); params->has_tls_hostname =3D true; params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); + params->has_tls_authz =3D true; + params->tls_authz =3D g_strdup(s->parameters.tls_authz); params->has_max_bandwidth =3D true; params->max_bandwidth =3D s->parameters.max_bandwidth; params->has_downtime_limit =3D true; @@ -1331,6 +1333,12 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); } =20 + if (params->has_tls_authz) { + g_free(s->parameters.tls_authz); + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + } + if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; if (s->to_dst_file) { diff --git a/migration/tls.c b/migration/tls.c index 3b9e8c9263..5171afc6c4 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -94,7 +94,7 @@ void migration_tls_channel_process_incoming(MigrationStat= e *s, =20 tioc =3D qio_channel_tls_new_server( ioc, creds, - NULL, /* XXX pass ACL name */ + s->parameters.tls_authz, errp); if (!tioc) { return; diff --git a/qapi/migration.json b/qapi/migration.json index ff3616f4c2..0a85aadd15 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -541,6 +541,12 @@ # hostname must be provided so that the server's x509 # certificate identity can be validated. (Since 2.7) # +# @tls-authz: ID of the 'authz' object subclass that provides access contr= ol +# checking of the TLS x509 certificate distinguished name. +# This object is only resolved at time of use, so can be delet= ed +# and recreated on the fly while the migration server is activ= e. +# If missing, it will default to denying access (Since 4.0) +# # @max-bandwidth: to set maximum speed for migration. maximum speed in # bytes per second. (Since 2.8) # @@ -582,7 +588,7 @@ 'compress-level', 'compress-threads', 'decompress-threads', 'compress-wait-thread', 'cpu-throttle-initial', 'cpu-throttle-increment', - 'tls-creds', 'tls-hostname', 'max-bandwidth', + 'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth', 'downtime-limit', 'x-checkpoint-delay', 'block-incremental', 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', @@ -693,6 +699,7 @@ '*cpu-throttle-increment': 'int', '*tls-creds': 'StrOrNull', '*tls-hostname': 'StrOrNull', + '*tls-authz': 'StrOrNull', '*max-bandwidth': 'int', '*downtime-limit': 'int', '*x-checkpoint-delay': 'int', @@ -773,6 +780,10 @@ # associated with the migration URI, if any. (Since 2.9) # Note: 2.8 reports this by omitting tls-hostname instead. # +# @tls-authz: ID of the 'authz' object subclass that provides access contr= ol +# checking of the TLS x509 certificate distinguished name. (Si= nce +# 4.0) +# # @max-bandwidth: to set maximum speed for migration. maximum speed in # bytes per second. (Since 2.8) # @@ -821,6 +832,7 @@ '*cpu-throttle-increment': 'uint8', '*tls-creds': 'str', '*tls-hostname': 'str', + '*tls-authz': 'str', '*max-bandwidth': 'size', '*downtime-limit': 'uint64', '*x-checkpoint-delay': 'uint32', --=20 2.20.1