From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643395787202983.7927556856076; Fri, 28 Jan 2022 10:49:47 -0800 (PST) Received: from localhost ([::1]:48044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWJd-0003Uu-UQ for importer@patchew.org; Fri, 28 Jan 2022 13:49:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW3k-0004RG-OZ for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:33:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW3f-0000uu-5q for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:33:19 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-8WezpSgYPbSKznNzGUdN0Q-1; Fri, 28 Jan 2022 13:33:09 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2944810247B1; Fri, 28 Jan 2022 18:33:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7092277472; Fri, 28 Jan 2022 18:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dSJDJ/uTmwSJ4RdPNgFLHa0xMl2gTxmT2BAl0JEJoTU=; b=dxeSyU02QoTuCdhFV/vWXaDQRXkt6R2wGK0wepNxmnmvpiEIAyRNpup2eohgufctFC0tO0 W/6J/4MqXITZKYUQ4S+PRMsM9XNR3VrMNadNFZ8e/eTQjcRkmRg5C5n2XflZokeLMZChM5 Hp3SyzSar3HvOmCo2Otiv31/SiIhrkk= X-MC-Unique: 8WezpSgYPbSKznNzGUdN0Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 01/36] migration: All this fields are unsigned Date: Fri, 28 Jan 2022 19:29:58 +0100 Message-Id: <20220128183033.31998-2-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643395789064100001 So printing it as %d is wrong. Notice that for the channel id, that is an uint8_t, but I changed it anyways for consistency. Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu --- migration/multifd-zlib.c | 20 ++++++++++---------- migration/multifd-zstd.c | 24 ++++++++++++------------ migration/multifd.c | 16 ++++++++-------- migration/trace-events | 26 +++++++++++++------------- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index da6201704c..9f6ebf1076 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -51,7 +51,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **= errp) zs->opaque =3D Z_NULL; if (deflateInit(zs, migrate_multifd_zlib_level()) !=3D Z_OK) { g_free(z); - error_setg(errp, "multifd %d: deflate init failed", p->id); + error_setg(errp, "multifd %u: deflate init failed", p->id); return -1; } /* To be safe, we reserve twice the size of the packet */ @@ -60,7 +60,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **= errp) if (!z->zbuff) { deflateEnd(&z->zs); g_free(z); - error_setg(errp, "multifd %d: out of memory for zbuff", p->id); + error_setg(errp, "multifd %u: out of memory for zbuff", p->id); return -1; } p->data =3D z; @@ -132,12 +132,12 @@ static int zlib_send_prepare(MultiFDSendParams *p, Er= ror **errp) ret =3D deflate(zs, flush); } while (ret =3D=3D Z_OK && zs->avail_in && zs->avail_out); if (ret =3D=3D Z_OK && zs->avail_in) { - error_setg(errp, "multifd %d: deflate failed to compress all i= nput", + error_setg(errp, "multifd %u: deflate failed to compress all i= nput", p->id); return -1; } if (ret !=3D Z_OK) { - error_setg(errp, "multifd %d: deflate returned %d instead of Z= _OK", + error_setg(errp, "multifd %u: deflate returned %d instead of Z= _OK", p->id, ret); return -1; } @@ -190,7 +190,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error = **errp) zs->avail_in =3D 0; zs->next_in =3D Z_NULL; if (inflateInit(zs) !=3D Z_OK) { - error_setg(errp, "multifd %d: inflate init failed", p->id); + error_setg(errp, "multifd %u: inflate init failed", p->id); return -1; } /* To be safe, we reserve twice the size of the packet */ @@ -198,7 +198,7 @@ static int zlib_recv_setup(MultiFDRecvParams *p, Error = **errp) z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { inflateEnd(zs); - error_setg(errp, "multifd %d: out of memory for zbuff", p->id); + error_setg(errp, "multifd %u: out of memory for zbuff", p->id); return -1; } return 0; @@ -247,7 +247,7 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) int i; =20 if (flags !=3D MULTIFD_FLAG_ZLIB) { - error_setg(errp, "multifd %d: flags received %x flags expected %x", + error_setg(errp, "multifd %u: flags received %x flags expected %x", p->id, flags, MULTIFD_FLAG_ZLIB); return -1; } @@ -284,19 +284,19 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Erro= r **errp) } while (ret =3D=3D Z_OK && zs->avail_in && (zs->total_out - start) < page_size); if (ret =3D=3D Z_OK && (zs->total_out - start) < page_size) { - error_setg(errp, "multifd %d: inflate generated too few output= ", + error_setg(errp, "multifd %u: inflate generated too few output= ", p->id); return -1; } if (ret !=3D Z_OK) { - error_setg(errp, "multifd %d: inflate returned %d instead of Z= _OK", + error_setg(errp, "multifd %u: inflate returned %d instead of Z= _OK", p->id, ret); return -1; } } out_size =3D zs->total_out - out_size; if (out_size !=3D expected_size) { - error_setg(errp, "multifd %d: packet size received %d size expecte= d %d", + error_setg(errp, "multifd %u: packet size received %u size expecte= d %u", p->id, out_size, expected_size); return -1; } diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 2d5b61106c..cc4e991724 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -55,7 +55,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) z->zcs =3D ZSTD_createCStream(); if (!z->zcs) { g_free(z); - error_setg(errp, "multifd %d: zstd createCStream failed", p->id); + error_setg(errp, "multifd %u: zstd createCStream failed", p->id); return -1; } =20 @@ -63,7 +63,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) if (ZSTD_isError(res)) { ZSTD_freeCStream(z->zcs); g_free(z); - error_setg(errp, "multifd %d: initCStream failed with error %s", + error_setg(errp, "multifd %u: initCStream failed with error %s", p->id, ZSTD_getErrorName(res)); return -1; } @@ -73,7 +73,7 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) if (!z->zbuff) { ZSTD_freeCStream(z->zcs); g_free(z); - error_setg(errp, "multifd %d: out of memory for zbuff", p->id); + error_setg(errp, "multifd %u: out of memory for zbuff", p->id); return -1; } return 0; @@ -144,12 +144,12 @@ static int zstd_send_prepare(MultiFDSendParams *p, Er= ror **errp) } while (ret > 0 && (z->in.size - z->in.pos > 0) && (z->out.size - z->out.pos > 0)); if (ret > 0 && (z->in.size - z->in.pos > 0)) { - error_setg(errp, "multifd %d: compressStream buffer too small", + error_setg(errp, "multifd %u: compressStream buffer too small", p->id); return -1; } if (ZSTD_isError(ret)) { - error_setg(errp, "multifd %d: compressStream error %s", + error_setg(errp, "multifd %u: compressStream error %s", p->id, ZSTD_getErrorName(ret)); return -1; } @@ -198,7 +198,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error = **errp) z->zds =3D ZSTD_createDStream(); if (!z->zds) { g_free(z); - error_setg(errp, "multifd %d: zstd createDStream failed", p->id); + error_setg(errp, "multifd %u: zstd createDStream failed", p->id); return -1; } =20 @@ -206,7 +206,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error = **errp) if (ZSTD_isError(ret)) { ZSTD_freeDStream(z->zds); g_free(z); - error_setg(errp, "multifd %d: initDStream failed with error %s", + error_setg(errp, "multifd %u: initDStream failed with error %s", p->id, ZSTD_getErrorName(ret)); return -1; } @@ -217,7 +217,7 @@ static int zstd_recv_setup(MultiFDRecvParams *p, Error = **errp) if (!z->zbuff) { ZSTD_freeDStream(z->zds); g_free(z); - error_setg(errp, "multifd %d: out of memory for zbuff", p->id); + error_setg(errp, "multifd %u: out of memory for zbuff", p->id); return -1; } return 0; @@ -265,7 +265,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) int i; =20 if (flags !=3D MULTIFD_FLAG_ZSTD) { - error_setg(errp, "multifd %d: flags received %x flags expected %x", + error_setg(errp, "multifd %u: flags received %x flags expected %x", p->id, flags, MULTIFD_FLAG_ZSTD); return -1; } @@ -297,19 +297,19 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Erro= r **errp) } while (ret > 0 && (z->in.size - z->in.pos > 0) && (z->out.pos < page_size)); if (ret > 0 && (z->out.pos < page_size)) { - error_setg(errp, "multifd %d: decompressStream buffer too smal= l", + error_setg(errp, "multifd %u: decompressStream buffer too smal= l", p->id); return -1; } if (ZSTD_isError(ret)) { - error_setg(errp, "multifd %d: decompressStream returned %s", + error_setg(errp, "multifd %u: decompressStream returned %s", p->id, ZSTD_getErrorName(ret)); return ret; } out_size +=3D z->out.pos; } if (out_size !=3D expected_size) { - error_setg(errp, "multifd %d: packet size received %d size expecte= d %d", + error_setg(errp, "multifd %u: packet size received %u size expecte= d %u", p->id, out_size, expected_size); return -1; } diff --git a/migration/multifd.c b/migration/multifd.c index 3242f688e5..4d62850258 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -148,7 +148,7 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, Erro= r **errp) uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; =20 if (flags !=3D MULTIFD_FLAG_NOCOMP) { - error_setg(errp, "multifd %d: flags received %x flags expected %x", + error_setg(errp, "multifd %u: flags received %x flags expected %x", p->id, flags, MULTIFD_FLAG_NOCOMP); return -1; } @@ -212,8 +212,8 @@ static int multifd_recv_initial_packet(QIOChannel *c, E= rror **errp) } =20 if (msg.version !=3D MULTIFD_VERSION) { - error_setg(errp, "multifd: received packet version %d " - "expected %d", msg.version, MULTIFD_VERSION); + error_setg(errp, "multifd: received packet version %u " + "expected %u", msg.version, MULTIFD_VERSION); return -1; } =20 @@ -229,8 +229,8 @@ static int multifd_recv_initial_packet(QIOChannel *c, E= rror **errp) } =20 if (msg.id > migrate_multifd_channels()) { - error_setg(errp, "multifd: received channel version %d " - "expected %d", msg.version, MULTIFD_VERSION); + error_setg(errp, "multifd: received channel version %u " + "expected %u", msg.version, MULTIFD_VERSION); return -1; } =20 @@ -303,7 +303,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) packet->version =3D be32_to_cpu(packet->version); if (packet->version !=3D MULTIFD_VERSION) { error_setg(errp, "multifd: received packet " - "version %d and expected version %d", + "version %u and expected version %u", packet->version, MULTIFD_VERSION); return -1; } @@ -317,7 +317,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) */ if (packet->pages_alloc > pages_max * 100) { error_setg(errp, "multifd: received packet " - "with size %d and expected a maximum size of %d", + "with size %u and expected a maximum size of %u", packet->pages_alloc, pages_max * 100) ; return -1; } @@ -333,7 +333,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) p->pages->num =3D be32_to_cpu(packet->pages_used); if (p->pages->num > packet->pages_alloc) { error_setg(errp, "multifd: received packet " - "with %d pages and expected maximum pages are %d", + "with %u pages and expected maximum pages are %u", p->pages->num, packet->pages_alloc) ; return -1; } diff --git a/migration/trace-events b/migration/trace-events index b48d873b8a..5172cb3b3d 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -115,23 +115,23 @@ ram_write_tracking_ramblock_start(const char *block_i= d, size_t page_size, void * ram_write_tracking_ramblock_stop(const char *block_id, size_t page_size, v= oid *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu" =20 # multifd.c -multifd_new_send_channel_async(uint8_t id) "channel %d" -multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" -multifd_recv_new_channel(uint8_t id) "channel %d" +multifd_new_send_channel_async(uint8_t id) "channel %u" +multifd_recv(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u f= lags 0x%x next packet size %u" +multifd_recv_new_channel(uint8_t id) "channel %u" 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_sync_main_signal(uint8_t id) "channel %u" +multifd_recv_sync_main_wait(uint8_t id) "channel %u" multifd_recv_terminate_threads(bool error) "error %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, uint32_t next_packet_size) "channel %d packet_num %" PRIu64 " pages %d f= lags 0x%x next packet size %d" -multifd_send_error(uint8_t id) "channel %d" +multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %u packets %" PRIu64 " pages %" PRIu64 +multifd_recv_thread_start(uint8_t id) "%u" +multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u f= lags 0x%x next packet size %u" +multifd_send_error(uint8_t id) "channel %u" 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" +multifd_send_sync_main_signal(uint8_t id) "channel %u" +multifd_send_sync_main_wait(uint8_t id) "channel %u" multifd_send_terminate_threads(bool error) "error %d" -multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %d packets %" PRIu64 " pages %" PRIu64 -multifd_send_thread_start(uint8_t id) "%d" +multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %u packets %" PRIu64 " pages %" PRIu64 +multifd_send_thread_start(uint8_t id) "%u" multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *ho= stname) "ioc=3D%p tioc=3D%p hostname=3D%s" multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=3D%p= err=3D%s" multifd_tls_outgoing_handshake_complete(void *ioc) "ioc=3D%p" --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643395888362938.7360603236964; Fri, 28 Jan 2022 10:51:28 -0800 (PST) Received: from localhost ([::1]:49720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWLH-0004ew-Jz for importer@patchew.org; Fri, 28 Jan 2022 13:51:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46560) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW4L-00050u-AM for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:33:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW4H-0000xl-Ea for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:33:56 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-GqyUe1THOjmiqWE_RUx1rw-1; Fri, 28 Jan 2022 13:33:45 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A66201091DA0; Fri, 28 Jan 2022 18:33:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C8A377466; Fri, 28 Jan 2022 18:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CQbBtcOQQqTGlmVLcvaCYCTmSqbpaVikGchlkLKdfGo=; b=QAjoW4SDv7V368vg4HPo3JVocg2Awo8EkybHA4x+lLfxyKyzM33eRjEmMujecPUKKx8OBw NEOzt0n2795a2R0Ul7tcu79eiVGMz+no3jdD875CRxbuZIg8wkuzA1hsTdZDkMJTk1fF2N yvw/zkqLH8uOLhM1WNbfug7JXbokmZs= X-MC-Unique: GqyUe1THOjmiqWE_RUx1rw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 02/36] migration: We only need last_stage in two places Date: Fri, 28 Jan 2022 19:29:59 +0100 Message-Id: <20220128183033.31998-3-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643395890382100001 Content-Type: text/plain; charset="utf-8" We only need last_stage in two places and we are passing it all around. Just add a field to RAMState that passes it. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- Repeat subject (philmd suggestion) --- migration/ram.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 57efa67f20..7223b0d8ca 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -325,7 +325,8 @@ struct RAMState { uint64_t xbzrle_bytes_prev; /* Start using XBZRLE (e.g., after the first round). */ bool xbzrle_enabled; - + /* Are we on the last stage of migration */ + bool last_stage; /* compression statistics since the beginning of the period */ /* amount of count that no free thread to compress data */ uint64_t compress_thread_busy_prev; @@ -683,11 +684,10 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_= addr_t current_addr) * @current_addr: addr of the page * @block: block that contains the page we want to send * @offset: offset inside the block for the page - * @last_stage: if we are at the completion stage */ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data, ram_addr_t current_addr, RAMBlock *block, - ram_addr_t offset, bool last_stage) + ram_addr_t offset) { int encoded_len =3D 0, bytes_xbzrle; uint8_t *prev_cached_page; @@ -695,7 +695,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **cur= rent_data, if (!cache_is_cached(XBZRLE.cache, current_addr, ram_counters.dirty_sync_count)) { xbzrle_counters.cache_miss++; - if (!last_stage) { + if (!rs->last_stage) { if (cache_insert(XBZRLE.cache, current_addr, *current_data, ram_counters.dirty_sync_count) =3D=3D -1) { return -1; @@ -734,7 +734,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **cur= rent_data, * Update the cache contents, so that it corresponds to the data * sent, in all cases except where we skip the page. */ - if (!last_stage && encoded_len !=3D 0) { + if (!rs->last_stage && encoded_len !=3D 0) { memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE); /* * In the case where we couldn't compress, ensure that the caller @@ -1290,9 +1290,8 @@ static int save_normal_page(RAMState *rs, RAMBlock *b= lock, ram_addr_t offset, * @rs: current RAM state * @block: block that contains the page we want to send * @offset: offset inside the block for the page - * @last_stage: if we are at the completion stage */ -static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_st= age) +static int ram_save_page(RAMState *rs, PageSearchStatus *pss) { int pages =3D -1; uint8_t *p; @@ -1307,8 +1306,8 @@ static int ram_save_page(RAMState *rs, PageSearchStat= us *pss, bool last_stage) XBZRLE_cache_lock(); if (rs->xbzrle_enabled && !migration_in_postcopy()) { pages =3D save_xbzrle_page(rs, &p, current_addr, block, - offset, last_stage); - if (!last_stage) { + offset); + if (!rs->last_stage) { /* Can't send this cached data async, since the cache page * might get updated before it gets to the wire */ @@ -2129,10 +2128,8 @@ static bool save_compress_page(RAMState *rs, RAMBloc= k *block, ram_addr_t offset) * * @rs: current RAM state * @pss: data about the page we want to send - * @last_stage: if we are at the completion stage */ -static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss, - bool last_stage) +static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss) { RAMBlock *block =3D pss->block; ram_addr_t offset =3D ((ram_addr_t)pss->page) << TARGET_PAGE_BITS; @@ -2171,7 +2168,7 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss, return ram_save_multifd_page(rs, block, offset); } =20 - return ram_save_page(rs, pss, last_stage); + return ram_save_page(rs, pss); } =20 /** @@ -2190,10 +2187,8 @@ static int ram_save_target_page(RAMState *rs, PageSe= archStatus *pss, * @rs: current RAM state * @ms: current migration state * @pss: data about the page we want to send - * @last_stage: if we are at the completion stage */ -static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss, - bool last_stage) +static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss) { int tmppages, pages =3D 0; size_t pagesize_bits =3D @@ -2211,7 +2206,7 @@ static int ram_save_host_page(RAMState *rs, PageSearc= hStatus *pss, do { /* Check the pages is dirty and if it is send it */ if (migration_bitmap_clear_dirty(rs, pss->block, pss->page)) { - tmppages =3D ram_save_target_page(rs, pss, last_stage); + tmppages =3D ram_save_target_page(rs, pss); if (tmppages < 0) { return tmppages; } @@ -2245,13 +2240,11 @@ static int ram_save_host_page(RAMState *rs, PageSea= rchStatus *pss, * or negative on error * * @rs: current RAM state - * @last_stage: if we are at the completion stage * * On systems where host-page-size > target-page-size it will send all the * pages in a host page that are dirty. */ - -static int ram_find_and_save_block(RAMState *rs, bool last_stage) +static int ram_find_and_save_block(RAMState *rs) { PageSearchStatus pss; int pages =3D 0; @@ -2280,7 +2273,7 @@ static int ram_find_and_save_block(RAMState *rs, bool= last_stage) } =20 if (found) { - pages =3D ram_save_host_page(rs, &pss, last_stage); + pages =3D ram_save_host_page(rs, &pss); } } while (!pages && again); =20 @@ -3080,7 +3073,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) break; } =20 - pages =3D ram_find_and_save_block(rs, false); + pages =3D ram_find_and_save_block(rs); /* no more pages to sent */ if (pages =3D=3D 0) { done =3D 1; @@ -3160,6 +3153,8 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) RAMState *rs =3D *temp; int ret =3D 0; =20 + rs->last_stage =3D !migration_in_colo_state(); + WITH_RCU_READ_LOCK_GUARD() { if (!migration_in_postcopy()) { migration_bitmap_sync_precopy(rs); @@ -3173,7 +3168,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) while (true) { int pages; =20 - pages =3D ram_find_and_save_block(rs, !migration_in_colo_state= ()); + pages =3D ram_find_and_save_block(rs); /* no more blocks to sent */ if (pages =3D=3D 0) { break; --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396386586691.3795287275836; Fri, 28 Jan 2022 10:59:46 -0800 (PST) Received: from localhost ([::1]:59838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWTJ-0003Z5-NI for importer@patchew.org; Fri, 28 Jan 2022 13:59:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW4y-00060X-KY for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20028) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW4u-0000zu-8r for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:35 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-GfER6vquOru4fY8i6hW3bw-1; Fri, 28 Jan 2022 13:34:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EEFD08145E3; Fri, 28 Jan 2022 18:34:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D36577456; Fri, 28 Jan 2022 18:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394870; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=syFXxyGdhAjBvrZKloq+h67n4Bh70w3cQDix8C8UCRo=; b=QcHlmfZJQtkyI2VsVtI0RAo1WTrBgFPbYIP27V2Wbgka3zbFRQ9HXtgfy/ELeR2DV9wQzn RL6j6n0tn1zyn0LFXZeNnrujb6eboAXjn0NSE5JkjQPPmZPsbkYuzid8cUut5Bj5lspkSB sewLhuODJEDv9t9dLvVMEm1QLhfvwV8= X-MC-Unique: GfER6vquOru4fY8i6hW3bw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 03/36] migration: ram_release_pages() always receive 1 page as argument Date: Fri, 28 Jan 2022 19:30:00 +0100 Message-Id: <20220128183033.31998-4-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396388104100001 Remove the pages argument. And s/pages/page/ Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu --- - Use 1LL instead of casts (philmd) - Change the whole 1ULL for TARGET_PAGE_SIZE --- migration/ram.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 7223b0d8ca..881fe4974e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1204,13 +1204,13 @@ static int save_zero_page(RAMState *rs, RAMBlock *b= lock, ram_addr_t offset) return -1; } =20 -static void ram_release_pages(const char *rbname, uint64_t offset, int pag= es) +static void ram_release_page(const char *rbname, uint64_t offset) { if (!migrate_release_ram() || !migration_in_postcopy()) { return; } =20 - ram_discard_range(rbname, offset, ((ram_addr_t)pages) << TARGET_PAGE_B= ITS); + ram_discard_range(rbname, offset, TARGET_PAGE_SIZE); } =20 /* @@ -1365,7 +1365,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_strea= m *stream, RAMBlock *block, } =20 exit: - ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1); + ram_release_page(block->idstr, offset & TARGET_PAGE_MASK); return zero_page; } =20 @@ -2153,7 +2153,7 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss) xbzrle_cache_zero_page(rs, block->offset + offset); XBZRLE_cache_unlock(); } - ram_release_pages(block->idstr, offset, res); + ram_release_page(block->idstr, offset); return res; } =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396499969264.1322785330725; Fri, 28 Jan 2022 11:01:39 -0800 (PST) Received: from localhost ([::1]:32946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWV9-0004VA-7T for importer@patchew.org; Fri, 28 Jan 2022 14:01:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW52-00061V-Jz for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW50-00011f-DA for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:39 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-365-UsE-1SVuNyKpvARn1oZQnQ-1; Fri, 28 Jan 2022 13:34:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3380410247B3; Fri, 28 Jan 2022 18:34:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65CB077456; Fri, 28 Jan 2022 18:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5o5+Uy+nSbU+g6blyt47oDcPek9P+sPcAYJJ1/b41c0=; b=IzEH+R2kxqgrmq7+TZ2iWLwaRfoii+2ZfUysU7GqSihi0+d27BUv1CsSYPetjnyJafTXgz 6mhGCvw+iDXMGzCegBIlvVn6+OgkQwGHByUu6gFn9ZYRzrnv+mrK8VzI7zr6uMMFVGpq2u /lhdrq1PK6dhNmvp2DfEtomuetFMpaA= X-MC-Unique: UsE-1SVuNyKpvARn1oZQnQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 04/36] migration: Remove masking for compression Date: Fri, 28 Jan 2022 19:30:01 +0100 Message-Id: <20220128183033.31998-5-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396503333100001 Content-Type: text/plain; charset="utf-8" Remove the mask in the call to ram_release_pages(). Nothing else does it, and if the offset has that bits set, we have a lot of trouble. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 881fe4974e..fa49d22e69 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1340,7 +1340,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_strea= m *stream, RAMBlock *block, ram_addr_t offset, uint8_t *source_buf) { RAMState *rs =3D ram_state; - uint8_t *p =3D block->host + (offset & TARGET_PAGE_MASK); + uint8_t *p =3D block->host + offset; bool zero_page =3D false; int ret; =20 @@ -1365,7 +1365,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_strea= m *stream, RAMBlock *block, } =20 exit: - ram_release_page(block->idstr, offset & TARGET_PAGE_MASK); + ram_release_page(block->idstr, offset); return zero_page; } =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396788526967.4540239611056; Fri, 28 Jan 2022 11:06:28 -0800 (PST) Received: from localhost ([::1]:42738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWZn-0002v7-KX for importer@patchew.org; Fri, 28 Jan 2022 14:06:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5E-00068q-QZ for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW59-000136-Pu for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-74-cg4pu1jpNEGZwPsMc3yHnA-1; Fri, 28 Jan 2022 13:34:41 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6CE1C8145E0; Fri, 28 Jan 2022 18:34:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D62177456; Fri, 28 Jan 2022 18:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTuNu9HO4jPGub59vmHdns8TqyGd7V+63Di/4oQVtOQ=; b=KBFghhJhbrikm4yK1t2RylcJ2c2k8Sww/cSi0LADIr4gTDq02Pa/EiBKpQVNSzyvnwF8xU jW0TurW34a9tCdSI91bGruBOkXbE9K66Vub8Sev2e7TJgv6zXbPAEQ7N/IOBJfk8PneP59 NJkr4B5qeWMKIxYGI6wJnW5DHtjA37g= X-MC-Unique: cg4pu1jpNEGZwPsMc3yHnA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 05/36] migration: simplify do_compress_ram_page Date: Fri, 28 Jan 2022 19:30:02 +0100 Message-Id: <20220128183033.31998-6-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396791029100001 Content-Type: text/plain; charset="utf-8" The goto is not needed at all. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index fa49d22e69..422c6bce28 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1341,12 +1341,11 @@ static bool do_compress_ram_page(QEMUFile *f, z_str= eam *stream, RAMBlock *block, { RAMState *rs =3D ram_state; uint8_t *p =3D block->host + offset; - bool zero_page =3D false; int ret; =20 if (save_zero_page_to_file(rs, f, block, offset)) { - zero_page =3D true; - goto exit; + ram_release_page(block->idstr, offset); + return true; } =20 save_page_header(rs, f, block, offset | RAM_SAVE_FLAG_COMPRESS_PAGE); @@ -1361,12 +1360,8 @@ static bool do_compress_ram_page(QEMUFile *f, z_stre= am *stream, RAMBlock *block, if (ret < 0) { qemu_file_set_error(migrate_get_current()->to_dst_file, ret); error_report("compressed data failed!"); - return false; } - -exit: - ram_release_page(block->idstr, offset); - return zero_page; + return false; } =20 static void --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643395735021680.4006542725738; Fri, 28 Jan 2022 10:48:55 -0800 (PST) Received: from localhost ([::1]:47138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWIn-0002iF-Cs for importer@patchew.org; Fri, 28 Jan 2022 13:48:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5I-0006Hs-AJ for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5F-00014S-WB for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:34:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-xfysPz-mOni20Nwe28SDvw-1; Fri, 28 Jan 2022 13:34:48 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FC9783DD20; Fri, 28 Jan 2022 18:34:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDB0977456; Fri, 28 Jan 2022 18:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1khIyfNNFWc9VNX4/2nGIMdiIvZ8naJgz6DXohUCbMM=; b=IUTNNYUjf9EE2lr6cphwGnyBDM1fIYKWTryjFZA7gCYjS/7IXhuXW0fL05doE7CYvN9Vuu QoXJ7aRpdYrDTCRwpXQz805H5oT/FCwOGmJQQejn/K24AfArNl4flnI+C8LWk5yWQPSzkr y/bx+mD18mvqLORRCRAjPKpZ3gE4eto= X-MC-Unique: xfysPz-mOni20Nwe28SDvw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 06/36] migration: Move ram_release_pages() call to save_zero_page_to_file() Date: Fri, 28 Jan 2022 19:30:03 +0100 Message-Id: <20220128183033.31998-7-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643395738599100001 Content-Type: text/plain; charset="utf-8" We always need to call it when we find a zero page, so put it in a single place. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 422c6bce28..e9dcd3ca4e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1158,6 +1158,15 @@ static void migration_bitmap_sync_precopy(RAMState *= rs) } } =20 +static void ram_release_page(const char *rbname, uint64_t offset) +{ + if (!migrate_release_ram() || !migration_in_postcopy()) { + return; + } + + ram_discard_range(rbname, offset, TARGET_PAGE_SIZE); +} + /** * save_zero_page_to_file: send the zero page to the file * @@ -1179,6 +1188,7 @@ static int save_zero_page_to_file(RAMState *rs, QEMUF= ile *file, len +=3D save_page_header(rs, file, block, offset | RAM_SAVE_FLAG_= ZERO); qemu_put_byte(file, 0); len +=3D 1; + ram_release_page(block->idstr, offset); } return len; } @@ -1204,15 +1214,6 @@ static int save_zero_page(RAMState *rs, RAMBlock *bl= ock, ram_addr_t offset) return -1; } =20 -static void ram_release_page(const char *rbname, uint64_t offset) -{ - if (!migrate_release_ram() || !migration_in_postcopy()) { - return; - } - - ram_discard_range(rbname, offset, TARGET_PAGE_SIZE); -} - /* * @pages: the number of pages written by the control path, * < 0 - error @@ -1344,7 +1345,6 @@ static bool do_compress_ram_page(QEMUFile *f, z_strea= m *stream, RAMBlock *block, int ret; =20 if (save_zero_page_to_file(rs, f, block, offset)) { - ram_release_page(block->idstr, offset); return true; } =20 @@ -2148,7 +2148,6 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss) xbzrle_cache_zero_page(rs, block->offset + offset); XBZRLE_cache_unlock(); } - ram_release_page(block->idstr, offset); return res; } =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396294272310.597655144266; Fri, 28 Jan 2022 10:58:14 -0800 (PST) Received: from localhost ([::1]:55718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWRm-0000d8-Rm for importer@patchew.org; Fri, 28 Jan 2022 13:58:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5M-0006Ww-TK for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:35:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5L-00016m-7x for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:35:00 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-1DMKKBn8P7aNa8tZOoPBmA-1; Fri, 28 Jan 2022 13:34:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF0BA46860; Fri, 28 Jan 2022 18:34:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D04E77462; Fri, 28 Jan 2022 18:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pz99tNvL7SD24ZVrXlUQbIGHejdSEY2Mt5qK9/NKCeE=; b=aWrrv8Ix/qOISOAyd2e1LRcRvVyLEOafKspEpFOponPTmEdvaJikoE8qUmaJ9im82AURZz 7hpJZvuVn9FQnKIJ34nOzeZ46zkQ5hedJiBwjThICqa3UIQVKjHwDVFpxWqloyjA7hmVtK /6V+qHBVAlX1AoE+imF6msb2FxOEwCA= X-MC-Unique: 1DMKKBn8P7aNa8tZOoPBmA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 07/36] multifd: Use proper maximum compression values Date: Fri, 28 Jan 2022 19:30:04 +0100 Message-Id: <20220128183033.31998-8-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396295493100001 Content-Type: text/plain; charset="utf-8" It happens that there are functions to calculate the worst possible compression size for a packet. Use them. Suggested-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zlib.c | 4 ++-- migration/multifd-zstd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 9f6ebf1076..a2fec4d01d 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -54,8 +54,8 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **= errp) error_setg(errp, "multifd %u: deflate init failed", p->id); return -1; } - /* To be safe, we reserve twice the size of the packet */ - z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; + /* This is the maxium size of the compressed buffer */ + z->zbuff_len =3D compressBound(MULTIFD_PACKET_SIZE); z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { deflateEnd(&z->zs); diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index cc4e991724..97c08367d0 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -67,8 +67,8 @@ static int zstd_send_setup(MultiFDSendParams *p, Error **= errp) p->id, ZSTD_getErrorName(res)); return -1; } - /* To be safe, we reserve twice the size of the packet */ - z->zbuff_len =3D MULTIFD_PACKET_SIZE * 2; + /* This is the maxium size of the compressed buffer */ + z->zbuff_len =3D ZSTD_compressBound(MULTIFD_PACKET_SIZE); z->zbuff =3D g_try_malloc(z->zbuff_len); if (!z->zbuff) { ZSTD_freeCStream(z->zcs); --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396611632393.9033691952245; Fri, 28 Jan 2022 11:03:31 -0800 (PST) Received: from localhost ([::1]:37706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWWu-0007xD-AU for importer@patchew.org; Fri, 28 Jan 2022 14:03:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6L-0006uv-Qb for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5V-0001Iu-Vx for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:35:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-634-Tmbh48aCMG6QNzvTwIkDWg-1; Fri, 28 Jan 2022 13:35:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 297C88145E2; Fri, 28 Jan 2022 18:35:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2529177456; Fri, 28 Jan 2022 18:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lODpZE2L1GHaonSf+2+fnU/rvw75u+yfcDBd8zVkNNs=; b=LmZ4HER3L8SCCNxuSpcgzzg14agURUXKW0+9KKSGzV4+XhQ29VpJ3hgr0IE+kmtkTS9WdY 7vAKcfxEoTCfGkJfOkb+GRllzNCMO1VBzxmAR0kK9ycsCLSXc1Nn5e3c/p6RPzjva3cwvz MgyKc9UljzwVuachmLwxFMs61AqzvX8= X-MC-Unique: Tmbh48aCMG6QNzvTwIkDWg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 08/36] multifd: Move iov from pages to params Date: Fri, 28 Jan 2022 19:30:05 +0100 Message-Id: <20220128183033.31998-9-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396614574100001 Content-Type: text/plain; charset="utf-8" This will allow us to reduce the number of system calls on the next patch. Signed-off-by: Juan Quintela --- migration/multifd.h | 8 ++++++-- migration/multifd.c | 34 ++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index e57adc783b..c3f18af364 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -62,8 +62,6 @@ typedef struct { uint64_t packet_num; /* offset of each page */ ram_addr_t *offset; - /* pointer to each page */ - struct iovec *iov; RAMBlock *block; } MultiFDPages_t; =20 @@ -110,6 +108,10 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* buffers to send */ + struct iovec *iov; + /* number of iovs used */ + uint32_t iovs_num; /* used for compression methods */ void *data; } MultiFDSendParams; @@ -149,6 +151,8 @@ typedef struct { uint64_t num_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; + /* buffers to recv */ + struct iovec *iov; /* used for de-compression methods */ void *data; } MultiFDRecvParams; diff --git a/migration/multifd.c b/migration/multifd.c index 4d62850258..f75bd3c188 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -86,7 +86,16 @@ static void nocomp_send_cleanup(MultiFDSendParams *p, Er= ror **errp) */ static int nocomp_send_prepare(MultiFDSendParams *p, Error **errp) { - p->next_packet_size =3D p->pages->num * qemu_target_page_size(); + MultiFDPages_t *pages =3D p->pages; + size_t page_size =3D qemu_target_page_size(); + + for (int i =3D 0; i < p->pages->num; i++) { + p->iov[p->iovs_num].iov_base =3D pages->block->host + pages->offse= t[i]; + p->iov[p->iovs_num].iov_len =3D page_size; + p->iovs_num++; + } + + p->next_packet_size =3D p->pages->num * page_size; p->flags |=3D MULTIFD_FLAG_NOCOMP; return 0; } @@ -104,7 +113,7 @@ static int nocomp_send_prepare(MultiFDSendParams *p, Er= ror **errp) */ static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error **= errp) { - return qio_channel_writev_all(p->c, p->pages->iov, used, errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); } =20 /** @@ -146,13 +155,18 @@ static void nocomp_recv_cleanup(MultiFDRecvParams *p) static int nocomp_recv_pages(MultiFDRecvParams *p, Error **errp) { uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; + size_t page_size =3D qemu_target_page_size(); =20 if (flags !=3D MULTIFD_FLAG_NOCOMP) { error_setg(errp, "multifd %u: flags received %x flags expected %x", p->id, flags, MULTIFD_FLAG_NOCOMP); return -1; } - return qio_channel_readv_all(p->c, p->pages->iov, p->pages->num, errp); + for (int i =3D 0; i < p->pages->num; i++) { + p->iov[i].iov_base =3D p->pages->block->host + p->pages->offset[i]; + p->iov[i].iov_len =3D page_size; + } + return qio_channel_readv_all(p->c, p->iov, p->pages->num, errp); } =20 static MultiFDMethods multifd_nocomp_ops =3D { @@ -242,7 +256,6 @@ static MultiFDPages_t *multifd_pages_init(size_t size) MultiFDPages_t *pages =3D g_new0(MultiFDPages_t, 1); =20 pages->allocated =3D size; - pages->iov =3D g_new0(struct iovec, size); pages->offset =3D g_new0(ram_addr_t, size); =20 return pages; @@ -254,8 +267,6 @@ static void multifd_pages_clear(MultiFDPages_t *pages) pages->allocated =3D 0; pages->packet_num =3D 0; pages->block =3D NULL; - g_free(pages->iov); - pages->iov =3D NULL; g_free(pages->offset); pages->offset =3D NULL; g_free(pages); @@ -365,8 +376,6 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } p->pages->offset[i] =3D offset; - p->pages->iov[i].iov_base =3D block->host + offset; - p->pages->iov[i].iov_len =3D page_size; } =20 return 0; @@ -470,8 +479,6 @@ int multifd_queue_page(QEMUFile *f, RAMBlock *block, ra= m_addr_t offset) =20 if (pages->block =3D=3D block) { pages->offset[pages->num] =3D offset; - pages->iov[pages->num].iov_base =3D block->host + offset; - pages->iov[pages->num].iov_len =3D qemu_target_page_size(); pages->num++; =20 if (pages->num < pages->allocated) { @@ -567,6 +574,8 @@ void multifd_save_cleanup(void) p->packet_len =3D 0; g_free(p->packet); p->packet =3D NULL; + g_free(p->iov); + p->iov =3D NULL; multifd_send_state->ops->send_cleanup(p, &local_err); if (local_err) { migrate_set_error(migrate_get_current(), local_err); @@ -654,6 +663,7 @@ static void *multifd_send_thread(void *opaque) uint32_t used =3D p->pages->num; uint64_t packet_num =3D p->packet_num; uint32_t flags =3D p->flags; + p->iovs_num =3D 0; =20 if (used) { ret =3D multifd_send_state->ops->send_prepare(p, &local_er= r); @@ -922,6 +932,7 @@ int multifd_save_setup(Error **errp) p->packet->version =3D cpu_to_be32(MULTIFD_VERSION); p->name =3D g_strdup_printf("multifdsend_%d", i); p->tls_hostname =3D g_strdup(s->hostname); + p->iov =3D g_new0(struct iovec, page_count); socket_send_channel_create(multifd_new_send_channel_async, p); } =20 @@ -1021,6 +1032,8 @@ int multifd_load_cleanup(Error **errp) p->packet_len =3D 0; g_free(p->packet); p->packet =3D NULL; + g_free(p->iov); + p->iov =3D NULL; multifd_recv_state->ops->recv_cleanup(p); } qemu_sem_destroy(&multifd_recv_state->sem_sync); @@ -1161,6 +1174,7 @@ int multifd_load_setup(Error **errp) + sizeof(uint64_t) * page_count; p->packet =3D g_malloc0(p->packet_len); p->name =3D g_strdup_printf("multifdrecv_%d", i); + p->iov =3D g_new0(struct iovec, page_count); } =20 for (i =3D 0; i < thread_count; i++) { --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643397278338838.9763645288988; Fri, 28 Jan 2022 11:14:38 -0800 (PST) Received: from localhost ([::1]:55444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWhh-0003uZ-77 for importer@patchew.org; Fri, 28 Jan 2022 14:14:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6S-0007CI-9k for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW5s-0001J6-GQ for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-202--1BV6RxBNb69LHY8LjrVqA-1; Fri, 28 Jan 2022 13:35:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49D4B18B613A; Fri, 28 Jan 2022 18:35:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83C1C77456; Fri, 28 Jan 2022 18:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bsKREreB4LgJFdMcSyHUcfhSCbtvvI69hXnQz2Aotak=; b=UmuPeXzuuGu0Z+X3nULzyorI0dhVwi1FlLtgGnqVLF8XmeRopR3VSyQczXTGiywaLv8+vB ZOTWqeKY5XpV5E6lTfbRfqFj1gFgpt7LxVNolehmFOotvJnFivZNQHcnIOy9HR66hDgpvM OSIyF6/j9C2/9xxHA4qSq73rvkbq4+o= X-MC-Unique: -1BV6RxBNb69LHY8LjrVqA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 09/36] multifd: Make zlib use iov's Date: Fri, 28 Jan 2022 19:30:06 +0100 Message-Id: <20220128183033.31998-10-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643397281342100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index a2fec4d01d..71480c82bb 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -143,6 +143,9 @@ static int zlib_send_prepare(MultiFDSendParams *p, Erro= r **errp) } out_size +=3D available - zs->avail_out; } + p->iov[p->iovs_num].iov_base =3D z->zbuff; + p->iov[p->iovs_num].iov_len =3D out_size; + p->iovs_num++; p->next_packet_size =3D out_size; p->flags |=3D MULTIFD_FLAG_ZLIB; =20 @@ -162,10 +165,7 @@ static int zlib_send_prepare(MultiFDSendParams *p, Err= or **errp) */ static int zlib_send_write(MultiFDSendParams *p, uint32_t used, Error **er= rp) { - struct zlib_data *z =3D p->data; - - return qio_channel_write_all(p->c, (void *)z->zbuff, p->next_packet_si= ze, - errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); } =20 /** --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 164339685386928.44400034726732; Fri, 28 Jan 2022 11:07:33 -0800 (PST) Received: from localhost ([::1]:44476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWar-00047O-4L for importer@patchew.org; Fri, 28 Jan 2022 14:07:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6W-0007NJ-7z for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6O-0001KX-QR for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-55-d4u0Zks-PdiBRpxPn5uWtw-1; Fri, 28 Jan 2022 13:35:17 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6776910247B5; Fri, 28 Jan 2022 18:35:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65E577462; Fri, 28 Jan 2022 18:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ne+AnRV+/8FiQY8PQ0j8bn06mRqfAQEOP3LFhuiF/pQ=; b=Hw3NSxx6JeODvbD5V8+RqoCCohIj0aR8GXmgyt7EFmQnH2YW3IPspJRhoiiqpbcErgYm+Q E8v+Uzzno/HKocM9uFqwLomCfMNCP1gPoI4mxiR8NTq7ajfFiCOQcknzlEuLaiB4u9oZJ9 MR5Ywq2xo2vsZ39aSSiEYd1S1TYQaDY= X-MC-Unique: d4u0Zks-PdiBRpxPn5uWtw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 10/36] multifd: Make zstd use iov's Date: Fri, 28 Jan 2022 19:30:07 +0100 Message-Id: <20220128183033.31998-11-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396857352100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd-zstd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 97c08367d0..bd393aee0d 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -154,6 +154,9 @@ static int zstd_send_prepare(MultiFDSendParams *p, Erro= r **errp) return -1; } } + p->iov[p->iovs_num].iov_base =3D z->zbuff; + p->iov[p->iovs_num].iov_len =3D z->out.pos; + p->iovs_num++; p->next_packet_size =3D z->out.pos; p->flags |=3D MULTIFD_FLAG_ZSTD; =20 @@ -173,10 +176,7 @@ static int zstd_send_prepare(MultiFDSendParams *p, Err= or **errp) */ static int zstd_send_write(MultiFDSendParams *p, uint32_t used, Error **er= rp) { - struct zstd_data *z =3D p->data; - - return qio_channel_write_all(p->c, (void *)z->zbuff, p->next_packet_si= ze, - errp); + return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); } =20 /** --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643397895519996.5497557666945; Fri, 28 Jan 2022 11:24:55 -0800 (PST) Received: from localhost ([::1]:37606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWrd-0003TI-PL for importer@patchew.org; Fri, 28 Jan 2022 14:24:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6V-0007Ky-2F for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6M-0001Lw-5d for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:10 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-zI24HbDXP0mLceJmxK_nHA-1; Fri, 28 Jan 2022 13:35:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC9281091DA1; Fri, 28 Jan 2022 18:35:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id C16FF77456; Fri, 28 Jan 2022 18:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jIfcME6eplHNShXh8/3HCLJjEvw8mfxrLh/NM8x7gzI=; b=djVQJnHJ9DCNtBQVhj2SkPm+yFx10aRy2WNMZOWOIKx7+74GKhCSkFLMXj6ew+beT2VBTS X+riX7m8xd0lGuUV3piI8E0pSpPzKOK4kbrO3PjD7lvCqwfW4AlxJnjevT/7o1FV3uMSnn JWzY9/yAlqDyO6h9+SotS+YtBpFu5T8= X-MC-Unique: zI24HbDXP0mLceJmxK_nHA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 11/36] multifd: Remove send_write() method Date: Fri, 28 Jan 2022 19:30:08 +0100 Message-Id: <20220128183033.31998-12-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643397897181100001 Content-Type: text/plain; charset="utf-8" Everything use now iov's. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 2 -- migration/multifd-zlib.c | 17 ----------------- migration/multifd-zstd.c | 17 ----------------- migration/multifd.c | 20 ++------------------ 4 files changed, 2 insertions(+), 54 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index c3f18af364..7496f951a7 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -164,8 +164,6 @@ typedef struct { void (*send_cleanup)(MultiFDSendParams *p, Error **errp); /* Prepare the send packet */ int (*send_prepare)(MultiFDSendParams *p, Error **errp); - /* Write the send packet */ - int (*send_write)(MultiFDSendParams *p, uint32_t used, Error **errp); /* Setup for receiving side */ int (*recv_setup)(MultiFDRecvParams *p, Error **errp); /* Cleanup for receiving side */ diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 71480c82bb..ba90f1aaf4 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -152,22 +152,6 @@ static int zlib_send_prepare(MultiFDSendParams *p, Err= or **errp) return 0; } =20 -/** - * zlib_send_write: do the actual write of the data - * - * Do the actual write of the comprresed buffer. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int zlib_send_write(MultiFDSendParams *p, uint32_t used, Error **er= rp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); -} - /** * zlib_recv_setup: setup receive side * @@ -307,7 +291,6 @@ static MultiFDMethods multifd_zlib_ops =3D { .send_setup =3D zlib_send_setup, .send_cleanup =3D zlib_send_cleanup, .send_prepare =3D zlib_send_prepare, - .send_write =3D zlib_send_write, .recv_setup =3D zlib_recv_setup, .recv_cleanup =3D zlib_recv_cleanup, .recv_pages =3D zlib_recv_pages diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index bd393aee0d..757434d1ee 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -163,22 +163,6 @@ static int zstd_send_prepare(MultiFDSendParams *p, Err= or **errp) return 0; } =20 -/** - * zstd_send_write: do the actual write of the data - * - * Do the actual write of the comprresed buffer. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int zstd_send_write(MultiFDSendParams *p, uint32_t used, Error **er= rp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); -} - /** * zstd_recv_setup: setup receive side * @@ -320,7 +304,6 @@ static MultiFDMethods multifd_zstd_ops =3D { .send_setup =3D zstd_send_setup, .send_cleanup =3D zstd_send_cleanup, .send_prepare =3D zstd_send_prepare, - .send_write =3D zstd_send_write, .recv_setup =3D zstd_recv_setup, .recv_cleanup =3D zstd_recv_cleanup, .recv_pages =3D zstd_recv_pages diff --git a/migration/multifd.c b/migration/multifd.c index f75bd3c188..96b9cc0d8b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -100,22 +100,6 @@ static int nocomp_send_prepare(MultiFDSendParams *p, E= rror **errp) return 0; } =20 -/** - * nocomp_send_write: do the actual write of the data - * - * For no compression we just have to write the data. - * - * Returns 0 for success or -1 for error - * - * @p: Params for the channel that we are using - * @used: number of pages used - * @errp: pointer to an error - */ -static int nocomp_send_write(MultiFDSendParams *p, uint32_t used, Error **= errp) -{ - return qio_channel_writev_all(p->c, p->iov, p->iovs_num, errp); -} - /** * nocomp_recv_setup: setup receive side * @@ -173,7 +157,6 @@ static MultiFDMethods multifd_nocomp_ops =3D { .send_setup =3D nocomp_send_setup, .send_cleanup =3D nocomp_send_cleanup, .send_prepare =3D nocomp_send_prepare, - .send_write =3D nocomp_send_write, .recv_setup =3D nocomp_recv_setup, .recv_cleanup =3D nocomp_recv_cleanup, .recv_pages =3D nocomp_recv_pages @@ -690,7 +673,8 @@ static void *multifd_send_thread(void *opaque) } =20 if (used) { - ret =3D multifd_send_state->ops->send_write(p, used, &loca= l_err); + ret =3D qio_channel_writev_all(p->c, p->iov, p->iovs_num, + &local_err); if (ret !=3D 0) { break; } --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398393987604.1243054472366; Fri, 28 Jan 2022 11:33:13 -0800 (PST) Received: from localhost ([::1]:47036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWzg-0001tt-0N for importer@patchew.org; Fri, 28 Jan 2022 14:33:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6Z-0007S0-Is for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6P-0001O9-EM for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:15 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-408-fS64lChHP4CiB-J8NN6UGA-1; Fri, 28 Jan 2022 13:35:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C946B63C76; Fri, 28 Jan 2022 18:35:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 140B077456; Fri, 28 Jan 2022 18:35:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0CZMF9+tpdeRtWvtbyvdKiZL5iLIO8LIWlWaxsgFtQI=; b=IPyL2nKfzMHTn8yGsMFgUa80zj6ZcR5LxdxD7kinTygk7VUQgkFNNx20BFfY0aP3tcnG0R jIe2bAh1il19i8aTaCt/v9z7L5pXoYLZr9lj142ut1LWFwbmAVzbXV6P0CFLsZT/Ymac8+ /f9NSD9x5iR1tLPYqd9CWtNWoxCa/qg= X-MC-Unique: fS64lChHP4CiB-J8NN6UGA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 12/36] multifd: Use a single writev on the send side Date: Fri, 28 Jan 2022 19:30:09 +0100 Message-Id: <20220128183033.31998-13-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398396222100001 Content-Type: text/plain; charset="utf-8" Until now, we wrote the packet header with write(), and the rest of the pages with writev(). Just increase the size of the iovec and do a single writev(). Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 96b9cc0d8b..1d4885e1a0 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -646,7 +646,7 @@ static void *multifd_send_thread(void *opaque) uint32_t used =3D p->pages->num; uint64_t packet_num =3D p->packet_num; uint32_t flags =3D p->flags; - p->iovs_num =3D 0; + p->iovs_num =3D 1; =20 if (used) { ret =3D multifd_send_state->ops->send_prepare(p, &local_er= r); @@ -666,20 +666,15 @@ static void *multifd_send_thread(void *opaque) 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); + p->iov[0].iov_len =3D p->packet_len; + p->iov[0].iov_base =3D p->packet; + + ret =3D qio_channel_writev_all(p->c, p->iov, p->iovs_num, + &local_err); if (ret !=3D 0) { break; } =20 - if (used) { - ret =3D qio_channel_writev_all(p->c, p->iov, p->iovs_num, - &local_err); - if (ret !=3D 0) { - break; - } - } - qemu_mutex_lock(&p->mutex); p->pending_job--; qemu_mutex_unlock(&p->mutex); @@ -916,7 +911,8 @@ int multifd_save_setup(Error **errp) p->packet->version =3D cpu_to_be32(MULTIFD_VERSION); p->name =3D g_strdup_printf("multifdsend_%d", i); p->tls_hostname =3D g_strdup(s->hostname); - p->iov =3D g_new0(struct iovec, page_count); + /* We need one extra place for the packet header */ + p->iov =3D g_new0(struct iovec, page_count + 1); socket_send_channel_create(multifd_new_send_channel_async, p); } =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396249639927.0927094402772; Fri, 28 Jan 2022 10:57:29 -0800 (PST) Received: from localhost ([::1]:54824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWR5-0008Ip-PY for importer@patchew.org; Fri, 28 Jan 2022 13:57:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6W-0007OH-R5 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW6P-0001Qn-36 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:36:12 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-5QGOKKp_NP-nqvjZclypwg-1; Fri, 28 Jan 2022 13:35:58 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1D3085B6C8; Fri, 28 Jan 2022 18:35:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F7E477456; Fri, 28 Jan 2022 18:35:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643394962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0hmgBIgw2vpYhvjWSpFcJn/+tADW2pBvjmWQdqRJQYc=; b=GBZPL0VldlK2wal1VWyBCEpmjBomtloe1ZRQz6jf2CCl34a4Dmwpk7r+m3DjhulEhcWYm4 549aQPU/joIAF8DLi6mMSiLgo4yGSQ1kkpxE66woIXMV/OnAhjdizRsHDJXmxWffx49qcY hXZ7RDH6Dwti9eT9NTjVk/VlfCDleco= X-MC-Unique: 5QGOKKp_NP-nqvjZclypwg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 13/36] multifd: Unfold "used" variable by its value Date: Fri, 28 Jan 2022 19:30:10 +0100 Message-Id: <20220128183033.31998-14-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396252460100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 1d4885e1a0..e5b1fa5015 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -1062,7 +1062,6 @@ static void *multifd_recv_thread(void *opaque) rcu_register_thread(); =20 while (true) { - uint32_t used; uint32_t flags; =20 if (p->quit) { @@ -1085,17 +1084,16 @@ static void *multifd_recv_thread(void *opaque) break; } =20 - used =3D p->pages->num; flags =3D p->flags; /* recv methods don't know how to handle the SYNC flag */ p->flags &=3D ~MULTIFD_FLAG_SYNC; - trace_multifd_recv(p->id, p->packet_num, used, flags, + trace_multifd_recv(p->id, p->packet_num, p->pages->num, flags, p->next_packet_size); p->num_packets++; - p->num_pages +=3D used; + p->num_pages +=3D p->pages->num; qemu_mutex_unlock(&p->mutex); =20 - if (used) { + if (p->pages->num) { ret =3D multifd_recv_state->ops->recv_pages(p, &local_err); if (ret !=3D 0) { break; --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398752604853.3801997303257; Fri, 28 Jan 2022 11:39:12 -0800 (PST) Received: from localhost ([::1]:55782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX5T-00080G-Gx for importer@patchew.org; Fri, 28 Jan 2022 14:39:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7b-0000JR-Ft for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7W-0001gX-BX for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:18 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-286-KjnT3V9fN76kxptQMuhP9Q-1; Fri, 28 Jan 2022 13:37:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0605481424E; Fri, 28 Jan 2022 18:37:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E57E7746A; Fri, 28 Jan 2022 18:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tNPrpk19d5IB0vw46yUHcQziDYelLxLiw1tT27P4kV8=; b=hnPM8zzl6shOc8D512hPo1gsJQmHzV4tHirPSxT8SZIVObrKV8qCdCFh2KR4NL3pI+HBYQ xsugheR1INzZIWiMzaRsJNs37T8ULOsaSa6WVbPJgbXZJNM5ULuAIZG6G39nCNUY9V8fX9 bxEQYfxwFuNOCgOB2mSaq759NxvlQ0M= X-MC-Unique: KjnT3V9fN76kxptQMuhP9Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 14/36] multifd: Use normal pages array on the send side Date: Fri, 28 Jan 2022 19:30:11 +0100 Message-Id: <20220128183033.31998-15-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398754186100001 Content-Type: text/plain; charset="utf-8" We are only sending normal pages through multifd channels. Later on this series, we are going to also send zero pages. We are going to detect if a page is zero or non zero in the multifd channel thread, not on the main thread. So we receive an array of pages page->offset[N] And we will end with: p->normal[N - zero_pages] p->zero[zero_pages]. In this patch, we just copy all the pages in offset to normal. for (i =3D 0; i < pages->num; i++) { p->narmal[p->normal_num] =3D pages->offset[i]; p->normal_num++: } Later in the series this becomes: for (i =3D 0; i < pages->num; i++) { if (buffer_is_zero(page->offset[i])) { p->zerol[p->zero_num] =3D pages->offset[i]; p->zero_num++: } else { p->narmal[p->normal_num] =3D pages->offset[i]; p->normal_num++: } } Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Improving comment (dave) Renaming num_normal_pages to total_normal_pages (peter) --- migration/multifd.h | 8 ++++++-- migration/multifd-zlib.c | 6 +++--- migration/multifd-zstd.c | 6 +++--- migration/multifd.c | 30 +++++++++++++++++++----------- migration/trace-events | 4 ++-- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 7496f951a7..7823199dbe 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -104,14 +104,18 @@ typedef struct { /* thread local variables */ /* packets sent through this channel */ uint64_t num_packets; - /* pages sent through this channel */ - uint64_t num_pages; + /* non zero pages sent through this channel */ + uint64_t total_normal_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; /* buffers to send */ struct iovec *iov; /* number of iovs used */ uint32_t iovs_num; + /* Pages that are not zero */ + ram_addr_t *normal; + /* num of non zero pages */ + uint32_t normal_num; /* used for compression methods */ void *data; } MultiFDSendParams; diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index ba90f1aaf4..7f4fbef2c9 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -106,16 +106,16 @@ static int zlib_send_prepare(MultiFDSendParams *p, Er= ror **errp) int ret; uint32_t i; =20 - for (i =3D 0; i < p->pages->num; i++) { + for (i =3D 0; i < p->normal_num; i++) { uint32_t available =3D z->zbuff_len - out_size; int flush =3D Z_NO_FLUSH; =20 - if (i =3D=3D p->pages->num - 1) { + if (i =3D=3D p->normal_num - 1) { flush =3D Z_SYNC_FLUSH; } =20 zs->avail_in =3D page_size; - zs->next_in =3D p->pages->block->host + p->pages->offset[i]; + zs->next_in =3D p->pages->block->host + p->normal[i]; =20 zs->avail_out =3D available; zs->next_out =3D z->zbuff + out_size; diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 757434d1ee..907d07805c 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -121,13 +121,13 @@ static int zstd_send_prepare(MultiFDSendParams *p, Er= ror **errp) z->out.size =3D z->zbuff_len; z->out.pos =3D 0; =20 - for (i =3D 0; i < p->pages->num; i++) { + for (i =3D 0; i < p->normal_num; i++) { ZSTD_EndDirective flush =3D ZSTD_e_continue; =20 - if (i =3D=3D p->pages->num - 1) { + if (i =3D=3D p->normal_num - 1) { flush =3D ZSTD_e_flush; } - z->in.src =3D p->pages->block->host + p->pages->offset[i]; + z->in.src =3D p->pages->block->host + p->normal[i]; z->in.size =3D page_size; z->in.pos =3D 0; =20 diff --git a/migration/multifd.c b/migration/multifd.c index e5b1fa5015..7b804928a2 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -89,13 +89,13 @@ static int nocomp_send_prepare(MultiFDSendParams *p, Er= ror **errp) MultiFDPages_t *pages =3D p->pages; size_t page_size =3D qemu_target_page_size(); =20 - for (int i =3D 0; i < p->pages->num; i++) { - p->iov[p->iovs_num].iov_base =3D pages->block->host + pages->offse= t[i]; + for (int i =3D 0; i < p->normal_num; i++) { + p->iov[p->iovs_num].iov_base =3D pages->block->host + p->normal[i]; p->iov[p->iovs_num].iov_len =3D page_size; p->iovs_num++; } =20 - p->next_packet_size =3D p->pages->num * page_size; + p->next_packet_size =3D p->normal_num * page_size; p->flags |=3D MULTIFD_FLAG_NOCOMP; return 0; } @@ -262,7 +262,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) =20 packet->flags =3D cpu_to_be32(p->flags); packet->pages_alloc =3D cpu_to_be32(p->pages->allocated); - packet->pages_used =3D cpu_to_be32(p->pages->num); + packet->pages_used =3D cpu_to_be32(p->normal_num); packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); =20 @@ -270,9 +270,9 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) strncpy(packet->ramblock, p->pages->block->idstr, 256); } =20 - for (i =3D 0; i < p->pages->num; i++) { + for (i =3D 0; i < p->normal_num; i++) { /* there are architectures where ram_addr_t is 32 bit */ - uint64_t temp =3D p->pages->offset[i]; + uint64_t temp =3D p->normal[i]; =20 packet->offset[i] =3D cpu_to_be64(temp); } @@ -559,6 +559,8 @@ void multifd_save_cleanup(void) p->packet =3D NULL; g_free(p->iov); p->iov =3D NULL; + g_free(p->normal); + p->normal =3D NULL; multifd_send_state->ops->send_cleanup(p, &local_err); if (local_err) { migrate_set_error(migrate_get_current(), local_err); @@ -643,12 +645,17 @@ static void *multifd_send_thread(void *opaque) qemu_mutex_lock(&p->mutex); =20 if (p->pending_job) { - uint32_t used =3D p->pages->num; uint64_t packet_num =3D p->packet_num; uint32_t flags =3D p->flags; p->iovs_num =3D 1; + p->normal_num =3D 0; =20 - if (used) { + for (int i =3D 0; i < p->pages->num; i++) { + p->normal[p->normal_num] =3D p->pages->offset[i]; + p->normal_num++; + } + + if (p->normal_num) { ret =3D multifd_send_state->ops->send_prepare(p, &local_er= r); if (ret !=3D 0) { qemu_mutex_unlock(&p->mutex); @@ -658,12 +665,12 @@ static void *multifd_send_thread(void *opaque) multifd_send_fill_packet(p); p->flags =3D 0; p->num_packets++; - p->num_pages +=3D used; + p->total_normal_pages +=3D p->normal_num; p->pages->num =3D 0; p->pages->block =3D NULL; qemu_mutex_unlock(&p->mutex); =20 - trace_multifd_send(p->id, packet_num, used, flags, + trace_multifd_send(p->id, packet_num, p->normal_num, flags, p->next_packet_size); =20 p->iov[0].iov_len =3D p->packet_len; @@ -713,7 +720,7 @@ out: qemu_mutex_unlock(&p->mutex); =20 rcu_unregister_thread(); - trace_multifd_send_thread_end(p->id, p->num_packets, p->num_pages); + trace_multifd_send_thread_end(p->id, p->num_packets, p->total_normal_p= ages); =20 return NULL; } @@ -913,6 +920,7 @@ int multifd_save_setup(Error **errp) p->tls_hostname =3D g_strdup(s->hostname); /* We need one extra place for the packet header */ p->iov =3D g_new0(struct iovec, page_count + 1); + p->normal =3D g_new0(ram_addr_t, page_count); socket_send_channel_create(multifd_new_send_channel_async, p); } =20 diff --git a/migration/trace-events b/migration/trace-events index 5172cb3b3d..171a83a55d 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -124,13 +124,13 @@ multifd_recv_sync_main_wait(uint8_t id) "channel %u" multifd_recv_terminate_threads(bool error) "error %d" multifd_recv_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %u packets %" PRIu64 " pages %" PRIu64 multifd_recv_thread_start(uint8_t id) "%u" -multifd_send(uint8_t id, uint64_t packet_num, uint32_t used, uint32_t flag= s, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " pages %u f= lags 0x%x next packet size %u" +multifd_send(uint8_t id, uint64_t packet_num, uint32_t normal, uint32_t fl= ags, uint32_t next_packet_size) "channel %u packet_num %" PRIu64 " normal p= ages %u flags 0x%x next packet size %u" multifd_send_error(uint8_t id) "channel %u" multifd_send_sync_main(long packet_num) "packet num %ld" multifd_send_sync_main_signal(uint8_t id) "channel %u" multifd_send_sync_main_wait(uint8_t id) "channel %u" multifd_send_terminate_threads(bool error) "error %d" -multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t pages) "cha= nnel %u packets %" PRIu64 " pages %" PRIu64 +multifd_send_thread_end(uint8_t id, uint64_t packets, uint64_t normal_page= s) "channel %u packets %" PRIu64 " normal pages %" PRIu64 multifd_send_thread_start(uint8_t id) "%u" multifd_tls_outgoing_handshake_start(void *ioc, void *tioc, const char *ho= stname) "ioc=3D%p tioc=3D%p hostname=3D%s" multifd_tls_outgoing_handshake_error(void *ioc, const char *err) "ioc=3D%p= err=3D%s" --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643397133709287.0776563815672; Fri, 28 Jan 2022 11:12:13 -0800 (PST) Received: from localhost ([::1]:51352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWfL-00012F-TS for importer@patchew.org; Fri, 28 Jan 2022 14:12:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7i-0000UG-JX for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26753) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7e-0001hW-JA for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:26 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-2_tv3VA4PT2W8xObt2CCEQ-1; Fri, 28 Jan 2022 13:37:18 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C59F8143E5; Fri, 28 Jan 2022 18:37:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67772782CE; Fri, 28 Jan 2022 18:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lfU7RopJAWVH8Z14WguBUMBvvlB/TJy0Ay3tGjys3nE=; b=ccv2CwaNdcr7CmrxUr8+DKFU9AWv+3DVlA51oqEJRTIW+AhSUbFV+9RAcB63hZIZp+R33v ZTB72EIjcOALBZkrTvRRwSgCrqWzPgtllH4p8uKBDPG5m/7csSLL/AkWlGwQuS8iL7+zX1 SYOWRQWulW6BxbSujE6DC8VQ3B8W1/g= X-MC-Unique: 2_tv3VA4PT2W8xObt2CCEQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 15/36] multifd: Use normal pages array on the recv side Date: Fri, 28 Jan 2022 19:30:12 +0100 Message-Id: <20220128183033.31998-16-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643397136247100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Rename num_normal_pages to total_normal_pages (peter) --- migration/multifd.h | 8 +++++-- migration/multifd-zlib.c | 8 +++---- migration/multifd-zstd.c | 6 +++--- migration/multifd.c | 45 ++++++++++++++++++---------------------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 7823199dbe..850889c5d8 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -151,12 +151,16 @@ typedef struct { uint32_t next_packet_size; /* packets sent through this channel */ uint64_t num_packets; - /* pages sent through this channel */ - uint64_t num_pages; + /* non zero pages recv through this channel */ + uint64_t total_normal_pages; /* syncs main thread and channels */ QemuSemaphore sem_sync; /* buffers to recv */ struct iovec *iov; + /* Pages that are not zero */ + ram_addr_t *normal; + /* num of non zero pages */ + uint32_t normal_num; /* used for de-compression methods */ void *data; } MultiFDRecvParams; diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 7f4fbef2c9..8239c840d3 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -225,7 +225,7 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) uint32_t in_size =3D p->next_packet_size; /* we measure the change of total_out */ uint32_t out_size =3D zs->total_out; - uint32_t expected_size =3D p->pages->num * qemu_target_page_size(); + uint32_t expected_size =3D p->normal_num * page_size; uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; int ret; int i; @@ -244,16 +244,16 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Erro= r **errp) zs->avail_in =3D in_size; zs->next_in =3D z->zbuff; =20 - for (i =3D 0; i < p->pages->num; i++) { + for (i =3D 0; i < p->normal_num; i++) { int flush =3D Z_NO_FLUSH; unsigned long start =3D zs->total_out; =20 - if (i =3D=3D p->pages->num - 1) { + if (i =3D=3D p->normal_num - 1) { flush =3D Z_SYNC_FLUSH; } =20 zs->avail_out =3D page_size; - zs->next_out =3D p->pages->block->host + p->pages->offset[i]; + zs->next_out =3D p->pages->block->host + p->normal[i]; =20 /* * Welcome to inflate semantics diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index 907d07805c..c5ed72ddcd 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -242,7 +242,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) uint32_t in_size =3D p->next_packet_size; uint32_t out_size =3D 0; size_t page_size =3D qemu_target_page_size(); - uint32_t expected_size =3D p->pages->num * page_size; + uint32_t expected_size =3D p->normal_num * page_size; uint32_t flags =3D p->flags & MULTIFD_FLAG_COMPRESSION_MASK; struct zstd_data *z =3D p->data; int ret; @@ -263,8 +263,8 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) z->in.size =3D in_size; z->in.pos =3D 0; =20 - for (i =3D 0; i < p->pages->num; i++) { - z->out.dst =3D p->pages->block->host + p->pages->offset[i]; + for (i =3D 0; i < p->normal_num; i++) { + z->out.dst =3D p->pages->block->host + p->normal[i]; z->out.size =3D page_size; z->out.pos =3D 0; =20 diff --git a/migration/multifd.c b/migration/multifd.c index 7b804928a2..e362b1bb89 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -146,11 +146,11 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, Er= ror **errp) p->id, flags, MULTIFD_FLAG_NOCOMP); return -1; } - for (int i =3D 0; i < p->pages->num; i++) { - p->iov[i].iov_base =3D p->pages->block->host + p->pages->offset[i]; + for (int i =3D 0; i < p->normal_num; i++) { + p->iov[i].iov_base =3D p->pages->block->host + p->normal[i]; p->iov[i].iov_len =3D page_size; } - return qio_channel_readv_all(p->c, p->iov, p->pages->num, errp); + return qio_channel_readv_all(p->c, p->iov, p->normal_num, errp); } =20 static MultiFDMethods multifd_nocomp_ops =3D { @@ -282,7 +282,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) { MultiFDPacket_t *packet =3D p->packet; size_t page_size =3D qemu_target_page_size(); - uint32_t pages_max =3D MULTIFD_PACKET_SIZE / page_size; + uint32_t page_count =3D MULTIFD_PACKET_SIZE / page_size; RAMBlock *block; int i; =20 @@ -309,33 +309,25 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) * If we received a packet that is 100 times bigger than expected * just stop migration. It is a magic number. */ - if (packet->pages_alloc > pages_max * 100) { + if (packet->pages_alloc > page_count) { error_setg(errp, "multifd: received packet " - "with size %u and expected a maximum size of %u", - packet->pages_alloc, pages_max * 100) ; + "with size %u and expected a size of %u", + packet->pages_alloc, page_count) ; 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); - p->pages =3D multifd_pages_init(packet->pages_alloc); - } =20 - p->pages->num =3D be32_to_cpu(packet->pages_used); - if (p->pages->num > packet->pages_alloc) { + p->normal_num =3D be32_to_cpu(packet->pages_used); + if (p->normal_num > packet->pages_alloc) { error_setg(errp, "multifd: received packet " "with %u pages and expected maximum pages are %u", - p->pages->num, packet->pages_alloc) ; + p->normal_num, packet->pages_alloc) ; 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->num =3D=3D 0) { + if (p->normal_num =3D=3D 0) { return 0; } =20 @@ -349,7 +341,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) } =20 p->pages->block =3D block; - for (i =3D 0; i < p->pages->num; i++) { + for (i =3D 0; i < p->normal_num; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 if (offset > (block->used_length - page_size)) { @@ -358,7 +350,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) offset, block->used_length); return -1; } - p->pages->offset[i] =3D offset; + p->normal[i] =3D offset; } =20 return 0; @@ -1022,6 +1014,8 @@ int multifd_load_cleanup(Error **errp) p->packet =3D NULL; g_free(p->iov); p->iov =3D NULL; + g_free(p->normal); + p->normal =3D NULL; multifd_recv_state->ops->recv_cleanup(p); } qemu_sem_destroy(&multifd_recv_state->sem_sync); @@ -1095,13 +1089,13 @@ static void *multifd_recv_thread(void *opaque) flags =3D p->flags; /* recv methods don't know how to handle the SYNC flag */ p->flags &=3D ~MULTIFD_FLAG_SYNC; - trace_multifd_recv(p->id, p->packet_num, p->pages->num, flags, + trace_multifd_recv(p->id, p->packet_num, p->normal_num, flags, p->next_packet_size); p->num_packets++; - p->num_pages +=3D p->pages->num; + p->total_normal_pages +=3D p->normal_num; qemu_mutex_unlock(&p->mutex); =20 - if (p->pages->num) { + if (p->normal_num) { ret =3D multifd_recv_state->ops->recv_pages(p, &local_err); if (ret !=3D 0) { break; @@ -1123,7 +1117,7 @@ static void *multifd_recv_thread(void *opaque) qemu_mutex_unlock(&p->mutex); =20 rcu_unregister_thread(); - trace_multifd_recv_thread_end(p->id, p->num_packets, p->num_pages); + trace_multifd_recv_thread_end(p->id, p->num_packets, p->total_normal_p= ages); =20 return NULL; } @@ -1161,6 +1155,7 @@ int multifd_load_setup(Error **errp) p->packet =3D g_malloc0(p->packet_len); p->name =3D g_strdup_printf("multifdrecv_%d", i); p->iov =3D g_new0(struct iovec, page_count); + p->normal =3D g_new0(ram_addr_t, page_count); } =20 for (i =3D 0; i < thread_count; i++) { --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398108613229.304037903633; Fri, 28 Jan 2022 11:28:28 -0800 (PST) Received: from localhost ([::1]:40978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWv3-0005zJ-Qw for importer@patchew.org; Fri, 28 Jan 2022 14:28:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7s-0000cf-Lf for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7m-0001iQ-9C for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:32 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-307-J2fgEbu-MnOZULJXtH4CMA-1; Fri, 28 Jan 2022 13:37:25 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8078E8144E1; Fri, 28 Jan 2022 18:37:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE69377456; Fri, 28 Jan 2022 18:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkAbiCYttSVRqU0/R/ggcgebKM7ODj+Bue3CTNACnp8=; b=QAgEk8cvs8EsM4qX/XjCeCF3hWh3khSli9m0n0TH4uc2DmgJ2eBjz/Yz0PuoI8b/4Z4UcY TdxrkqnfpoPf1ZjmWP/e0QRVX7pkslq7MOV/t+CjdzdBTyaujK5DTnRNHLzEUucQUGQJiR CCGXQX18DqjKyvhMTnfYHqdSprfzspY= X-MC-Unique: J2fgEbu-MnOZULJXtH4CMA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 16/36] multifd: recv side only needs the RAMBlock host address Date: Fri, 28 Jan 2022 19:30:13 +0100 Message-Id: <20220128183033.31998-17-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398110992100001 Content-Type: text/plain; charset="utf-8" So we can remove the MultiFDPages. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 4 ++-- migration/multifd-zlib.c | 2 +- migration/multifd-zstd.c | 2 +- migration/multifd.c | 7 ++----- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index 850889c5d8..be460f821b 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -136,8 +136,8 @@ typedef struct { bool running; /* should this thread finish */ bool quit; - /* array of pages to receive */ - MultiFDPages_t *pages; + /* ramblock host address */ + uint8_t *host; /* packet allocated len */ uint32_t packet_len; /* pointer to the packet */ diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 8239c840d3..aba1c88a0c 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -253,7 +253,7 @@ static int zlib_recv_pages(MultiFDRecvParams *p, Error = **errp) } =20 zs->avail_out =3D page_size; - zs->next_out =3D p->pages->block->host + p->normal[i]; + zs->next_out =3D p->host + p->normal[i]; =20 /* * Welcome to inflate semantics diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index c5ed72ddcd..d788d309f2 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -264,7 +264,7 @@ static int zstd_recv_pages(MultiFDRecvParams *p, Error = **errp) z->in.pos =3D 0; =20 for (i =3D 0; i < p->normal_num; i++) { - z->out.dst =3D p->pages->block->host + p->normal[i]; + z->out.dst =3D p->host + p->normal[i]; z->out.size =3D page_size; z->out.pos =3D 0; =20 diff --git a/migration/multifd.c b/migration/multifd.c index e362b1bb89..b39fef5dfe 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -147,7 +147,7 @@ static int nocomp_recv_pages(MultiFDRecvParams *p, Erro= r **errp) return -1; } for (int i =3D 0; i < p->normal_num; i++) { - p->iov[i].iov_base =3D p->pages->block->host + p->normal[i]; + p->iov[i].iov_base =3D p->host + p->normal[i]; p->iov[i].iov_len =3D page_size; } return qio_channel_readv_all(p->c, p->iov, p->normal_num, errp); @@ -340,7 +340,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } =20 - p->pages->block =3D block; + p->host =3D block->host; for (i =3D 0; i < p->normal_num; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 @@ -1007,8 +1007,6 @@ int multifd_load_cleanup(Error **errp) qemu_sem_destroy(&p->sem_sync); g_free(p->name); p->name =3D NULL; - multifd_pages_clear(p->pages); - p->pages =3D NULL; p->packet_len =3D 0; g_free(p->packet); p->packet =3D NULL; @@ -1149,7 +1147,6 @@ int multifd_load_setup(Error **errp) qemu_sem_init(&p->sem_sync, 0); p->quit =3D false; p->id =3D i; - p->pages =3D multifd_pages_init(page_count); p->packet_len =3D sizeof(MultiFDPacket_t) + sizeof(uint64_t) * page_count; p->packet =3D g_malloc0(p->packet_len); --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398514961213.69300773674013; Fri, 28 Jan 2022 11:35:14 -0800 (PST) Received: from localhost ([::1]:50650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX1d-0004Mm-NN for importer@patchew.org; Fri, 28 Jan 2022 14:35:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW82-0000ff-Gs for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW7s-0001jC-Cz for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:37 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-344-vrv_VeCYPeeTZfI-tMtjyA-1; Fri, 28 Jan 2022 13:37:32 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE4BE1091DA1; Fri, 28 Jan 2022 18:37:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0AFF77462; Fri, 28 Jan 2022 18:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395055; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ESOmsPTxjZbmAe2g1N7ay6d2NzqChH7CCCrDtgiDR1Q=; b=L3RQUW8h3J9CkyzQy5aLR8KyAlGcItqVRvLUz2ZCNOmiLbPzA0MLd5eynaC2qO+4UpjvFc bMTw9mcDNtDoTYG1YNbaOsK37TuUQ+NHQSTHgV+69+Z+2RkD+0HgzRwKqGEMQwiy7pqMXd ZBp2muI+t8FBmBHW9VgMC/G5pZqMBfA= X-MC-Unique: vrv_VeCYPeeTZfI-tMtjyA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 17/36] multifd: Rename pages_used to normal_pages Date: Fri, 28 Jan 2022 19:30:14 +0100 Message-Id: <20220128183033.31998-18-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398516575100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/multifd.h | 3 ++- migration/multifd.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/multifd.h b/migration/multifd.h index be460f821b..4dda900a0b 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -44,7 +44,8 @@ typedef struct { uint32_t flags; /* maximum number of allocated pages */ uint32_t pages_alloc; - uint32_t pages_used; + /* non zero pages */ + uint32_t normal_pages; /* size of the next packet that contains pages */ uint32_t next_packet_size; uint64_t packet_num; diff --git a/migration/multifd.c b/migration/multifd.c index b39fef5dfe..76b57a7177 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -262,7 +262,7 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) =20 packet->flags =3D cpu_to_be32(p->flags); packet->pages_alloc =3D cpu_to_be32(p->pages->allocated); - packet->pages_used =3D cpu_to_be32(p->normal_num); + packet->normal_pages =3D cpu_to_be32(p->normal_num); packet->next_packet_size =3D cpu_to_be32(p->next_packet_size); packet->packet_num =3D cpu_to_be64(p->packet_num); =20 @@ -316,7 +316,7 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams= *p, Error **errp) return -1; } =20 - p->normal_num =3D be32_to_cpu(packet->pages_used); + p->normal_num =3D be32_to_cpu(packet->normal_pages); if (p->normal_num > packet->pages_alloc) { error_setg(errp, "multifd: received packet " "with %u pages and expected maximum pages are %u", --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399231216298.1393395095797; Fri, 28 Jan 2022 11:47:11 -0800 (PST) Received: from localhost ([::1]:41892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXDB-0001Ob-Na for importer@patchew.org; Fri, 28 Jan 2022 14:47:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8E-0000iU-DL for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW82-0001lJ-52 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:37:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-28-arf-IpZXNOOW1w7dl3-7zQ-1; Fri, 28 Jan 2022 13:37:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CBA1100CD02; Fri, 28 Jan 2022 18:37:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45F5877456; Fri, 28 Jan 2022 18:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hXP5tuVGwykoL9UQgs6SzFnBlHVyE4UDkBk1KJ0qVMU=; b=JOoZFmCv41o7+va//JCaWcm40zs7MXw65UjCk4SI/ESKK3pOkJrF28H5GKdK9wMUCT9KUD i5bTwImgkpTqn5IyCRq+mh6cT6Uo2rhZfgIlLxpGSOsv5ePKoglX15nK0542D40yUPL7aH 97s1yzf9Lg4KlBSMwqmC3FC7mTHDh4s= X-MC-Unique: arf-IpZXNOOW1w7dl3-7zQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 18/36] Remove unnecessary minimum_version_id_old fields Date: Fri, 28 Jan 2022 19:30:15 +0100 Message-Id: <20220128183033.31998-19-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399234564100001 Content-Type: text/plain; charset="utf-8" From: Peter Maydell The migration code will not look at a VMStateDescription's minimum_version_id_old field unless that VMSD has set the load_state_old field to something non-NULL. (The purpose of minimum_version_id_old is to specify what migration version is needed for the code in the function pointed to by load_state_old to be able to handle it on incoming migration.) We have exactly one VMSD which still has a load_state_old, in the PPC CPU; every other VMSD which sets minimum_version_id_old is doing so unnecessarily. Delete all the unnecessary ones. Commit created with: sed -i '/\.minimum_version_id_old/d' $(git grep -l '\.minimum_version_id_= old') with the one legitimate use then hand-edited back in. Signed-off-by: Peter Maydell Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- It missed vmstate_ppc_cpu. --- hw/acpi/cpu.c | 2 -- hw/acpi/ich9.c | 3 --- hw/acpi/memory_hotplug.c | 2 -- hw/acpi/piix4.c | 2 -- hw/acpi/tco.c | 1 - hw/audio/pcspk.c | 1 - hw/display/macfb.c | 1 - hw/dma/xlnx-zdma.c | 1 - hw/dma/xlnx_csu_dma.c | 1 - hw/gpio/imx_gpio.c | 1 - hw/misc/bcm2835_mbox.c | 1 - hw/net/can/can_kvaser_pci.c | 1 - hw/net/can/can_mioe3680_pci.c | 1 - hw/net/can/can_pcm3680_pci.c | 1 - hw/net/can/can_sja1000.c | 2 -- hw/net/can/ctucan_core.c | 2 -- hw/net/can/ctucan_pci.c | 1 - hw/ppc/ppc.c | 1 - hw/scsi/megasas.c | 1 - hw/scsi/mptsas.c | 1 - hw/virtio/virtio-mmio.c | 1 - hw/virtio/virtio-pci.c | 1 - hw/virtio/virtio.c | 1 - target/openrisc/machine.c | 1 - target/ppc/machine.c | 2 -- target/sparc/machine.c | 4 ---- 26 files changed, 37 deletions(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index b20903ea30..3646dbfe68 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -297,7 +297,6 @@ static const VMStateDescription vmstate_cpuhp_sts =3D { .name =3D "CPU hotplug device state", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_BOOL(is_inserting, AcpiCpuStatus), VMSTATE_BOOL(is_removing, AcpiCpuStatus), @@ -311,7 +310,6 @@ const VMStateDescription vmstate_cpu_hotplug =3D { .name =3D "CPU hotplug state", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32(selector, CPUHotplugState), VMSTATE_UINT8(command, CPUHotplugState), diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index ebe08ed831..bd9bbade70 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -163,7 +163,6 @@ static const VMStateDescription vmstate_memhp_state =3D= { .name =3D "ich9_pm/memhp", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D vmstate_test_use_memhp, .fields =3D (VMStateField[]) { VMSTATE_MEMORY_HOTPLUG(acpi_memory_hotplug, ICH9LPCPMRegs), @@ -181,7 +180,6 @@ static const VMStateDescription vmstate_tco_io_state = =3D { .name =3D "ich9_pm/tco", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D vmstate_test_use_tco, .fields =3D (VMStateField[]) { VMSTATE_STRUCT(tco_regs, ICH9LPCPMRegs, 1, vmstate_tco_io_sts, @@ -208,7 +206,6 @@ static const VMStateDescription vmstate_cpuhp_state =3D= { .name =3D "ich9_pm/cpuhp", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D vmstate_test_use_cpuhp, .pre_load =3D vmstate_cpuhp_pre_load, .fields =3D (VMStateField[]) { diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index d0fffcf787..a581a2183b 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -318,7 +318,6 @@ static const VMStateDescription vmstate_memhp_sts =3D { .name =3D "memory hotplug device state", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_BOOL(is_enabled, MemStatus), VMSTATE_BOOL(is_inserting, MemStatus), @@ -332,7 +331,6 @@ const VMStateDescription vmstate_memory_hotplug =3D { .name =3D "memory hotplug state", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32(selector, MemHotplugState), VMSTATE_STRUCT_VARRAY_POINTER_UINT32(devs, MemHotplugState, dev_co= unt, diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index f0b5fac44a..cc37fa3416 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -230,7 +230,6 @@ static const VMStateDescription vmstate_memhp_state =3D= { .name =3D "piix4_pm/memhp", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D vmstate_test_use_memhp, .fields =3D (VMStateField[]) { VMSTATE_MEMORY_HOTPLUG(acpi_memory_hotplug, PIIX4PMState), @@ -255,7 +254,6 @@ static const VMStateDescription vmstate_cpuhp_state =3D= { .name =3D "piix4_pm/cpuhp", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D vmstate_test_use_cpuhp, .pre_load =3D vmstate_cpuhp_pre_load, .fields =3D (VMStateField[]) { diff --git a/hw/acpi/tco.c b/hw/acpi/tco.c index cf1e68a539..4783721e4e 100644 --- a/hw/acpi/tco.c +++ b/hw/acpi/tco.c @@ -239,7 +239,6 @@ const VMStateDescription vmstate_tco_io_sts =3D { .name =3D "tco io device status", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT16(tco.rld, TCOIORegs), VMSTATE_UINT8(tco.din, TCOIORegs), diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index b056c05387..dfc7ebca4e 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -209,7 +209,6 @@ static const VMStateDescription vmstate_spk =3D { .name =3D "pcspk", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D migrate_needed, .fields =3D (VMStateField[]) { VMSTATE_UINT8(data_on, PCSpkState), diff --git a/hw/display/macfb.c b/hw/display/macfb.c index 4bd7c3ad6a..2eeb80cc3f 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -616,7 +616,6 @@ static const VMStateDescription vmstate_macfb =3D { .name =3D "macfb", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .post_load =3D macfb_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINT8_ARRAY(color_palette, MacfbState, 256 * 3), diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c index a5a92b4ff8..4eb7f66e9f 100644 --- a/hw/dma/xlnx-zdma.c +++ b/hw/dma/xlnx-zdma.c @@ -806,7 +806,6 @@ static const VMStateDescription vmstate_zdma =3D { .name =3D TYPE_XLNX_ZDMA, .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32_ARRAY(regs, XlnxZDMA, ZDMA_R_MAX), VMSTATE_UINT32(state, XlnxZDMA), diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 896bb3574d..5b62a2f74f 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -663,7 +663,6 @@ static const VMStateDescription vmstate_xlnx_csu_dma = =3D { .name =3D TYPE_XLNX_CSU_DMA, .version_id =3D 0, .minimum_version_id =3D 0, - .minimum_version_id_old =3D 0, .fields =3D (VMStateField[]) { VMSTATE_PTIMER(src_timer, XlnxCSUDMA), VMSTATE_UINT16(width, XlnxCSUDMA), diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c index 7a591804a9..c7f98b7bb1 100644 --- a/hw/gpio/imx_gpio.c +++ b/hw/gpio/imx_gpio.c @@ -277,7 +277,6 @@ static const VMStateDescription vmstate_imx_gpio =3D { .name =3D TYPE_IMX_GPIO, .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32(dr, IMXGPIOState), VMSTATE_UINT32(gdir, IMXGPIOState), diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index 9f73cbd5e4..04e53c9828 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -271,7 +271,6 @@ static const VMStateDescription vmstate_bcm2835_mbox = =3D { .name =3D TYPE_BCM2835_MBOX, .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_BOOL_ARRAY(available, BCM2835MboxState, MBOX_CHAN_COUNT), VMSTATE_STRUCT_ARRAY(mbox, BCM2835MboxState, 2, 1, diff --git a/hw/net/can/can_kvaser_pci.c b/hw/net/can/can_kvaser_pci.c index 168b3a620d..94b3a534f8 100644 --- a/hw/net/can/can_kvaser_pci.c +++ b/hw/net/can/can_kvaser_pci.c @@ -266,7 +266,6 @@ static const VMStateDescription vmstate_kvaser_pci =3D { .name =3D "kvaser_pci", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, KvaserPCIState), /* Load this before sja_state. */ diff --git a/hw/net/can/can_mioe3680_pci.c b/hw/net/can/can_mioe3680_pci.c index 7a79e2605a..29dc696f7c 100644 --- a/hw/net/can/can_mioe3680_pci.c +++ b/hw/net/can/can_mioe3680_pci.c @@ -203,7 +203,6 @@ static const VMStateDescription vmstate_mioe3680_pci = =3D { .name =3D "mioe3680_pci", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, Mioe3680PCIState), VMSTATE_STRUCT(sja_state[0], Mioe3680PCIState, 0, vmstate_can_sja, diff --git a/hw/net/can/can_pcm3680_pci.c b/hw/net/can/can_pcm3680_pci.c index 8ef4e74af0..e8e57f4f33 100644 --- a/hw/net/can/can_pcm3680_pci.c +++ b/hw/net/can/can_pcm3680_pci.c @@ -204,7 +204,6 @@ static const VMStateDescription vmstate_pcm3680i_pci = =3D { .name =3D "pcm3680i_pci", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, Pcm3680iPCIState), VMSTATE_STRUCT(sja_state[0], Pcm3680iPCIState, 0, diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 34eea684ce..3ba803e947 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -928,7 +928,6 @@ const VMStateDescription vmstate_qemu_can_filter =3D { .name =3D "qemu_can_filter", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32(can_id, qemu_can_filter), VMSTATE_UINT32(can_mask, qemu_can_filter), @@ -952,7 +951,6 @@ const VMStateDescription vmstate_can_sja =3D { .name =3D "can_sja", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .post_load =3D can_sja_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINT8(mode, CanSJA1000State), diff --git a/hw/net/can/ctucan_core.c b/hw/net/can/ctucan_core.c index d171c372e0..f2c3b6a706 100644 --- a/hw/net/can/ctucan_core.c +++ b/hw/net/can/ctucan_core.c @@ -617,7 +617,6 @@ const VMStateDescription vmstate_qemu_ctucan_tx_buffer = =3D { .name =3D "qemu_ctucan_tx_buffer", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT8_ARRAY(data, CtuCanCoreMsgBuffer, CTUCAN_CORE_MSG_MAX= _LEN), VMSTATE_END_OF_LIST() @@ -636,7 +635,6 @@ const VMStateDescription vmstate_ctucan =3D { .name =3D "ctucan", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .post_load =3D ctucan_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINT32(mode_settings.u32, CtuCanCoreState), diff --git a/hw/net/can/ctucan_pci.c b/hw/net/can/ctucan_pci.c index f1c86cd06a..50f4ea6cd6 100644 --- a/hw/net/can/ctucan_pci.c +++ b/hw/net/can/ctucan_pci.c @@ -215,7 +215,6 @@ static const VMStateDescription vmstate_ctucan_pci =3D { .name =3D "ctucan_pci", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, CtuCanPCIState), VMSTATE_STRUCT(ctucan_state[0], CtuCanPCIState, 0, vmstate_ctucan, diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index bb5bee9a33..462c87dba8 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -1049,7 +1049,6 @@ const VMStateDescription vmstate_ppc_timebase =3D { .name =3D "timebase", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .pre_save =3D timebase_pre_save, .fields =3D (VMStateField []) { VMSTATE_UINT64(guest_timebase, PPCTimebase), diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index c9da5ce0b5..203f25d4c4 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -2315,7 +2315,6 @@ static const VMStateDescription vmstate_megasas_gen2 = =3D { .name =3D "megasas-gen2", .version_id =3D 0, .minimum_version_id =3D 0, - .minimum_version_id_old =3D 0, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, MegasasState), VMSTATE_MSIX(parent_obj, MegasasState), diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index 5181b0c0b0..706cf0df3a 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -1363,7 +1363,6 @@ static const VMStateDescription vmstate_mptsas =3D { .name =3D "mptsas", .version_id =3D 0, .minimum_version_id =3D 0, - .minimum_version_id_old =3D 0, .post_load =3D mptsas_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(dev, MPTSASState), diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 72da12fea5..688eccda94 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -592,7 +592,6 @@ static const VMStateDescription vmstate_virtio_mmio =3D= { .name =3D "virtio_mmio", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_END_OF_LIST() }, diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 750aa47ec1..f9cf9592fd 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -131,7 +131,6 @@ static const VMStateDescription vmstate_virtio_pci =3D { .name =3D "virtio_pci", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_END_OF_LIST() }, diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index aae72fb8b7..9e8f51dfb0 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2808,7 +2808,6 @@ static const VMStateDescription vmstate_virtio =3D { .name =3D "virtio", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_END_OF_LIST() }, diff --git a/target/openrisc/machine.c b/target/openrisc/machine.c index 6239725c4f..b7d7388640 100644 --- a/target/openrisc/machine.c +++ b/target/openrisc/machine.c @@ -25,7 +25,6 @@ static const VMStateDescription vmstate_tlb_entry =3D { .name =3D "tlb_entry", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINTTL(mr, OpenRISCTLBEntry), VMSTATE_UINTTL(tr, OpenRISCTLBEntry), diff --git a/target/ppc/machine.c b/target/ppc/machine.c index 733a22d744..a503e00ddc 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -421,7 +421,6 @@ static const VMStateDescription vmstate_tm =3D { .name =3D "cpu/tm", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .needed =3D tm_needed, .fields =3D (VMStateField []) { VMSTATE_UINTTL_ARRAY(env.tm_gpr, PowerPCCPU, 32), @@ -672,7 +671,6 @@ const VMStateDescription vmstate_ppc_cpu =3D { .name =3D "cpu", .version_id =3D 5, .minimum_version_id =3D 5, - .minimum_version_id_old =3D 4, .pre_save =3D cpu_pre_save, .post_load =3D cpu_post_load, .fields =3D (VMStateField[]) { diff --git a/target/sparc/machine.c b/target/sparc/machine.c index 917375c3a1..44b9e7d75d 100644 --- a/target/sparc/machine.c +++ b/target/sparc/machine.c @@ -10,7 +10,6 @@ static const VMStateDescription vmstate_cpu_timer =3D { .name =3D "cpu_timer", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT32(frequency, CPUTimer), VMSTATE_UINT32(disabled, CPUTimer), @@ -30,7 +29,6 @@ static const VMStateDescription vmstate_trap_state =3D { .name =3D "trap_state", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT64(tpc, trap_state), VMSTATE_UINT64(tnpc, trap_state), @@ -44,7 +42,6 @@ static const VMStateDescription vmstate_tlb_entry =3D { .name =3D "tlb_entry", .version_id =3D 1, .minimum_version_id =3D 1, - .minimum_version_id_old =3D 1, .fields =3D (VMStateField[]) { VMSTATE_UINT64(tag, SparcTLBEntry), VMSTATE_UINT64(tte, SparcTLBEntry), @@ -113,7 +110,6 @@ const VMStateDescription vmstate_sparc_cpu =3D { .name =3D "cpu", .version_id =3D SPARC_VMSTATE_VER, .minimum_version_id =3D SPARC_VMSTATE_VER, - .minimum_version_id_old =3D SPARC_VMSTATE_VER, .pre_save =3D cpu_pre_save, .fields =3D (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gregs, SPARCCPU, 8), --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643396644691524.1095863763746; Fri, 28 Jan 2022 11:04:04 -0800 (PST) Received: from localhost ([::1]:39406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWXT-0000eH-Sc for importer@patchew.org; Fri, 28 Jan 2022 14:04:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8O-0000nU-9x for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32443) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8F-0001mA-Ft for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:03 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-269-5eB-jDByONGEhIpS8DCYpg-1; Fri, 28 Jan 2022 13:37:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 906A3100CD02; Fri, 28 Jan 2022 18:37:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E7A977456; Fri, 28 Jan 2022 18:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fELfIA00+SijfBjO6U/Yi8hSZd55Ja0ZvrfarrPVN6A=; b=TTeyARRHqdrv80vE7NovbyVG8nFV/6/9qd+IIz1ToQgDop8chJ92F9yMlsWXXzynt9Uq0W RE39PHHJXcGX72Wp4S1eAGYO9xNLPHOcGBMO2/T+Hf6AHh7/MrINGN71BoIMV6NY6S2n0x sGDZ590a1qCRalsf4NUVNFNBAeREypc= X-MC-Unique: 5eB-jDByONGEhIpS8DCYpg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 19/36] migration/migration.c: Add missed default error handler for migration state Date: Fri, 28 Jan 2022 19:30:16 +0100 Message-Id: <20220128183033.31998-20-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , Zhang Chen , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643396645720100001 Content-Type: text/plain; charset="utf-8" From: Zhang Chen In the migration_completion() no other status is expected, for example MIGRATION_STATUS_CANCELLING, MIGRATION_STATUS_CANCELLED, etc. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 0652165610..2afa77da03 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3205,7 +3205,7 @@ static void migration_completion(MigrationState *s) qemu_mutex_unlock_iothread(); =20 trace_migration_completion_postcopy_end_after_complete(); - } else if (s->state =3D=3D MIGRATION_STATUS_CANCELLING) { + } else { goto fail; } =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399026165263.3693114681813; Fri, 28 Jan 2022 11:43:46 -0800 (PST) Received: from localhost ([::1]:35396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX9t-00058L-2K for importer@patchew.org; Fri, 28 Jan 2022 14:43:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8Q-0000pD-TK for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8G-0001mW-Oy for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:07 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-tZdKxY-oMjyLGuvY1CPKCQ-1; Fri, 28 Jan 2022 13:37:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 374F594DE6; Fri, 28 Jan 2022 18:37:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC1C177462; Fri, 28 Jan 2022 18:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=onvaER+t0TraC7NXwJgnvw5i2u41yAbEjBFVmIygZSU=; b=RPJjwS1XvCEiJKpCjYRyHrK0BHBaTMXd7oqvNtyFwTDUDOIgrqWdzYeRg3W62WWcXcMt1s /kUZ+lVThu/LFsW5oiqS3mPUVg6lvWCc6YYwyy/RtgCEHCHxN2rqzLQmW47w+cAZ63Hq07 6LBPPzlmQF5LxwbOBqe/eNkMpP7fFjg= X-MC-Unique: tZdKxY-oMjyLGuvY1CPKCQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 20/36] migration/migration.c: Avoid COLO boot in postcopy migration Date: Fri, 28 Jan 2022 19:30:17 +0100 Message-Id: <20220128183033.31998-21-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , Zhang Chen , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399028015100001 Content-Type: text/plain; charset="utf-8" From: Zhang Chen COLO dose not support postcopy migration and remove the Fixme. Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2afa77da03..5b2e3c66d1 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3230,7 +3230,11 @@ static void migration_completion(MigrationState *s) goto fail_invalidate; } =20 - if (!migrate_colo_enabled()) { + if (migrate_colo_enabled() && s->state =3D=3D MIGRATION_STATUS_ACTIVE)= { + /* COLO does not support postcopy */ + migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, + MIGRATION_STATUS_COLO); + } else { migrate_set_state(&s->state, current_active_state, MIGRATION_STATUS_COMPLETED); } @@ -3621,10 +3625,6 @@ static void migration_iteration_finish(MigrationStat= e *s) "COLO enabled", __func__); } migrate_start_colo_process(s); - /* - * Fixme: we will run VM in COLO no matter its old running state. - * After exited COLO, we will keep running. - */ /* Fallthrough */ case MIGRATION_STATUS_ACTIVE: /* --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643397053092323.1364304535351; Fri, 28 Jan 2022 11:10:53 -0800 (PST) Received: from localhost ([::1]:48920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWe2-0007ez-9h for importer@patchew.org; Fri, 28 Jan 2022 14:10:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8i-0000uM-4P for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8N-0001nO-NV for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-67-dMq-fhvhOcGW4jjCzuL6KA-1; Fri, 28 Jan 2022 13:38:02 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FAA894DC1; Fri, 28 Jan 2022 18:37:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 983F077462; Fri, 28 Jan 2022 18:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/osl7oqZ/l1nIb7N6ea0VQuADVcsGBk75aoqoxqFn4s=; b=M94tNf7cP+DZcCmHk679hPWycJg+lmwlpqyfM1/hhxziV5qKqHVQ2Jezo3liuJ3gOK1uNa GuHe7ZdR30+wdYQ5tQycvucC7stcMsNInyFMYo9urQpHkXRR+m9yQI9uSQswkWomnKplUJ EwrIsUMoovZpRb+Iu8p3VdU6AmMOuGo= X-MC-Unique: dMq-fhvhOcGW4jjCzuL6KA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 21/36] migration/migration.c: Remove the MIGRATION_STATUS_ACTIVE when migration finished Date: Fri, 28 Jan 2022 19:30:18 +0100 Message-Id: <20220128183033.31998-22-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , Zhang Chen , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643397055339100001 Content-Type: text/plain; charset="utf-8" From: Zhang Chen The MIGRATION_STATUS_ACTIVE indicates that migration is running. Remove it to be handled by the default operation, It should be part of the unknown ending states. Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5b2e3c66d1..3849b33108 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3625,12 +3625,6 @@ static void migration_iteration_finish(MigrationStat= e *s) "COLO enabled", __func__); } migrate_start_colo_process(s); - /* Fallthrough */ - case MIGRATION_STATUS_ACTIVE: - /* - * We should really assert here, but since it's during - * migration, let's try to reduce the usage of assertions. - */ s->vm_was_running =3D true; /* Fallthrough */ case MIGRATION_STATUS_FAILED: --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399568413412.14406969492086; Fri, 28 Jan 2022 11:52:48 -0800 (PST) Received: from localhost ([::1]:51748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXId-0000Ij-9G for importer@patchew.org; Fri, 28 Jan 2022 14:52:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW93-00018Z-ST for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8h-0001oe-OG for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:43 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-49-0wdi2zUuM8i51xAhb9vHxQ-1; Fri, 28 Jan 2022 13:38:10 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 101D394DC6; Fri, 28 Jan 2022 18:38:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03F9612E25; Fri, 28 Jan 2022 18:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DUtLJ3E/Ba4f1f0VyVY15aJnRzdGGlTSP4JV0rpYGRw=; b=I3dj76sqS0g6DksdU6PHYNyOCQTUJEg6s+m/x7/K0ULXrX18fiEfQkJ7AQkiu24mmJzweJ Ayhtk55Ceh4wfti6HwoKHzyeI0vpKyd06XfosAruHmVbU9WAHD8Z/l3mCl4di5QcvhjZ3o y+JkxSeuByncqaH3mKwVY70dqVoJF/s= X-MC-Unique: 0wdi2zUuM8i51xAhb9vHxQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 22/36] migration: Report the error returned when save_live_iterate fails Date: Fri, 28 Jan 2022 19:30:19 +0100 Message-Id: <20220128183033.31998-23-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , David Edmondson , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399570670100001 Content-Type: text/plain; charset="utf-8" From: David Edmondson Should qemu_savevm_state_iterate() encounter a failure when calling a particular save_live_iterate function, report the error code returned by the function. Signed-off-by: David Edmondson Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/savevm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 0bef031acb..1599b02fbc 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1298,8 +1298,9 @@ int qemu_savevm_state_iterate(QEMUFile *f, bool postc= opy) save_section_footer(f, se); =20 if (ret < 0) { - error_report("failed to save SaveStateEntry with id(name): %d(= %s)", - se->section_id, se->idstr); + error_report("failed to save SaveStateEntry with id(name): " + "%d(%s): %d", + se->section_id, se->idstr, ret); qemu_file_set_error(f, ret); } if (ret <=3D 0) { --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398013189565.6686292968141; Fri, 28 Jan 2022 11:26:53 -0800 (PST) Received: from localhost ([::1]:38886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWtX-0004MQ-U4 for importer@patchew.org; Fri, 28 Jan 2022 14:26:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW94-00018k-3L for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8i-0001pI-LL for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:43 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-zaxu5tILPB-oiw5Ul4qzrg-1; Fri, 28 Jan 2022 13:38:17 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9FF9100D688; Fri, 28 Jan 2022 18:38:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 726D712E25; Fri, 28 Jan 2022 18:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LLAQ1nW4YKEPm7wnZ619dRUESUtm/F93UK4qE9q7iAc=; b=JIOykaTc6Lm1vk2WO95nngSqJeDr0OIMP8eN92JHoxe5JOU9LNi8nLo7MQDyZVLHaubLp1 cS4pLs+gUjt47FttEFazjzZe5DhrDpICQWrY5BewaUvll0p6EG83NDJj1dhAPiNUM1EeDu 2lHtME/Agiyu1QOimeroXQQpjIJD8I0= X-MC-Unique: zaxu5tILPB-oiw5Ul4qzrg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 23/36] migration/ram: clean up unused comment. Date: Fri, 28 Jan 2022 19:30:20 +0100 Message-Id: <20220128183033.31998-24-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Xu Zheng , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Mao Zhongyi , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398016184100001 Content-Type: text/plain; charset="utf-8" From: Xu Zheng Just a removal of an unused comment. a0a8aa147aa did many fixes and removed the parameter named "ms", but forget= to remove the corresponding comment in function named "ram_save_host_page". Signed-off-by: Xu Zheng Signed-off-by: Mao Zhongyi Signed-off-by: Juan Quintela Reviewed-by: Juan Quintela --- migration/ram.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index e9dcd3ca4e..b4477b8ee0 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2179,7 +2179,6 @@ static int ram_save_target_page(RAMState *rs, PageSea= rchStatus *pss) * Returns the number of pages written or negative on error * * @rs: current RAM state - * @ms: current migration state * @pss: data about the page we want to send */ static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss) --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399665472722.2529923129682; Fri, 28 Jan 2022 11:54:25 -0800 (PST) Received: from localhost ([::1]:55376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXKC-0002l8-QA for importer@patchew.org; Fri, 28 Jan 2022 14:54:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW94-00018i-2j for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8v-0001qn-6F for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:45 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-ZYW1a5KnPmuJEtzU4zNf2A-1; Fri, 28 Jan 2022 13:38:25 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C6281091DAA; Fri, 28 Jan 2022 18:38:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3112377462; Fri, 28 Jan 2022 18:38:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gDPLBE5SDiRcc3Ih58+8tD1mzhZBQRy31q4QaMFYHQg=; b=DIvypM5jP5k/+A6CgJ60SYrn+IzDJT89e/3U8qzas6t6JSIz1urRCnSofyx9wtebnuhh1f Lb045/oaoilLd9qE0aMg0fz9PMxgvEQuzzGow4RM2/anYCCcFur4j/sf72mHVr1J9SaWJ+ a9VfJX4ngPLUXaC61n35u0oRdPAtPH0= X-MC-Unique: ZYW1a5KnPmuJEtzU4zNf2A-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 24/36] migration: Drop dead code of ram_debug_dump_bitmap() Date: Fri, 28 Jan 2022 19:30:21 +0100 Message-Id: <20220128183033.31998-25-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399667010100001 From: Peter Xu I planned to add "#ifdef DEBUG_POSTCOPY" around the function too because otherwise it'll be compiled into qemu binary even if it'll never be used. = Then I found that maybe it's easier to just drop it for good.. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.h | 2 -- migration/ram.c | 39 --------------------------------------- 2 files changed, 41 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index c515396a9a..f543e25765 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -55,8 +55,6 @@ void mig_throttle_counter_reset(void); uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t = len); void acct_update_position(QEMUFile *f, size_t size, bool zero); -void ram_debug_dump_bitmap(unsigned long *todump, bool expected, - unsigned long pages); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ int ram_postcopy_send_discard_bitmap(MigrationState *ms); diff --git a/migration/ram.c b/migration/ram.c index b4477b8ee0..9a06ea6dd4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2394,40 +2394,6 @@ static void ram_state_reset(RAMState *rs) =20 #define MAX_WAIT 50 /* ms, half buffered_file limit */ =20 -/* - * 'expected' is the value you expect the bitmap mostly to be full - * of; it won't bother printing lines that are all this value. - * If 'todump' is null the migration bitmap is dumped. - */ -void ram_debug_dump_bitmap(unsigned long *todump, bool expected, - unsigned long pages) -{ - int64_t cur; - int64_t linelen =3D 128; - char linebuf[129]; - - for (cur =3D 0; cur < pages; cur +=3D linelen) { - int64_t curb; - bool found =3D false; - /* - * Last line; catch the case where the line length - * is longer than remaining ram - */ - if (cur + linelen > pages) { - linelen =3D pages - cur; - } - for (curb =3D 0; curb < linelen; curb++) { - bool thisbit =3D test_bit(cur + curb, todump); - linebuf[curb] =3D thisbit ? '1' : '.'; - found =3D found || (thisbit !=3D expected); - } - if (found) { - linebuf[curb] =3D '\0'; - fprintf(stderr, "0x%08" PRIx64 " : %s\n", cur, linebuf); - } - } -} - /* **** functions for postcopy ***** */ =20 void ram_postcopy_migrated_memory_release(MigrationState *ms) @@ -2655,11 +2621,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) if (ret) { return ret; } - -#ifdef DEBUG_POSTCOPY - ram_debug_dump_bitmap(block->bmap, true, - block->used_length >> TARGET_PAGE_BITS); -#endif } trace_ram_postcopy_send_discard_bitmap(); =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399524546976.9969102428897; Fri, 28 Jan 2022 11:52:04 -0800 (PST) Received: from localhost ([::1]:48292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXHv-0006H1-2S for importer@patchew.org; Fri, 28 Jan 2022 14:52:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW94-00018j-2j for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW8x-0001rd-1t for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:38:47 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-531-qVXYq7pkPRqAcMXjTGFNlQ-1; Fri, 28 Jan 2022 13:38:33 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 215931923B83; Fri, 28 Jan 2022 18:38:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD88077461; Fri, 28 Jan 2022 18:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yTQ4I0ZcTmklehXGFG8JWS5ZQcOuFKPVBWjAxpcMXkI=; b=cMP7MSx/j/QXznGjPNnEJ64BRfym5AlKlEZfIcyddHIexq4LmV5/Ka6qHJpiieHOI1TZh/ xh3u2m0yQVYSv7GjFnFHJBm1CBuYSow2Nrz0yaLF6lM/C15PRFW8PupFBDrilBPuJ7U+ss CbNXQVnweu7d/wDeScewqrMtOaKm25o= X-MC-Unique: qVXYq7pkPRqAcMXjTGFNlQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 25/36] migration: Don't return for postcopy_chunk_hostpages() Date: Fri, 28 Jan 2022 19:30:22 +0100 Message-Id: <20220128183033.31998-26-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399526589100001 From: Peter Xu It always return zero, because it just can't go wrong so far. Simplify the code with no functional change. Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 9a06ea6dd4..c60cf5ad83 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2566,12 +2566,10 @@ static void postcopy_chunk_hostpages_pass(Migration= State *ms, RAMBlock *block) * dirty host-page size chunks as all dirty. In this case the host-page * is the host-page for the particular RAMBlock, i.e. it might be a huge p= age * - * Returns zero on success - * * @ms: current migration state * @block: block we want to work with */ -static int postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) +static void postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) { postcopy_discard_send_init(ms, block->idstr); =20 @@ -2581,7 +2579,6 @@ static int postcopy_chunk_hostpages(MigrationState *m= s, RAMBlock *block) postcopy_chunk_hostpages_pass(ms, block); =20 postcopy_discard_send_finish(ms); - return 0; } =20 /** @@ -2603,7 +2600,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState *= ms) { RAMState *rs =3D ram_state; RAMBlock *block; - int ret; =20 RCU_READ_LOCK_GUARD(); =20 @@ -2617,10 +2613,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { /* Deal with TPS !=3D HPS and huge pages */ - ret =3D postcopy_chunk_hostpages(ms, block); - if (ret) { - return ret; - } + postcopy_chunk_hostpages(ms, block); } trace_ram_postcopy_send_discard_bitmap(); =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398515688889.2161723465258; Fri, 28 Jan 2022 11:35:15 -0800 (PST) Received: from localhost ([::1]:50696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX1e-0004P2-QR for importer@patchew.org; Fri, 28 Jan 2022 14:35:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW9U-0001Fw-SM for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:39:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44151) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDW9G-0001wE-2O for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:39:04 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-C76gh4zXNIGJu3sBFhUVlA-1; Fri, 28 Jan 2022 13:38:56 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 833431091DA0; Fri, 28 Jan 2022 18:38:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82A8812E25; Fri, 28 Jan 2022 18:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZEDHjNn5660tKa3OsoWZdLmqD8eE6Y5+2rpz+s3JKVA=; b=RlwBfxAvdxB1sP/rBA25NC/ESsKX38ZZxychUQgoBR4NykvVE/v4SCazHwSldoR+ujydQX m7M4dVqlju68nlZnAbl1ZENZTZM9imbheYN9b5zljYxRxPvLOxfpwUzKp3LVqMpUmfhX6T tcglVvffNLRs2T62Q67aVKnDKaCB/4M= X-MC-Unique: C76gh4zXNIGJu3sBFhUVlA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 26/36] migration: Drop postcopy_chunk_hostpages() Date: Fri, 28 Jan 2022 19:30:23 +0100 Message-Id: <20220128183033.31998-27-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398518142100003 Content-Type: text/plain; charset="utf-8" From: Peter Xu This function calls three functions: - postcopy_discard_send_init(ms, block->idstr); - postcopy_chunk_hostpages_pass(ms, block); - postcopy_discard_send_finish(ms); However only the 2nd function call is meaningful. It's major role is to ma= ke sure dirty bits are applied in host-page-size granule, so there will be no partial dirty bits set for a whole host page if huge pages are used. The 1st/3rd call are for latter when we want to send the disgard ranges. They're mostly no-op here besides some tracepoints (which are misleading!). Drop them, then we can directly drop postcopy_chunk_hostpages() as a whole because we can call postcopy_chunk_hostpages_pass() directly. There're still some nice comments above postcopy_chunk_hostpages() that exp= lain what it does. Copy it over to the caller's site. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c60cf5ad83..91d32002e8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2557,30 +2557,6 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, RAMBlock *block) } } =20 -/** - * postcopy_chunk_hostpages: discard any partially sent host page - * - * Utility for the outgoing postcopy code. - * - * Discard any partially sent host-page size chunks, mark any partially - * dirty host-page size chunks as all dirty. In this case the host-page - * is the host-page for the particular RAMBlock, i.e. it might be a huge p= age - * - * @ms: current migration state - * @block: block we want to work with - */ -static void postcopy_chunk_hostpages(MigrationState *ms, RAMBlock *block) -{ - postcopy_discard_send_init(ms, block->idstr); - - /* - * Ensure that all partially dirty host pages are made fully dirty. - */ - postcopy_chunk_hostpages_pass(ms, block); - - postcopy_discard_send_finish(ms); -} - /** * ram_postcopy_send_discard_bitmap: transmit the discard bitmap * @@ -2612,8 +2588,13 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) rs->last_page =3D 0; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { - /* Deal with TPS !=3D HPS and huge pages */ - postcopy_chunk_hostpages(ms, block); + /* + * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent + * host-page size chunks, mark any partially dirty host-page size + * chunks as all dirty. In this case the host-page is the host-pa= ge + * for the particular RAMBlock, i.e. it might be a huge page. + */ + postcopy_chunk_hostpages_pass(ms, block); } trace_ram_postcopy_send_discard_bitmap(); =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398939287394.09400286798586; Fri, 28 Jan 2022 11:42:19 -0800 (PST) Received: from localhost ([::1]:60456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX8U-0002xQ-EY for importer@patchew.org; Fri, 28 Jan 2022 14:42:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWAk-0001Qv-Hd for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:40:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWAa-0001yN-Sm for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:40:33 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-f2m5mYzOMsq2_6bnTT-n6A-1; Fri, 28 Jan 2022 13:39:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBDBF1923B83; Fri, 28 Jan 2022 18:39:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCAD212E25; Fri, 28 Jan 2022 18:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vopd49TCz+wjUPFGxCVUDJUhTwkiZxNTMIqVcxx9ykc=; b=Y/0eIv8sc9Q+ywsAA4/FmkLOvz5jcloOiBZBmL2CkpBAnemTio9dnUPCxRaN9+vx2X+lv6 SmqokYv7IO45DIast2PmyN/jS5tmMu0SfTHsT4hBLLT3NYtpogIfOEtRn54khh/tfOE41l AxPxlUhdKIA6nPTtSKn57GiSeF4t3B4= X-MC-Unique: f2m5mYzOMsq2_6bnTT-n6A-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 27/36] migration: Do chunk page in postcopy_each_ram_send_discard() Date: Fri, 28 Jan 2022 19:30:24 +0100 Message-Id: <20220128183033.31998-28-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398941196100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Right now we loop ramblocks for twice, the 1st time chunk the dirty bits wi= th huge page information; the 2nd time we send the discard ranges. That's not necessary - we can do them in a single loop. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 91d32002e8..d74a8c04b6 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2454,6 +2454,8 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, RAMBlock *block) return 0; } =20 +static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *bl= ock); + /** * postcopy_each_ram_send_discard: discard all RAMBlocks * @@ -2475,6 +2477,14 @@ static int postcopy_each_ram_send_discard(MigrationS= tate *ms) RAMBLOCK_FOREACH_NOT_IGNORED(block) { postcopy_discard_send_init(ms, block->idstr); =20 + /* + * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent + * host-page size chunks, mark any partially dirty host-page size + * chunks as all dirty. In this case the host-page is the host-pa= ge + * for the particular RAMBlock, i.e. it might be a huge page. + */ + postcopy_chunk_hostpages_pass(ms, block); + /* * Postcopy sends chunks of bitmap over the wire, but it * just needs indexes at this point, avoids it having @@ -2575,7 +2585,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) int ram_postcopy_send_discard_bitmap(MigrationState *ms) { RAMState *rs =3D ram_state; - RAMBlock *block; =20 RCU_READ_LOCK_GUARD(); =20 @@ -2587,15 +2596,6 @@ int ram_postcopy_send_discard_bitmap(MigrationState = *ms) rs->last_sent_block =3D NULL; rs->last_page =3D 0; =20 - RAMBLOCK_FOREACH_NOT_IGNORED(block) { - /* - * Deal with TPS !=3D HPS and huge pages. It discard any partiall= y sent - * host-page size chunks, mark any partially dirty host-page size - * chunks as all dirty. In this case the host-page is the host-pa= ge - * for the particular RAMBlock, i.e. it might be a huge page. - */ - postcopy_chunk_hostpages_pass(ms, block); - } trace_ram_postcopy_send_discard_bitmap(); =20 return postcopy_each_ram_send_discard(ms); --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399249441617.9167017759761; Fri, 28 Jan 2022 11:47:29 -0800 (PST) Received: from localhost ([::1]:43048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXDU-0002Om-Ol for importer@patchew.org; Fri, 28 Jan 2022 14:47:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWAp-0001Sk-70 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:40:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWAk-0002DB-3m for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:40:36 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-NTPAcerCPYGEMsk9lzIrUA-1; Fri, 28 Jan 2022 13:40:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6296345AF; Fri, 28 Jan 2022 18:40:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 334D512E25; Fri, 28 Jan 2022 18:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gaBfMRbjowHnqRPDnBC7yhRQPALIIHNsXEKr4uCULw=; b=TZ7Z7mWEbNoHaRP0sQnPEFN3VN0wxbxvQyQBbIqRHMuDLo6QGOA56zf9TKDtpB45Da0MDr cCqVAxcV++6uCYuHwqcpVdkuO5Z+9BPNHsudkyfvi8AQIs5snaVnFhxE11CQcqB+UFfuEn N8dmJe9H7HmUBZIcqPzUqgZitp30ruY= X-MC-Unique: NTPAcerCPYGEMsk9lzIrUA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 28/36] migration: Drop return code for disgard ram process Date: Fri, 28 Jan 2022 19:30:25 +0100 Message-Id: <20220128183033.31998-29-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399251122100003 From: Peter Xu It will just never fail. Drop those return values where they're constantly zeros. A tiny touch-up on the tracepoint so trace_ram_postcopy_send_discard_bitmap= () is called after the logic itself (which sounds more reasonable). Signed-off-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.h | 2 +- migration/migration.c | 5 +---- migration/ram.c | 20 +++++--------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/migration/ram.h b/migration/ram.h index f543e25765..2c6dc3675d 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -57,7 +57,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t s= tart, ram_addr_t len); void acct_update_position(QEMUFile *f, size_t size, bool zero); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ -int ram_postcopy_send_discard_bitmap(MigrationState *ms); +void ram_postcopy_send_discard_bitmap(MigrationState *ms); /* For incoming postcopy discard */ int ram_discard_range(const char *block_name, uint64_t start, size_t lengt= h); int ram_postcopy_incoming_init(MigrationIncomingState *mis); diff --git a/migration/migration.c b/migration/migration.c index 3849b33108..771f3e2bec 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2991,10 +2991,7 @@ static int postcopy_start(MigrationState *ms) * that are dirty */ if (migrate_postcopy_ram()) { - if (ram_postcopy_send_discard_bitmap(ms)) { - error_report("postcopy send discard bitmap failed"); - goto fail; - } + ram_postcopy_send_discard_bitmap(ms); } =20 /* diff --git a/migration/ram.c b/migration/ram.c index d74a8c04b6..5489ee3b7a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2459,8 +2459,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block); /** * postcopy_each_ram_send_discard: discard all RAMBlocks * - * Returns 0 for success or negative for error - * * Utility for the outgoing postcopy code. * Calls postcopy_send_discard_bm_ram for each RAMBlock * passing it bitmap indexes and name. @@ -2469,10 +2467,9 @@ static void postcopy_chunk_hostpages_pass(MigrationS= tate *ms, RAMBlock *block); * * @ms: current migration state */ -static int postcopy_each_ram_send_discard(MigrationState *ms) +static void postcopy_each_ram_send_discard(MigrationState *ms) { struct RAMBlock *block; - int ret; =20 RAMBLOCK_FOREACH_NOT_IGNORED(block) { postcopy_discard_send_init(ms, block->idstr); @@ -2490,14 +2487,9 @@ static int postcopy_each_ram_send_discard(MigrationS= tate *ms) * just needs indexes at this point, avoids it having * target page specific code. */ - ret =3D postcopy_send_discard_bm_ram(ms, block); + postcopy_send_discard_bm_ram(ms, block); postcopy_discard_send_finish(ms); - if (ret) { - return ret; - } } - - return 0; } =20 /** @@ -2570,8 +2562,6 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) /** * ram_postcopy_send_discard_bitmap: transmit the discard bitmap * - * Returns zero on success - * * Transmit the set of pages to be discarded after precopy to the target * these are pages that: * a) Have been previously transmitted but are now dirty again @@ -2582,7 +2572,7 @@ static void postcopy_chunk_hostpages_pass(MigrationSt= ate *ms, RAMBlock *block) * * @ms: current migration state */ -int ram_postcopy_send_discard_bitmap(MigrationState *ms) +void ram_postcopy_send_discard_bitmap(MigrationState *ms) { RAMState *rs =3D ram_state; =20 @@ -2596,9 +2586,9 @@ int ram_postcopy_send_discard_bitmap(MigrationState *= ms) rs->last_sent_block =3D NULL; rs->last_page =3D 0; =20 + postcopy_each_ram_send_discard(ms); + trace_ram_postcopy_send_discard_bitmap(); - - return postcopy_each_ram_send_discard(ms); } =20 /** --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643400305659587.8111653196338; Fri, 28 Jan 2022 12:05:05 -0800 (PST) Received: from localhost ([::1]:37804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXUW-0001wE-Ru for importer@patchew.org; Fri, 28 Jan 2022 15:05:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCn-0001rJ-99 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCA-0002QT-WC for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:31 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-224-xc3CMPNYNoOh9ey7OmlowQ-1; Fri, 28 Jan 2022 13:41:20 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEEA119251A1; Fri, 28 Jan 2022 18:41:17 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 225D812E25; Fri, 28 Jan 2022 18:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hE2kigmqsLGNbYQ+L1kwrW1aVo1Qr7jSwGoqehKP/b8=; b=VsBwvd3REq4W06wFeUcObHOPuzJMycFEibc1YQ0jS81k5kV2nCtHiz3gkFEi60KzXXmI5c 8T4r7Y8+8a8BM8Nj85zFbaGl6albmM8L5RpJgClTPVjOh3I1/SV965Y3/Onsyv2GRMs2ub /v/bHqnN5gHYaFp6JORYBTfzw+h6rBA= X-MC-Unique: xc3CMPNYNoOh9ey7OmlowQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 29/36] migration: Don't return for postcopy_send_discard_bm_ram() Date: Fri, 28 Jan 2022 19:30:26 +0100 Message-Id: <20220128183033.31998-30-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , David Edmondson , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643400308826100001 From: Philippe Mathieu-Daud=C3=A9 postcopy_send_discard_bm_ram() always return zero. Since it can't fail, simplify and do not return anything. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Edmondson Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 5489ee3b7a..1771bbdb02 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2419,14 +2419,12 @@ void ram_postcopy_migrated_memory_release(Migration= State *ms) /** * postcopy_send_discard_bm_ram: discard a RAMBlock * - * Returns zero on success - * * Callback from postcopy_each_ram_send_discard for each RAMBlock * * @ms: current migration state * @block: RAMBlock to discard */ -static int postcopy_send_discard_bm_ram(MigrationState *ms, RAMBlock *bloc= k) +static void postcopy_send_discard_bm_ram(MigrationState *ms, RAMBlock *blo= ck) { unsigned long end =3D block->used_length >> TARGET_PAGE_BITS; unsigned long current; @@ -2450,8 +2448,6 @@ static int postcopy_send_discard_bm_ram(MigrationStat= e *ms, RAMBlock *block) postcopy_discard_send_range(ms, one, discard_length); current =3D one + discard_length; } - - return 0; } =20 static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *bl= ock); --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643399600139718.3380655207898; Fri, 28 Jan 2022 11:53:20 -0800 (PST) Received: from localhost ([::1]:53032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXJ9-0001Co-As for importer@patchew.org; Fri, 28 Jan 2022 14:53:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWDG-00024D-Q3 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:43:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCr-0002Uw-9N for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-171-rZXj0_rKNm-ZG2iDcMkrAA-1; Fri, 28 Jan 2022 13:42:08 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E054446860; Fri, 28 Jan 2022 18:42:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B8D912E25; Fri, 28 Jan 2022 18:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iXI6MpsEynOrVbApTNRU23ZTCAnXWnWLNK0+MEwOlaI=; b=V25owWO++kzaVqXwH2aPGlEDsIh0hLUDR8W+UkCnDTkbfaqz57GS8bg4jRTwrbHbd1AwCI 5hnQabGdYRA+TWah6r2UftaGRpRI4ovutB1neJlK8MvfY4dcOHc9hxKNclH1vUSsaP1+HW Mkpl6WI7JxPn3mSiIRKxqH/fzdDUlZY= X-MC-Unique: rZXj0_rKNm-ZG2iDcMkrAA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 30/36] migration: Introduce ram_transferred_add() Date: Fri, 28 Jan 2022 19:30:27 +0100 Message-Id: <20220128183033.31998-31-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , David Edmondson , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643399601536100001 From: David Edmondson Replace direct manipulation of ram_counters.transferred with a function. Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 1771bbdb02..619a1d9a6b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -387,6 +387,11 @@ uint64_t ram_bytes_remaining(void) =20 MigrationStats ram_counters; =20 +static void ram_transferred_add(uint64_t bytes) +{ + ram_counters.transferred +=3D bytes; +} + /* used by the search for pages to send */ struct PageSearchStatus { /* Current block being searched */ @@ -767,7 +772,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **cur= rent_data, * RAM_SAVE_FLAG_CONTINUE. */ xbzrle_counters.bytes +=3D bytes_xbzrle - 8; - ram_counters.transferred +=3D bytes_xbzrle; + ram_transferred_add(bytes_xbzrle); =20 return 1; } @@ -1208,7 +1213,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *blo= ck, ram_addr_t offset) =20 if (len) { ram_counters.duplicate++; - ram_counters.transferred +=3D len; + ram_transferred_add(len); return 1; } return -1; @@ -1235,7 +1240,7 @@ static bool control_save_page(RAMState *rs, RAMBlock = *block, ram_addr_t offset, } =20 if (bytes_xmit) { - ram_counters.transferred +=3D bytes_xmit; + ram_transferred_add(bytes_xmit); *pages =3D 1; } =20 @@ -1266,8 +1271,8 @@ static bool control_save_page(RAMState *rs, RAMBlock = *block, ram_addr_t offset, static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offs= et, uint8_t *buf, bool async) { - ram_counters.transferred +=3D save_page_header(rs, rs->f, block, - offset | RAM_SAVE_FLAG_PA= GE); + ram_transferred_add(save_page_header(rs, rs->f, block, + offset | RAM_SAVE_FLAG_PAGE)); if (async) { qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE, migrate_release_ram() & @@ -1275,7 +1280,7 @@ static int save_normal_page(RAMState *rs, RAMBlock *b= lock, ram_addr_t offset, } else { qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE); } - ram_counters.transferred +=3D TARGET_PAGE_SIZE; + ram_transferred_add(TARGET_PAGE_SIZE); ram_counters.normal++; return 1; } @@ -1367,7 +1372,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_strea= m *stream, RAMBlock *block, static void update_compress_thread_counts(const CompressParam *param, int bytes_xmit) { - ram_counters.transferred +=3D bytes_xmit; + ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { ram_counters.duplicate++; @@ -2284,7 +2289,7 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) ram_counters.duplicate +=3D pages; } else { ram_counters.normal +=3D pages; - ram_counters.transferred +=3D size; + ram_transferred_add(size); qemu_update_position(f, size); } } @@ -3040,7 +3045,7 @@ out: multifd_send_sync_main(rs->f); qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); - ram_counters.transferred +=3D 8; + ram_transferred_add(8); =20 ret =3D qemu_file_get_error(f); } --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643401264189184.15908394280484; Fri, 28 Jan 2022 12:21:04 -0800 (PST) Received: from localhost ([::1]:56170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXjy-0008VK-6x for importer@patchew.org; Fri, 28 Jan 2022 15:21:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCy-0001zK-Il for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCr-0002VR-4K for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-_C0uVfzHOVeLDThVN2JNpw-1; Fri, 28 Jan 2022 13:42:16 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD349101F7A4; Fri, 28 Jan 2022 18:42:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4669E12E25; Fri, 28 Jan 2022 18:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7qKHJ+kz44DX+SXjXAxR04KqrnALWnZetuh9UunKmNQ=; b=YCCliEhEFVQddPfm3tkEvlyRqouGo/FGHVn1HIiMk2ZvPcFDvXMomt5GuXQS1Ui/GHphmt 2H9nh7gCN8zsoGOyFP6Fj9fBcpNU/2HKzgXhQyQlzs/CKFSYNYpj2kkAijYMMI/XHQxgJo oz/RDwEgIFffGx2dpuPtSwPneWyJ5SM= X-MC-Unique: _C0uVfzHOVeLDThVN2JNpw-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 31/36] migration: Tally pre-copy, downtime and post-copy bytes independently Date: Fri, 28 Jan 2022 19:30:28 +0100 Message-Id: <20220128183033.31998-32-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , David Edmondson , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643401266182100001 From: David Edmondson Provide information on the number of bytes copied in the pre-copy, downtime and post-copy phases of migration. Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- qapi/migration.json | 13 ++++++++++++- migration/migration.c | 3 +++ migration/ram.c | 7 +++++++ monitor/hmp-cmds.c | 12 ++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index bbfd48cf0b..5975a0e104 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -46,6 +46,15 @@ # @pages-per-second: the number of memory pages transferred per second # (Since 4.0) # +# @precopy-bytes: The number of bytes sent in the pre-copy phase +# (since 7.0). +# +# @downtime-bytes: The number of bytes sent while the guest is paused +# (since 7.0). +# +# @postcopy-bytes: The number of bytes sent during the post-copy phase +# (since 7.0). +# # Since: 0.14 ## { 'struct': 'MigrationStats', @@ -54,7 +63,9 @@ 'normal-bytes': 'int', 'dirty-pages-rate' : 'int', 'mbps' : 'number', 'dirty-sync-count' : 'int', 'postcopy-requests' : 'int', 'page-size' : 'int', - 'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64' } } + 'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64', + 'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64', + 'postcopy-bytes' : 'uint64' } } =20 ## # @XBZRLECacheStats: diff --git a/migration/migration.c b/migration/migration.c index 771f3e2bec..bcc385b94b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1014,6 +1014,9 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D ram_counters.multifd_bytes; info->ram->pages_per_second =3D s->pages_per_second; + info->ram->precopy_bytes =3D ram_counters.precopy_bytes; + info->ram->downtime_bytes =3D ram_counters.downtime_bytes; + info->ram->postcopy_bytes =3D ram_counters.postcopy_bytes; =20 if (migrate_use_xbzrle()) { info->has_xbzrle_cache =3D true; diff --git a/migration/ram.c b/migration/ram.c index 619a1d9a6b..ca879c744f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -389,6 +389,13 @@ MigrationStats ram_counters; =20 static void ram_transferred_add(uint64_t bytes) { + if (runstate_is_running()) { + ram_counters.precopy_bytes +=3D bytes; + } else if (migration_in_postcopy()) { + ram_counters.postcopy_bytes +=3D bytes; + } else { + ram_counters.downtime_bytes +=3D bytes; + } ram_counters.transferred +=3D bytes; } =20 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 2669156b28..8c384dc1b2 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -293,6 +293,18 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) monitor_printf(mon, "postcopy request count: %" PRIu64 "\n", info->ram->postcopy_requests); } + if (info->ram->precopy_bytes) { + monitor_printf(mon, "precopy ram: %" PRIu64 " kbytes\n", + info->ram->precopy_bytes >> 10); + } + if (info->ram->downtime_bytes) { + monitor_printf(mon, "downtime ram: %" PRIu64 " kbytes\n", + info->ram->downtime_bytes >> 10); + } + if (info->ram->postcopy_bytes) { + monitor_printf(mon, "postcopy ram: %" PRIu64 " kbytes\n", + info->ram->postcopy_bytes >> 10); + } } =20 if (info->has_disk) { --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643400739589190.9854635520809; Fri, 28 Jan 2022 12:12:19 -0800 (PST) Received: from localhost ([::1]:46066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXbV-0008B8-Vu for importer@patchew.org; Fri, 28 Jan 2022 15:12:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCw-0001yO-MX for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:48046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCn-0002W1-2b for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-FcEUj3VXMKurSAHzPAJz-w-1; Fri, 28 Jan 2022 13:42:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9814746860; Fri, 28 Jan 2022 18:42:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B36577464; Fri, 28 Jan 2022 18:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkWkS3xp+0M05sMrGQxYgQctujCPIGIetcJubDJCE8Q=; b=Vlf3S1umMXchlJTtgORZvfJiP5y4U5aFbBKd902ok4xNtEdu1S/m7gzjMPgxHfajDHCwxk 0S47pQ7uwHe/qMlhpiLEpvs/qt85uBYscJ6RnCaB00F1xHe/9ET2GTeAXFI4/vvC4skFAj Hfjyta18UAFG2Ib6pyfhfjb+lAAc8zI= X-MC-Unique: FcEUj3VXMKurSAHzPAJz-w-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 32/36] migration: No off-by-one for pss->page update in host page size Date: Fri, 28 Jan 2022 19:30:29 +0100 Message-Id: <20220128183033.31998-33-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Kunkun Jiang , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Andrey Gruzdev , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Keqian Zhu , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643400744632100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu We used to do off-by-one fixup for pss->page when finished one host huge pa= ge transfer. That seems to be unnecesary at all. Drop it. Cc: Keqian Zhu Cc: Kunkun Jiang Cc: Andrey Gruzdev Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index ca879c744f..58adcaf430 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1617,7 +1617,7 @@ static int ram_save_release_protection(RAMState *rs, = PageSearchStatus *pss, /* Check if page is from UFFD-managed region. */ if (pss->block->flags & RAM_UF_WRITEPROTECT) { void *page_address =3D pss->block->host + (start_page << TARGET_PA= GE_BITS); - uint64_t run_length =3D (pss->page - start_page + 1) << TARGET_PAG= E_BITS; + uint64_t run_length =3D (pss->page - start_page) << TARGET_PAGE_BI= TS; =20 /* Flush async buffers before un-protect. */ qemu_fflush(rs->f); @@ -2230,7 +2230,7 @@ static int ram_save_host_page(RAMState *rs, PageSearc= hStatus *pss) offset_in_ramblock(pss->block, ((ram_addr_t)pss->page) << TARGET_PAGE_BIT= S)); /* The offset we leave with is the min boundary of host page and block= */ - pss->page =3D MIN(pss->page, hostpage_boundary) - 1; + pss->page =3D MIN(pss->page, hostpage_boundary); =20 res =3D ram_save_release_protection(rs, pss, start_page); return (res < 0 ? res : pages); --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398015760933.8851707477778; Fri, 28 Jan 2022 11:26:55 -0800 (PST) Received: from localhost ([::1]:39176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDWtb-0004Zi-07 for importer@patchew.org; Fri, 28 Jan 2022 14:26:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCz-00020f-2G for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCr-0002Wi-6b for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-199--RlGShxDM6ukzRTc6JEvkQ-1; Fri, 28 Jan 2022 13:42:31 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C92FC101F7A1; Fri, 28 Jan 2022 18:42:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id F11617745B; Fri, 28 Jan 2022 18:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WqBDQpUHEZjJ9CbMmxkFKgKY9VLv0LHeqJmfi5UhxQ4=; b=Nr/o5Mse+y2QdGzHlpSSA0Ah0Lm4zjyo1s93gAL+fxZAUQwWTJfbLtkRaH0HwqsecXsHod jDGD/Zp7uruyQj2jPxQMwpcNaDgeSjpFiyPxaDZZ1SDVIq3YA7mpGXvPfAotQyQaRYnnQf 4cx37maCoAaGPW8tNjsYI5nf2RZW09E= X-MC-Unique: -RlGShxDM6ukzRTc6JEvkQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 33/36] migration: Enable UFFD_FEATURE_THREAD_ID even without blocktime feat Date: Fri, 28 Jan 2022 19:30:30 +0100 Message-Id: <20220128183033.31998-34-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398018176100003 Content-Type: text/plain; charset="utf-8" From: Peter Xu This patch allows us to read the tid even without blocktime feature enabled. It's useful when tracing postcopy fault thread on faulted pages to show thr= ead id too with the address. Remove the comments - they're merely not helpful at all. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/postcopy-ram.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d18b5d05b2..2176ed68a5 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -283,15 +283,13 @@ static bool ufd_check_and_apply(int ufd, MigrationInc= omingState *mis) } =20 #ifdef UFFD_FEATURE_THREAD_ID - if (migrate_postcopy_blocktime() && mis && - UFFD_FEATURE_THREAD_ID & supported_features) { - /* kernel supports that feature */ - /* don't create blocktime_context if it exists */ - if (!mis->blocktime_ctx) { - mis->blocktime_ctx =3D blocktime_context_new(); - } - + if (UFFD_FEATURE_THREAD_ID & supported_features) { asked_features |=3D UFFD_FEATURE_THREAD_ID; + if (migrate_postcopy_blocktime()) { + if (!mis->blocktime_ctx) { + mis->blocktime_ctx =3D blocktime_context_new(); + } + } } #endif =20 --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643398479998433.29248941973344; Fri, 28 Jan 2022 11:34:39 -0800 (PST) Received: from localhost ([::1]:48172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDX15-0002gP-6m for importer@patchew.org; Fri, 28 Jan 2022 14:34:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWDG-00024C-Pm for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:43:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCr-0002Xo-9R for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:53 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-b_xV7t4SPpiKLMID18CrkQ-1; Fri, 28 Jan 2022 13:42:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E98EF46864; Fri, 28 Jan 2022 18:42:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30FC012E25; Fri, 28 Jan 2022 18:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TS6gx8Hyh/qhvZFYSgScu0p5q+84OON1lKmnMJrgHoY=; b=VP9ehslX/FFbzOdtZmJD8bGGBVf9D5NeNYaLM2kf07G42oRF7j/EInSrrvH8R3pfvZ1Ap8 82z54hdahXLyYmHcrJHI1ggwsRWiqmi6tMqpatyvZDOXh3smCZ1sp7uY9yI/GXPqDa0sZB iuwKX84Wt7u76Cr0xNuepoEMLqOrnY8= X-MC-Unique: b_xV7t4SPpiKLMID18CrkQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 34/36] migration: Add postcopy_has_request() Date: Fri, 28 Jan 2022 19:30:31 +0100 Message-Id: <20220128183033.31998-35-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URG_BIZ=0.573 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643398481735100003 Content-Type: text/plain; charset="utf-8" From: Peter Xu Add a helper to detect whether postcopy has pending request. Since at it, cleanup the code a bit, e.g. in unqueue_page() we shouldn't ne= ed to check it again on queue empty because we're the only one (besides cleanup code, which should never run during this process) that will take a request = off the list, so the request list can only grow but not shrink under the hood. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 58adcaf430..eb9db4f777 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -355,6 +355,12 @@ static RAMState *ram_state; =20 static NotifierWithReturnList precopy_notifier_list; =20 +/* Whether postcopy has queued requests? */ +static bool postcopy_has_request(RAMState *rs) +{ + return !QSIMPLEQ_EMPTY_ATOMIC(&rs->src_page_requests); +} + void precopy_infrastructure_init(void) { notifier_with_return_list_init(&precopy_notifier_list); @@ -1539,28 +1545,33 @@ static bool find_dirty_block(RAMState *rs, PageSear= chStatus *pss, bool *again) */ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset) { + struct RAMSrcPageRequest *entry; RAMBlock *block =3D NULL; =20 - if (QSIMPLEQ_EMPTY_ATOMIC(&rs->src_page_requests)) { + if (!postcopy_has_request(rs)) { return NULL; } =20 QEMU_LOCK_GUARD(&rs->src_page_req_mutex); - if (!QSIMPLEQ_EMPTY(&rs->src_page_requests)) { - struct RAMSrcPageRequest *entry =3D - QSIMPLEQ_FIRST(&rs->src_page_requests); - block =3D entry->rb; - *offset =3D entry->offset; =20 - if (entry->len > TARGET_PAGE_SIZE) { - entry->len -=3D TARGET_PAGE_SIZE; - entry->offset +=3D TARGET_PAGE_SIZE; - } else { - memory_region_unref(block->mr); - QSIMPLEQ_REMOVE_HEAD(&rs->src_page_requests, next_req); - g_free(entry); - migration_consume_urgent_request(); - } + /* + * This should _never_ change even after we take the lock, because no = one + * should be taking anything off the request list other than us. + */ + assert(postcopy_has_request(rs)); + + entry =3D QSIMPLEQ_FIRST(&rs->src_page_requests); + block =3D entry->rb; + *offset =3D entry->offset; + + if (entry->len > TARGET_PAGE_SIZE) { + entry->len -=3D TARGET_PAGE_SIZE; + entry->offset +=3D TARGET_PAGE_SIZE; + } else { + memory_region_unref(block->mr); + QSIMPLEQ_REMOVE_HEAD(&rs->src_page_requests, next_req); + g_free(entry); + migration_consume_urgent_request(); } =20 return block; @@ -2992,7 +3003,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) t0 =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); i =3D 0; while ((ret =3D qemu_file_rate_limit(f)) =3D=3D 0 || - !QSIMPLEQ_EMPTY(&rs->src_page_requests)) { + postcopy_has_request(rs)) { int pages; =20 if (qemu_file_get_error(f)) { --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643400238697693.7215907311453; Fri, 28 Jan 2022 12:03:58 -0800 (PST) Received: from localhost ([::1]:35474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXTQ-0000Le-N3 for importer@patchew.org; Fri, 28 Jan 2022 15:03:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWDQ-00027Y-Fb for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:43:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWCw-0002aE-75 for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:42:58 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-VoiAfaznPzS3aNo2Y--2eg-1; Fri, 28 Jan 2022 13:42:46 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1583A814245; Fri, 28 Jan 2022 18:42:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5676712E25; Fri, 28 Jan 2022 18:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NS9i5KtB9MDi6NvLNSXtcUhnOuwhJtpHaixEEDN6Yyo=; b=Mr6bQv3K0SkAs0+ajHUCczoavgWTOTJjI23SFjFsDopHiC6soFJd/kGgrQSrZu+vTND+hG GK2WWKbKjtuABxM9hH+xz61Fcb0LIsFPN37pm35D7gXpT8mJYNAMTdozbQmOMA8DdlDPmw CVgelXZTeuWVccRdq8aju/MMZ0DuqYs= X-MC-Unique: VoiAfaznPzS3aNo2Y--2eg-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 35/36] migration: Simplify unqueue_page() Date: Fri, 28 Jan 2022 19:30:32 +0100 Message-Id: <20220128183033.31998-36-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URG_BIZ=0.573 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643400240786100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu This patch simplifies unqueue_page() on both sides of it (itself, and calle= r). Firstly, due to the fact that right after unqueue_page() returned true, we'= ll definitely send a huge page (see ram_save_huge_page() call - it will _never_ exit before finish sending that huge page), so unqueue_page() does not need= to jump in small page size if huge page is enabled on the ramblock. IOW, it's destined that only the 1st 4K page will be valid, when unqueue the 2nd+ time we'll notice the whole huge page has already been sent anyway. Switching to operating on huge page reduces a lot of the loops of redundant unqueue_page= (). Meanwhile, drop the dirty check. It's not helpful to call test_bit() every time to jump over clean pages, as ram_save_host_page() has already done so, while in a faster way (see commit ba1b7c812c ("migration/ram: Optimize ram_save_host_page()", 2021-05-13)). So that's not necessary too. Drop the two tracepoints along the way - based on above analysis it's very possible that no one is really using it.. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 37 +++++++++++-------------------------- migration/trace-events | 3 +-- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index eb9db4f777..91ca743ac8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1547,6 +1547,7 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_= t *offset) { struct RAMSrcPageRequest *entry; RAMBlock *block =3D NULL; + size_t page_size; =20 if (!postcopy_has_request(rs)) { return NULL; @@ -1563,10 +1564,13 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_add= r_t *offset) entry =3D QSIMPLEQ_FIRST(&rs->src_page_requests); block =3D entry->rb; *offset =3D entry->offset; + page_size =3D qemu_ram_pagesize(block); + /* Each page request should only be multiple page size of the ramblock= */ + assert((entry->len % page_size) =3D=3D 0); =20 - if (entry->len > TARGET_PAGE_SIZE) { - entry->len -=3D TARGET_PAGE_SIZE; - entry->offset +=3D TARGET_PAGE_SIZE; + if (entry->len > page_size) { + entry->len -=3D page_size; + entry->offset +=3D page_size; } else { memory_region_unref(block->mr); QSIMPLEQ_REMOVE_HEAD(&rs->src_page_requests, next_req); @@ -1574,6 +1578,9 @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_= t *offset) migration_consume_urgent_request(); } =20 + trace_unqueue_page(block->idstr, *offset, + test_bit((*offset >> TARGET_PAGE_BITS), block->bmap= )); + return block; } =20 @@ -1948,30 +1955,8 @@ static bool get_queued_page(RAMState *rs, PageSearch= Status *pss) { RAMBlock *block; ram_addr_t offset; - bool dirty; =20 - do { - block =3D unqueue_page(rs, &offset); - /* - * We're sending this page, and since it's postcopy nothing else - * will dirty it, and we must make sure it doesn't get sent again - * even if this queue request was received after the background - * search already sent it. - */ - if (block) { - unsigned long page; - - page =3D offset >> TARGET_PAGE_BITS; - dirty =3D test_bit(page, block->bmap); - if (!dirty) { - trace_get_queued_page_not_dirty(block->idstr, (uint64_t)of= fset, - page); - } else { - trace_get_queued_page(block->idstr, (uint64_t)offset, page= ); - } - } - - } while (block && !dirty); + block =3D unqueue_page(rs, &offset); =20 if (!block) { /* diff --git a/migration/trace-events b/migration/trace-events index 171a83a55d..48aa7b10ee 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -86,8 +86,6 @@ put_qlist_end(const char *field_name, const char *vmsd_na= me) "%s(%s)" qemu_file_fclose(void) "" =20 # ram.c -get_queued_page(const char *block_name, uint64_t tmp_offset, unsigned long= page_abs) "%s/0x%" PRIx64 " page_abs=3D0x%lx" -get_queued_page_not_dirty(const char *block_name, uint64_t tmp_offset, uns= igned long page_abs) "%s/0x%" PRIx64 " page_abs=3D0x%lx" migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, uns= igned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx" @@ -113,6 +111,7 @@ ram_save_iterate_big_wait(uint64_t milliconds, int iter= ations) "big wait: %" PRI ram_load_complete(int ret, uint64_t seq_iter) "exit_code %d seq iteration = %" PRIu64 ram_write_tracking_ramblock_start(const char *block_id, size_t page_size, = void *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu" ram_write_tracking_ramblock_stop(const char *block_id, size_t page_size, v= oid *addr, size_t length) "%s: page_size: %zu addr: %p length: %zu" +unqueue_page(char *block, uint64_t offset, bool dirty) "ramblock '%s' offs= et 0x%"PRIx64" dirty %d" =20 # multifd.c multifd_new_send_channel_async(uint8_t id) "channel %u" --=20 2.34.1 From nobody Sun Feb 8 17:26:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1643400104993498.65462074134996; Fri, 28 Jan 2022 12:01:44 -0800 (PST) Received: from localhost ([::1]:60694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDXRH-0006Zg-0V for importer@patchew.org; Fri, 28 Jan 2022 15:01:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWDS-00029w-UR for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:43:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50500) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDWD9-0002c2-Gt for qemu-devel@nongnu.org; Fri, 28 Jan 2022 13:43:20 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-VX04Gg0LMee03O_N4xYjHA-1; Fri, 28 Jan 2022 13:42:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 515F8101F7A1; Fri, 28 Jan 2022 18:42:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 789AF77456; Fri, 28 Jan 2022 18:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643395376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wq2DgU0T8TiyoW+AeqpkEASJI3l+VWw2yOgyjpGNPwo=; b=I/6+Oh2oC1LhJ9Bz+XTgG2BO920DpJALigfSXvzC4aoRGLj3MjvRUXkeQ9DU37SaNYyRWM yk+OTH9VvQrJ7bNg2mAUgB0DJs7/TIpvz1j0M6nmubUr9ggH3RPSxCYKDMM52K644SGMBf 42SKla4qkrtjPv6QFcdj2diTn4Pus/c= X-MC-Unique: VX04Gg0LMee03O_N4xYjHA-1 From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 36/36] migration: Move temp page setup and cleanup into separate functions Date: Fri, 28 Jan 2022 19:30:33 +0100 Message-Id: <20220128183033.31998-37-quintela@redhat.com> In-Reply-To: <20220128183033.31998-1-quintela@redhat.com> References: <20220128183033.31998-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ani Sinha , "Edgar E. Iglesias" , Eric Blake , Hannes Reinecke , Vikram Garhwal , qemu-block@nongnu.org, Juan Quintela , Daniel Henrique Barboza , Markus Armbruster , Artyom Tarasenko , Pavel Pisa , Alistair Francis , "Dr. David Alan Gilbert" , Greg Kurz , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Igor Mammedov , Stafford Horne , David Gibson , Laurent Vivier , Andrew Baumann , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1643400108484100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu Temp pages will need to grow if we want to have multiple channels for postc= opy, because each channel will need its own temp page to cache huge page data. Before doing that, cleanup the related code. No functional change intended. Since at it, touch up the errno handling a little bit on the setup side. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/postcopy-ram.c | 82 +++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 31 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 2176ed68a5..e662dd05cc 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -523,6 +523,19 @@ int postcopy_ram_incoming_init(MigrationIncomingState = *mis) return 0; } =20 +static void postcopy_temp_pages_cleanup(MigrationIncomingState *mis) +{ + if (mis->postcopy_tmp_page) { + munmap(mis->postcopy_tmp_page, mis->largest_page_size); + mis->postcopy_tmp_page =3D NULL; + } + + if (mis->postcopy_tmp_zero_page) { + munmap(mis->postcopy_tmp_zero_page, mis->largest_page_size); + mis->postcopy_tmp_zero_page =3D NULL; + } +} + /* * At the end of a migration where postcopy_ram_incoming_init was called. */ @@ -564,14 +577,8 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingSta= te *mis) } } =20 - if (mis->postcopy_tmp_page) { - munmap(mis->postcopy_tmp_page, mis->largest_page_size); - mis->postcopy_tmp_page =3D NULL; - } - if (mis->postcopy_tmp_zero_page) { - munmap(mis->postcopy_tmp_zero_page, mis->largest_page_size); - mis->postcopy_tmp_zero_page =3D NULL; - } + postcopy_temp_pages_cleanup(mis); + trace_postcopy_ram_incoming_cleanup_blocktime( get_postcopy_total_blocktime()); =20 @@ -1082,6 +1089,40 @@ retry: return NULL; } =20 +static int postcopy_temp_pages_setup(MigrationIncomingState *mis) +{ + int err; + + mis->postcopy_tmp_page =3D mmap(NULL, mis->largest_page_size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (mis->postcopy_tmp_page =3D=3D MAP_FAILED) { + err =3D errno; + mis->postcopy_tmp_page =3D NULL; + error_report("%s: Failed to map postcopy_tmp_page %s", + __func__, strerror(err)); + return -err; + } + + /* + * Map large zero page when kernel can't use UFFDIO_ZEROPAGE for hugep= ages + */ + mis->postcopy_tmp_zero_page =3D mmap(NULL, mis->largest_page_size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (mis->postcopy_tmp_zero_page =3D=3D MAP_FAILED) { + err =3D errno; + mis->postcopy_tmp_zero_page =3D NULL; + error_report("%s: Failed to map large zero page %s", + __func__, strerror(err)); + return -err; + } + + memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_size); + + return 0; +} + int postcopy_ram_incoming_setup(MigrationIncomingState *mis) { /* Open the fd for the kernel to give us userfaults */ @@ -1122,32 +1163,11 @@ int postcopy_ram_incoming_setup(MigrationIncomingSt= ate *mis) return -1; } =20 - mis->postcopy_tmp_page =3D mmap(NULL, mis->largest_page_size, - PROT_READ | PROT_WRITE, MAP_PRIVATE | - MAP_ANONYMOUS, -1, 0); - if (mis->postcopy_tmp_page =3D=3D MAP_FAILED) { - mis->postcopy_tmp_page =3D NULL; - error_report("%s: Failed to map postcopy_tmp_page %s", - __func__, strerror(errno)); + if (postcopy_temp_pages_setup(mis)) { + /* Error dumped in the sub-function */ return -1; } =20 - /* - * Map large zero page when kernel can't use UFFDIO_ZEROPAGE for hugep= ages - */ - mis->postcopy_tmp_zero_page =3D mmap(NULL, mis->largest_page_size, - PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, - -1, 0); - if (mis->postcopy_tmp_zero_page =3D=3D MAP_FAILED) { - int e =3D errno; - mis->postcopy_tmp_zero_page =3D NULL; - error_report("%s: Failed to map large zero page %s", - __func__, strerror(e)); - return -e; - } - memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_size); - trace_postcopy_ram_enable_notify(); =20 return 0; --=20 2.34.1