From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537265796983.3203208356018; Mon, 25 Mar 2019 11:07:45 -0700 (PDT) Received: from localhost ([127.0.0.1]:46341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U0a-0007m4-I1 for importer@patchew.org; Mon, 25 Mar 2019 14:07:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq8-0007Vt-PV for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiD-0005Jv-K8 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiD-0005Ji-DA for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8175444F88; Mon, 25 Mar 2019 17:48:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6707909FF; Mon, 25 Mar 2019 17:48:38 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:52 +0100 Message-Id: <20190325174706.6741-2-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 25 Mar 2019 17:48:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537808665280.0716316478173; Mon, 25 Mar 2019 11:16:48 -0700 (PDT) Received: from localhost ([127.0.0.1]:46500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U9M-0007uf-UX for importer@patchew.org; Mon, 25 Mar 2019 14:16:45 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq8-0007Kw-1G for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiF-0005KK-Gk for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiF-0005KB-Ay for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 796DD30832CF; Mon, 25 Mar 2019 17:48:42 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC9D760C11; Mon, 25 Mar 2019 17:48:40 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:53 +0100 Message-Id: <20190325174706.6741-3-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 25 Mar 2019 17:48:42 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537069452314.75381206127133; Mon, 25 Mar 2019 11:04:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:46287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8TxF-0004zn-2F for importer@patchew.org; Mon, 25 Mar 2019 14:04:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq7-0007RH-Oh for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiH-0005L5-Do for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiH-0005Kq-5A for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72AC4368E3; Mon, 25 Mar 2019 17:48:44 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id D37A490777; Mon, 25 Mar 2019 17:48:42 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:54 +0100 Message-Id: <20190325174706.6741-4-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 25 Mar 2019 17:48:44 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15535379632939.462940870003536; Mon, 25 Mar 2019 11:19:23 -0700 (PDT) Received: from localhost ([127.0.0.1]:46522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8UBr-0001CB-5I for importer@patchew.org; Mon, 25 Mar 2019 14:19:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq7-0007Kt-M9 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiJ-0005Lh-D6 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54556) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiJ-0005LO-32 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65A783082B21; Mon, 25 Mar 2019 17:48:46 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA2C260C11; Mon, 25 Mar 2019 17:48:44 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:55 +0100 Message-Id: <20190325174706.6741-5-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 25 Mar 2019 17:48:46 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 fa1e59a2fc..5a68544042 100644 --- a/hmp.c +++ b/hmp.c @@ -435,9 +435,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); @@ -1816,10 +1813,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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537654203909.0685507536294; Mon, 25 Mar 2019 11:14:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:46439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U6o-0005Ej-Us for importer@patchew.org; Mon, 25 Mar 2019 14:14:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq7-0007Vt-KC for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiM-0005ME-A5 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiM-0005M5-1m for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E14988311; Mon, 25 Mar 2019 17:48:49 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id C267E90777; Mon, 25 Mar 2019 17:48:47 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:56 +0100 Message-Id: <20190325174706.6741-6-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 25 Mar 2019 17:48:49 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537516106108.99946816440422; Mon, 25 Mar 2019 11:11:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:46423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U4h-0003RF-33 for importer@patchew.org; Mon, 25 Mar 2019 14:11:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq6-0007RH-Py for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiO-0005Mk-7i for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiO-0005MZ-0k for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55B0D3082DD3; Mon, 25 Mar 2019 17:48:51 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8A6D909E6; Mon, 25 Mar 2019 17:48:49 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:57 +0100 Message-Id: <20190325174706.6741-7-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 25 Mar 2019 17:48:51 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553536866444885.5832620709394; Mon, 25 Mar 2019 11:01:06 -0700 (PDT) Received: from localhost ([127.0.0.1]:46257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8TuA-0002Um-Sr for importer@patchew.org; Mon, 25 Mar 2019 14:01:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq6-0007Kt-La for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiQ-0005NU-71 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50460) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiP-0005NL-W7 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E7CD30833BE; Mon, 25 Mar 2019 17:48:53 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD788909E6; Mon, 25 Mar 2019 17:48:51 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:58 +0100 Message-Id: <20190325174706.6741-8-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 25 Mar 2019 17:48:53 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537291245893.5919296426669; Mon, 25 Mar 2019 11:08:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:46345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U12-000872-5P for importer@patchew.org; Mon, 25 Mar 2019 14:08:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq6-0007Kw-9F for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiS-0005Ob-9F for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiR-0005OE-VB for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41B1181F33; Mon, 25 Mar 2019 17:48:55 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id A69D190A15; Mon, 25 Mar 2019 17:48:53 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:46:59 +0100 Message-Id: <20190325174706.6741-9-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 25 Mar 2019 17:48:55 +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/15] 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang 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 5a68544042..6bbbe1ad85 100644 --- a/hmp.c +++ b/hmp.c @@ -433,8 +433,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); @@ -1809,9 +1809,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 Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537349914264.3843578666074; Mon, 25 Mar 2019 11:09:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:46347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U1y-0000Vc-Ni for importer@patchew.org; Mon, 25 Mar 2019 14:09:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq5-0007Vt-SC for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiU-0005PA-Cl for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58360) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiU-0005Ow-3r for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:48:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67A8730BC650; Mon, 25 Mar 2019 17:48:57 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C49A90777; Mon, 25 Mar 2019 17:48:55 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:00 +0100 Message-Id: <20190325174706.6741-10-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 25 Mar 2019 17:48:57 +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/15] 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: zhanghailiang , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" 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 6bbbe1ad85..92941142af 100644 --- a/hmp.c +++ b/hmp.c @@ -441,6 +441,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); @@ -1783,6 +1786,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 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537083627612.9729751653543; Mon, 25 Mar 2019 11:04:43 -0700 (PDT) Received: from localhost ([127.0.0.1]:46291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Txe-0005H1-PE for importer@patchew.org; Mon, 25 Mar 2019 14:04:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq5-0007RH-PS for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TiW-0005Pz-8x for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TiW-0005Pe-1l for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5CBEF89C40; Mon, 25 Mar 2019 17:48:59 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1F4690A1F; Mon, 25 Mar 2019 17:48:57 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:01 +0100 Message-Id: <20190325174706.6741-11-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 25 Mar 2019 17:48:59 +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/15] migration/rdma: Check qemu_rdma_init_one_block 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Actually it can't fail at the moment, but Coverity moans that it's the only place it's not checked, and it's an easy check. Reported-by: Coverity (CID 1399413) Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/rdma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 63c118af09..c1bcece53b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -641,10 +641,14 @@ static int qemu_rdma_init_one_block(RAMBlock *rb, voi= d *opaque) static int qemu_rdma_init_ram_blocks(RDMAContext *rdma) { RDMALocalBlocks *local =3D &rdma->local_ram_blocks; + int ret; =20 assert(rdma->blockmap =3D=3D NULL); memset(local, 0, sizeof *local); - foreach_not_ignored_block(qemu_rdma_init_one_block, rdma); + ret =3D foreach_not_ignored_block(qemu_rdma_init_one_block, rdma); + if (ret) { + return ret; + } trace_qemu_rdma_init_ram_blocks(local->nb_blocks); rdma->dest_blocks =3D g_new0(RDMADestBlock, rdma->local_ram_blocks.nb_blocks); --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537510306366.881549003738; Mon, 25 Mar 2019 11:11:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:46421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U4b-0003Ml-8H for importer@patchew.org; Mon, 25 Mar 2019 14:11:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq4-0007Kw-Qq for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Tih-0005XA-BZ for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42730) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8Tih-0005WB-4P for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1125470D81; Mon, 25 Mar 2019 17:49:10 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6F7A90CCD; Mon, 25 Mar 2019 17:48:59 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:02 +0100 Message-Id: <20190325174706.6741-12-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 25 Mar 2019 17:49:10 +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 11/15] Migration/colo.c: Fix COLO failover status error 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: zhanghailiang , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Zhang Chen When finished COLO failover, the status is FAILOVER_STATUS_COMPLETED. The origin codes misunderstand the FAILOVER_STATUS_REQUIRE. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 5ba610dc01..89325952c7 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -121,6 +121,7 @@ static void secondary_vm_do_failover(void) } /* Notify COLO incoming thread that failover work is finished */ qemu_sem_post(&mis->colo_incoming_sem); + /* For Secondary VM, jump to incoming co */ if (mis->migration_incoming_co) { qemu_coroutine_enter(mis->migration_incoming_co); @@ -262,7 +263,7 @@ COLOStatus *qmp_query_colo_status(Error **errp) case FAILOVER_STATUS_NONE: s->reason =3D COLO_EXIT_REASON_NONE; break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: s->reason =3D COLO_EXIT_REASON_REQUEST; break; default: @@ -582,7 +583,7 @@ out: qapi_event_send_colo_exit(COLO_MODE_PRIMARY, COLO_EXIT_REASON_ERROR); break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_PRIMARY, COLO_EXIT_REASON_REQUEST); break; @@ -854,7 +855,7 @@ out: qapi_event_send_colo_exit(COLO_MODE_SECONDARY, COLO_EXIT_REASON_ERROR); break; - case FAILOVER_STATUS_REQUIRE: + case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_SECONDARY, COLO_EXIT_REASON_REQUEST); break; --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537267927169.89005105530794; Mon, 25 Mar 2019 11:07:47 -0700 (PDT) Received: from localhost ([127.0.0.1]:46343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8U0b-0007nt-OG for importer@patchew.org; Mon, 25 Mar 2019 14:07:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq4-0007Kt-7Z for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Tiw-0005d6-Vf for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8Tiw-0005ch-LS for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8EDE3082AFD; Mon, 25 Mar 2019 17:49:25 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B20C90CCD; Mon, 25 Mar 2019 17:49:10 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:03 +0100 Message-Id: <20190325174706.6741-13-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 25 Mar 2019 17:49:26 +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 12/15] Migration/colo.c: Add new COLOExitReason to handle all failover state 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: zhanghailiang , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Zhang Chen In this patch we add the processing state for COLOExitReason, because we have to identify COLO in the failover processing state or failover error state. In the way, we can handle all the failover state. We have improved the description of the COLOExitReason by the way. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 24 +++++++++++++----------- qapi/migration.json | 15 +++++++++------ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 89325952c7..dbe2b88807 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -267,7 +267,11 @@ COLOStatus *qmp_query_colo_status(Error **errp) s->reason =3D COLO_EXIT_REASON_REQUEST; break; default: - s->reason =3D COLO_EXIT_REASON_ERROR; + if (migration_in_colo_state()) { + s->reason =3D COLO_EXIT_REASON_PROCESSING; + } else { + s->reason =3D COLO_EXIT_REASON_ERROR; + } } =20 return s; @@ -579,16 +583,13 @@ out: * or the user triggered failover. */ switch (failover_get_state()) { - case FAILOVER_STATUS_NONE: - qapi_event_send_colo_exit(COLO_MODE_PRIMARY, - COLO_EXIT_REASON_ERROR); - break; case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_PRIMARY, COLO_EXIT_REASON_REQUEST); break; default: - abort(); + qapi_event_send_colo_exit(COLO_MODE_PRIMARY, + COLO_EXIT_REASON_ERROR); } =20 /* Hope this not to be too long to wait here */ @@ -850,17 +851,18 @@ out: error_report_err(local_err); } =20 + /* + * There are only two reasons we can get here, some error happened + * or the user triggered failover. + */ switch (failover_get_state()) { - case FAILOVER_STATUS_NONE: - qapi_event_send_colo_exit(COLO_MODE_SECONDARY, - COLO_EXIT_REASON_ERROR); - break; case FAILOVER_STATUS_COMPLETED: qapi_event_send_colo_exit(COLO_MODE_SECONDARY, COLO_EXIT_REASON_REQUEST); break; default: - abort(); + qapi_event_send_colo_exit(COLO_MODE_SECONDARY, + COLO_EXIT_REASON_ERROR); } =20 if (fb) { diff --git a/qapi/migration.json b/qapi/migration.json index 0a85aadd15..e383951765 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1038,19 +1038,22 @@ ## # @COLOExitReason: # -# The reason for a COLO exit +# The reason for a COLO exit. # -# @none: no failover has ever happened. This can't occur in the -# COLO_EXIT event, only in the result of query-colo-status. +# @none: failover has never happened. This state does not occur +# in the COLO_EXIT event, and is only visible in the result of +# query-colo-status. # -# @request: COLO exit is due to an external request +# @request: COLO exit is due to an external request. # -# @error: COLO exit is due to an internal error +# @error: COLO exit is due to an internal error. +# +# @processing: COLO is currently handling a failover (since 4.0). # # Since: 3.1 ## { 'enum': 'COLOExitReason', - 'data': [ 'none', 'request', 'error' ] } + 'data': [ 'none', 'request', 'error' , 'processing' ] } =20 ## # @x-colo-lost-heartbeat: --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537152286746.7644101780822; Mon, 25 Mar 2019 11:05:52 -0700 (PDT) Received: from localhost ([127.0.0.1]:46307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tyk-0006Q2-8w for importer@patchew.org; Mon, 25 Mar 2019 14:05:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq3-0007Kw-OE for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Tj1-0005eq-It for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57602) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8Tj1-0005eX-Cl for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD7DEC05CDFA; Mon, 25 Mar 2019 17:49:30 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E6CC9052D; Mon, 25 Mar 2019 17:49:26 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:04 +0100 Message-Id: <20190325174706.6741-14-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 25 Mar 2019 17:49:30 +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 13/15] Migration/colo.c: Add the necessary checks for colo_do_failover 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: zhanghailiang , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Zhang Chen Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index dbe2b88807..d1ae2e6d11 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -197,10 +197,16 @@ void colo_do_failover(MigrationState *s) vm_stop_force_state(RUN_STATE_COLO); } =20 - if (get_colo_mode() =3D=3D COLO_MODE_PRIMARY) { + switch (get_colo_mode()) { + case COLO_MODE_PRIMARY: primary_vm_do_failover(); - } else { + break; + case COLO_MODE_SECONDARY: secondary_vm_do_failover(); + break; + default: + error_report("colo_do_failover failed because the colo mode" + " could not be obtained"); } } =20 --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553537072146919.6378455106229; Mon, 25 Mar 2019 11:04:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:46289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8TxL-00052h-4V for importer@patchew.org; Mon, 25 Mar 2019 14:04:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq3-0007RH-JX for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8TjB-0005hx-Uw for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4477) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TjB-0005hg-M8 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:49:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF9DF81224; Mon, 25 Mar 2019 17:49:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1335490A13; Mon, 25 Mar 2019 17:49:30 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:05 +0100 Message-Id: <20190325174706.6741-15-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 25 Mar 2019 17:49:41 +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 14/15] Migration/colo.c: Make user obtain the last COLO mode info after failover 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: zhanghailiang , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Zhang Chen Add the last_colo_mode to save the status after failover. This patch can solve the issue that user want to get last colo mode use query_colo_status after failover. Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/colo.c | 16 ++++++++++++++++ qapi/migration.json | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/migration/colo.c b/migration/colo.c index d1ae2e6d11..238a6d62c7 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -38,6 +38,9 @@ static bool vmstate_loading; static Notifier packets_compare_notifier; =20 +/* User need to know colo mode after COLO failover */ +static COLOMode last_colo_mode; + #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024) =20 bool migration_in_colo_state(void) @@ -264,6 +267,7 @@ COLOStatus *qmp_query_colo_status(Error **errp) COLOStatus *s =3D g_new0(COLOStatus, 1); =20 s->mode =3D get_colo_mode(); + s->last_mode =3D last_colo_mode; =20 switch (failover_get_state()) { case FAILOVER_STATUS_NONE: @@ -515,6 +519,12 @@ static void colo_process_checkpoint(MigrationState *s) Error *local_err =3D NULL; int ret; =20 + last_colo_mode =3D get_colo_mode(); + if (last_colo_mode !=3D COLO_MODE_PRIMARY) { + error_report("COLO mode must be COLO_MODE_PRIMARY"); + return; + } + failover_init_state(); =20 s->rp_state.from_dst_file =3D qemu_file_get_return_path(s->to_dst_file= ); @@ -688,6 +698,12 @@ void *colo_process_incoming_thread(void *opaque) migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); =20 + last_colo_mode =3D get_colo_mode(); + if (last_colo_mode !=3D COLO_MODE_SECONDARY) { + error_report("COLO mode must be COLO_MODE_SECONDARY"); + return NULL; + } + failover_init_state(); =20 mis->to_src_file =3D qemu_file_get_return_path(mis->from_src_file); diff --git a/qapi/migration.json b/qapi/migration.json index e383951765..cfde29acf8 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1380,12 +1380,17 @@ # @mode: COLO running mode. If COLO is running, this field will return # 'primary' or 'secondary'. # +# @last_mode: COLO last running mode. If COLO is running, this field +# will return same like mode field, after failover we can +# use this field to get last colo mode. (since 4.1) +# # @reason: describes the reason for the COLO exit. # # Since: 3.1 ## { 'struct': 'COLOStatus', - 'data': { 'mode': 'COLOMode', 'reason': 'COLOExitReason' } } + 'data': { 'mode': 'COLOMode', 'last_mode': 'COLOMode', + 'reason': 'COLOExitReason' } } =20 ## # @query-colo-status: --=20 2.20.1 From nobody Fri May 17 07:55:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553536891086551.0568895743745; Mon, 25 Mar 2019 11:01:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:46266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tua-0002v1-3p for importer@patchew.org; Mon, 25 Mar 2019 14:01:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8Tq2-0007Kw-Ix for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:56:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8Tja-0005qe-52 for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:50:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43645) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8TjZ-0005qB-UP for qemu-devel@nongnu.org; Mon, 25 Mar 2019 13:50:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 373E33098557; Mon, 25 Mar 2019 17:50:05 +0000 (UTC) Received: from localhost.localdomain (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EE0D909E7; Mon, 25 Mar 2019 17:49:41 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2019 18:47:06 +0100 Message-Id: <20190325174706.6741-16-quintela@redhat.com> In-Reply-To: <20190325174706.6741-1-quintela@redhat.com> References: <20190325174706.6741-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 25 Mar 2019 17:50: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 15/15] migration/postcopy: Update the bandwidth during postcopy 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: Markus Armbruster , Juan Quintela , "Dr. David Alan Gilbert" , zhanghailiang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" The recently added max-postcopy-bandwidth parameter is only read at the transition from precopy->postcopy where as the older max-bandwidth parameter updates the migration bandwidth when changed even if the migration is already running. Fix this discrepency so that: a) You can change the bandwidth during postcopy by setting max-postcopy-bandwidth b) Changing max-bandwidth during postcopy has no effect (it currently changes the postcopy bandwidth which isn't expected). Fixes: 7e555c6c bz: https://bugzilla.redhat.com/show_bug.cgi?id=3D1686321 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index d5c218a22b..69f75124c9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1341,7 +1341,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) =20 if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file) { + if (s->to_dst_file && !migration_in_postcopy()) { qemu_file_set_rate_limit(s->to_dst_file, s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); } @@ -1370,6 +1370,10 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) } if (params->has_max_postcopy_bandwidth) { s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; + if (s->to_dst_file && migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); + } } if (params->has_max_cpu_throttle) { s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; --=20 2.20.1