From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998266; cv=none; d=zohomail.com; s=zohoarc; b=Zi3lpIDkl5RKJNOBS5FPNK40U6ba2auK/aJRNrIDkFQh/NS2sTgnY6MmRg/pRgxqcrF1E1pLt4QSUnLx9WzgcU9KoDavm+cQeFXi/61FgM5XwTIKtdDohYglYKE8HmV4fvFKljq9z1Y635VK3qXU27k94FWfY4PZSEYis4O0bT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998266; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F0DKw/keRJS/3Opg9TuLEVCEp4FcWvWnokO5BdfxHfo=; b=ku0lh5iIqvA1Oy9JCgzFNLDl3C24wC+gPz5QEl6Lfl70Ym7YX5DshsxJLZOxQaBik9kTJrteZhe6sJj9Oom/h7H5enXQlqRSYiH1OeUVt8Mda7bmUMhF7gcR97kSTFmt7nDxLERQy3XBplX7Y0KQfWcsNpO4Kcte6vszpQvwnrw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998266276243.0376584787947; Thu, 20 Apr 2023 06:44:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWW-0003tR-3U; Thu, 20 Apr 2023 09:40:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWU-0003rX-7j for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWH-0005fe-Nb for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:29 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-104-yV0IE0GPPva31X7-aU-N4g-1; Thu, 20 Apr 2023 09:40:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25BF01C05AFA; Thu, 20 Apr 2023 13:40:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83BFC4020BED; Thu, 20 Apr 2023 13:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F0DKw/keRJS/3Opg9TuLEVCEp4FcWvWnokO5BdfxHfo=; b=T8fJqGD8UilwNNZRqiyON9UQN9Dwmzfu3jyrXD9rjCdek+6mUG3oQyiB7UUaWQNu23wZU/ yQeH3buRu3+9ugRUkPWyZBm9Gz659M679b3oNSGiRKt8jhhOPzSdHPeOnejOjBgLSEBC59 MOAH9vvPsKm972dOHL+x5k9X6ACvTzY= X-MC-Unique: yV0IE0GPPva31X7-aU-N4g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 01/43] migration: move migration_global_dump() to migration-hmp-cmds.c Date: Thu, 20 Apr 2023 15:39:20 +0200 Message-Id: <20230420134002.29531-2-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998267247100007 Content-Type: text/plain; charset="utf-8" It is only used there, so we can make it static. Once there, remove spice.h that it is not used. Signed-off-by: Juan Quintela --- fix David Edmonson ui/qemu-spice.h unintended removal --- include/migration/misc.h | 1 - migration/migration-hmp-cmds.c | 22 +++++++++++++++++++++- migration/migration.c | 19 ------------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 8b49841016..5ebe13b4b9 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -66,7 +66,6 @@ bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); /* ...and after the device transmission */ bool migration_in_postcopy_after_devices(MigrationState *); -void migration_global_dump(Monitor *mon); /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */ bool migration_in_incoming_postcopy(void); /* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */ diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 72519ea99f..71da91967a 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -15,7 +15,6 @@ =20 #include "qemu/osdep.h" #include "block/qapi.h" -#include "migration/misc.h" #include "migration/snapshot.h" #include "monitor/hmp.h" #include "monitor/monitor.h" @@ -30,6 +29,27 @@ #include "qemu/sockets.h" #include "sysemu/runstate.h" #include "ui/qemu-spice.h" +#include "sysemu/sysemu.h" +#include "migration.h" + +static void migration_global_dump(Monitor *mon) +{ + MigrationState *ms =3D migrate_get_current(); + + monitor_printf(mon, "globals:\n"); + monitor_printf(mon, "store-global-state: %s\n", + ms->store_global_state ? "on" : "off"); + monitor_printf(mon, "only-migratable: %s\n", + only_migratable ? "on" : "off"); + monitor_printf(mon, "send-configuration: %s\n", + ms->send_configuration ? "on" : "off"); + monitor_printf(mon, "send-section-footer: %s\n", + ms->send_section_footer ? "on" : "off"); + monitor_printf(mon, "decompress-error-check: %s\n", + ms->decompress_error_check ? "on" : "off"); + monitor_printf(mon, "clear-bitmap-shift: %u\n", + ms->clear_bitmap_shift); +} =20 void hmp_info_migrate(Monitor *mon, const QDict *qdict) { diff --git a/migration/migration.c b/migration/migration.c index 7b0d4a9d8f..4be66b1956 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -4421,25 +4421,6 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) s->migration_thread_running =3D true; } =20 -void migration_global_dump(Monitor *mon) -{ - MigrationState *ms =3D migrate_get_current(); - - monitor_printf(mon, "globals:\n"); - monitor_printf(mon, "store-global-state: %s\n", - ms->store_global_state ? "on" : "off"); - monitor_printf(mon, "only-migratable: %s\n", - only_migratable ? "on" : "off"); - monitor_printf(mon, "send-configuration: %s\n", - ms->send_configuration ? "on" : "off"); - monitor_printf(mon, "send-section-footer: %s\n", - ms->send_section_footer ? "on" : "off"); - monitor_printf(mon, "decompress-error-check: %s\n", - ms->decompress_error_check ? "on" : "off"); - monitor_printf(mon, "clear-bitmap-shift: %u\n", - ms->clear_bitmap_shift); -} - #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998116; cv=none; d=zohomail.com; s=zohoarc; b=eDIa/f8WyM0yNNkte33UJdmAq7L2SRZ8/JRmhpDK8qT2OrsxqZaj/7cad4IUU3aW62rRUxLtuzY0Fp3ClXbRZpMU7qiabMJCytNWCBRxfp7958yA4eAYKTVZNZ00kAB9UhFFdSmgfEvQa3jMQ4h3ccDr7wg2rW4313VA4ms5n4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998116; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l4NYtI/4cyE62qQG3EUsaHCVpbhDI+HOOFZUgmueKG0=; b=T0THdzOHBjIC+ZeR1LYqKscEOIMV0ou/nIk7U3ainqx+KM5Qz2YnGfE34vatueeV56/m1bRCWEmdlYPP1PmeCOILTcs9kZJz9nPjeM/Ade/jmDT2mOd6GfQJyB8cNi2JQkHnjMkfVyPma2kiyYBO/xztwx41uFs52E87c5dxmTg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998116108612.5919684526823; Thu, 20 Apr 2023 06:41:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWJ-0003nf-Iw; Thu, 20 Apr 2023 09:40:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWI-0003nO-Dz for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWG-0005ez-Jb for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:18 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-376-jN7PNLAbPWK7oP6J7QhaUw-1; Thu, 20 Apr 2023 09:40:12 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FCAB3C0C8A7; Thu, 20 Apr 2023 13:40:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68C794020BED; Thu, 20 Apr 2023 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l4NYtI/4cyE62qQG3EUsaHCVpbhDI+HOOFZUgmueKG0=; b=EyM03nzn/2EYj7WD7DCK25OxzCSYoVwSKV0f7gxyu0XZFEpM8DarH/hxFodzdCAOFiQv/b cJopB1L4GIG1VWKrPPq+BK2wU5i/rYY8NzdhdRZ6H/aqfwq+juvmNg3lGvvEfvOEgDcokD YIaBhEhfHKE28LX9QL4Z+0lxpHNBaBM= X-MC-Unique: jN7PNLAbPWK7oP6J7QhaUw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 02/43] spice: move client_migrate_info command to ui/ Date: Thu, 20 Apr 2023 15:39:21 +0200 Message-Id: <20230420134002.29531-3-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998118171100007 Content-Type: text/plain; charset="utf-8" It has nothing to do with migration, except for the "migrate" in the name of the command. Move it with the rest of the ui commands. Signed-off-by: Juan Quintela --- I would claim that it should be only compiled with CONFIG_SPICE, but I left that to spice maintainers. --- migration/migration-hmp-cmds.c | 18 ------------------ migration/migration.c | 30 ------------------------------ qapi/migration.json | 28 ---------------------------- qapi/ui.json | 28 ++++++++++++++++++++++++++++ ui/ui-hmp-cmds.c | 17 +++++++++++++++++ ui/ui-qmp-cmds.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 76 deletions(-) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 71da91967a..83f214d145 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -28,7 +28,6 @@ #include "qemu/error-report.h" #include "qemu/sockets.h" #include "sysemu/runstate.h" -#include "ui/qemu-spice.h" #include "sysemu/sysemu.h" #include "migration.h" =20 @@ -636,23 +635,6 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) hmp_handle_error(mon, err); } =20 -void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) -{ - Error *err =3D NULL; - const char *protocol =3D qdict_get_str(qdict, "protocol"); - const char *hostname =3D qdict_get_str(qdict, "hostname"); - bool has_port =3D qdict_haskey(qdict, "port"); - int port =3D qdict_get_try_int(qdict, "port", -1); - bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); - int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); - const char *cert_subject =3D qdict_get_try_str(qdict, "cert-subject"); - - qmp_client_migrate_info(protocol, hostname, - has_port, port, has_tls_port, tls_port, - cert_subject, &err); - hmp_handle_error(mon, err); -} - void hmp_migrate_start_postcopy(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; diff --git a/migration/migration.c b/migration/migration.c index 4be66b1956..74f28cdca6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -63,7 +63,6 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" -#include "ui/qemu-spice.h" =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 @@ -1018,35 +1017,6 @@ MigrationParameters *qmp_query_migrate_parameters(Er= ror **errp) return params; } =20 -void qmp_client_migrate_info(const char *protocol, const char *hostname, - bool has_port, int64_t port, - bool has_tls_port, int64_t tls_port, - const char *cert_subject, - Error **errp) -{ - if (strcmp(protocol, "spice") =3D=3D 0) { - if (!qemu_using_spice(errp)) { - return; - } - - if (!has_port && !has_tls_port) { - error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port"); - return; - } - - if (qemu_spice.migrate_info(hostname, - has_port ? port : -1, - has_tls_port ? tls_port : -1, - cert_subject)) { - error_setg(errp, "Could not set up display for migration"); - return; - } - return; - } - - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); -} - AnnounceParameters *migrate_announce_params(void) { static AnnounceParameters ap; diff --git a/qapi/migration.json b/qapi/migration.json index c84fa10e86..2c35b7b9cf 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1203,34 +1203,6 @@ { 'command': 'query-migrate-parameters', 'returns': 'MigrationParameters' } =20 -## -# @client_migrate_info: -# -# Set migration information for remote display. This makes the server -# ask the client to automatically reconnect using the new parameters -# once migration finished successfully. Only implemented for SPICE. -# -# @protocol: must be "spice" -# @hostname: migration target hostname -# @port: spice tcp port for plaintext channels -# @tls-port: spice tcp port for tls-secured channels -# @cert-subject: server certificate subject -# -# Since: 0.14 -# -# Example: -# -# -> { "execute": "client_migrate_info", -# "arguments": { "protocol": "spice", -# "hostname": "virt42.lab.kraxel.org", -# "port": 1234 } } -# <- { "return": {} } -# -## -{ 'command': 'client_migrate_info', - 'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int', - '*tls-port': 'int', '*cert-subject': 'str' } } - ## # @migrate-start-postcopy: # diff --git a/qapi/ui.json b/qapi/ui.json index 98322342f7..7ddd27a932 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1554,3 +1554,31 @@ { 'command': 'display-update', 'data': 'DisplayUpdateOptions', 'boxed' : true } + +## +# @client_migrate_info: +# +# Set migration information for remote display. This makes the server +# ask the client to automatically reconnect using the new parameters +# once migration finished successfully. Only implemented for SPICE. +# +# @protocol: must be "spice" +# @hostname: migration target hostname +# @port: spice tcp port for plaintext channels +# @tls-port: spice tcp port for tls-secured channels +# @cert-subject: server certificate subject +# +# Since: 0.14 +# +# Example: +# +# -> { "execute": "client_migrate_info", +# "arguments": { "protocol": "spice", +# "hostname": "virt42.lab.kraxel.org", +# "port": 1234 } } +# <- { "return": {} } +# +## +{ 'command': 'client_migrate_info', + 'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int', + '*tls-port': 'int', '*cert-subject': 'str' } } diff --git a/ui/ui-hmp-cmds.c b/ui/ui-hmp-cmds.c index 5c456ecc02..c671389473 100644 --- a/ui/ui-hmp-cmds.c +++ b/ui/ui-hmp-cmds.c @@ -458,3 +458,20 @@ hmp_screendump(Monitor *mon, const QDict *qdict) end: hmp_handle_error(mon, err); } + +void hmp_client_migrate_info(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + const char *protocol =3D qdict_get_str(qdict, "protocol"); + const char *hostname =3D qdict_get_str(qdict, "hostname"); + bool has_port =3D qdict_haskey(qdict, "port"); + int port =3D qdict_get_try_int(qdict, "port", -1); + bool has_tls_port =3D qdict_haskey(qdict, "tls-port"); + int tls_port =3D qdict_get_try_int(qdict, "tls-port", -1); + const char *cert_subject =3D qdict_get_try_str(qdict, "cert-subject"); + + qmp_client_migrate_info(protocol, hostname, + has_port, port, has_tls_port, tls_port, + cert_subject, &err); + hmp_handle_error(mon, err); +} diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index dbc4afcd73..a37a7024f3 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -175,3 +175,32 @@ void qmp_display_update(DisplayUpdateOptions *arg, Err= or **errp) abort(); } } + +void qmp_client_migrate_info(const char *protocol, const char *hostname, + bool has_port, int64_t port, + bool has_tls_port, int64_t tls_port, + const char *cert_subject, + Error **errp) +{ + if (strcmp(protocol, "spice") =3D=3D 0) { + if (!qemu_using_spice(errp)) { + return; + } + + if (!has_port && !has_tls_port) { + error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port"); + return; + } + + if (qemu_spice.migrate_info(hostname, + has_port ? port : -1, + has_tls_port ? tls_port : -1, + cert_subject)) { + error_setg(errp, "Could not set up display for migration"); + return; + } + return; + } + + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'"); +} --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998652; cv=none; d=zohomail.com; s=zohoarc; b=d8CuXQhCLxuVH8mXDnU0N+EoI4UM9dIxxDpJQQJE1yHbFyOJHNtBw/Si9Ps+VwvalmA97X5CIFQPNy9vw6jETsiJWojtFIBQHj7b+Woo0x2ebK9Tkwp/lLu6eSLP3mQbg3isbIaxkstmRvGpRXFYM4TIhPaz6Q8cPZjVISUbE0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998652; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Pmn40ihQ+Tw1GGdVR1e0HZoctLKora7ccUUnZwFEQP4=; b=IZYZEHT4rDNqKtIqvchQ+GoehgLqFezvb64W8IvWl+v3v0GOOSMitVP2hRrO0q9t5aI0BYfvmgtIfI23mSURwiWldO5WXRdSUNX8j78pq0w9ksfstLo7ibQqX6ESObz4axNeXOeLvOD/1/pP1gdu+UkZBvMvUEq1qfwehNNZOQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16819986528731022.7369285682563; Thu, 20 Apr 2023 06:50:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWM-0003pO-Kv; Thu, 20 Apr 2023 09:40:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWL-0003oL-2D for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWJ-0005gK-70 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:20 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446--_L65ptzNvireMbEee0BKA-1; Thu, 20 Apr 2023 09:40:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E9799381D4C3; Thu, 20 Apr 2023 13:40:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62D634020BED; Thu, 20 Apr 2023 13:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998018; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pmn40ihQ+Tw1GGdVR1e0HZoctLKora7ccUUnZwFEQP4=; b=E/VZv5t8/xIn1wWz3YTiZ6YfQikxkUy3rLeAlfeaEehAghGp93oGl1C6OggiubGefgFySx i9k3Sp61PzcxM93/+b6vmp5GrP7t8M1SMt7CsI0JXfd7u1nLxiBCsuiR45Er+VwKTZpA5U UqEOwPYh1NCwCmTkMIpX5CZYKEAZJnU= X-MC-Unique: -_L65ptzNvireMbEee0BKA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 03/43] migration: Create migration_cap_set() Date: Thu, 20 Apr 2023 15:39:22 +0200 Message-Id: <20230420134002.29531-4-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998653115100001 Content-Type: text/plain; charset="utf-8" And remove the convoluted use of qmp_migrate_set_capabilities() to enable disable MIGRATION_CAPABILITY_BLOCK. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 74f28cdca6..4bf5df4778 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1913,25 +1913,24 @@ void migrate_set_state(int *state, int old_state, i= nt new_state) } } =20 -static MigrationCapabilityStatus *migrate_cap_add(MigrationCapability inde= x, - bool state) +static bool migrate_cap_set(int cap, bool value, Error **errp) { - MigrationCapabilityStatus *cap; + MigrationState *s =3D migrate_get_current(); + bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 - cap =3D g_new0(MigrationCapabilityStatus, 1); - cap->capability =3D index; - cap->state =3D state; + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return false; + } =20 - return cap; -} + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + new_caps[cap] =3D value; =20 -void migrate_set_block_enabled(bool value, Error **errp) -{ - MigrationCapabilityStatusList *cap =3D NULL; - - QAPI_LIST_PREPEND(cap, migrate_cap_add(MIGRATION_CAPABILITY_BLOCK, val= ue)); - qmp_migrate_set_capabilities(cap, errp); - qapi_free_MigrationCapabilityStatusList(cap); + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return false; + } + s->capabilities[cap] =3D value; + return true; } =20 static void migrate_set_block_incremental(MigrationState *s, bool value) @@ -1943,7 +1942,7 @@ static void block_cleanup_parameters(MigrationState *= s) { if (s->must_remove_block_options) { /* setting to false can never fail */ - migrate_set_block_enabled(false, &error_abort); + migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); migrate_set_block_incremental(s, false); s->must_remove_block_options =3D false; } @@ -2430,8 +2429,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, "current migration capabilities"); return false; } - migrate_set_block_enabled(true, &local_err); - if (local_err) { + if (!migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, true, &local_err)= ) { error_propagate(errp, local_err); return false; } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998448; cv=none; d=zohomail.com; s=zohoarc; b=IDSewtyS9cSuU0N1VzZzwqqvGv9lOzdhJ4rqOFkXVXP217jR0QecJTZQHLyIJQiboK/GUPyyWJa9DiyRMkK3oBYG92G/FYo2SNI8Zsun1pHgfWyKd5/tKafNnSk3sBoo+731yo2UmUQMODTdlk5wqEQiH/GecuXY7jSJO447XdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998448; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CDb/Iwd6YqwC07N9+1pDyYMiiCS+XGSRAly6v9UN2Xg=; b=MpkCvBra5+4lI0u6GNefOZF37ULQEs81UfVay1ZPlI1OVW9822LJy1pd0cDVMsoY6TTlc1Ro9CVCPBnlgYS8T9wPQonYmLJz1zzdxxpZjw5ksg/y6qBAFNIBa0C/e8oloKs3lt0Mh92pt43StwG2KzXzIwvrazSZXI8uQ2/MA2I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998448302257.801209859737; Thu, 20 Apr 2023 06:47:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWX-0003un-RE; Thu, 20 Apr 2023 09:40:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWV-0003tI-O9 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWO-0005hZ-6G for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:31 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-WhlVt-nWPFWTlcm-AqS2qg-1; Thu, 20 Apr 2023 09:40:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16AF3185A794; Thu, 20 Apr 2023 13:40:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 399FF4020BF0; Thu, 20 Apr 2023 13:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CDb/Iwd6YqwC07N9+1pDyYMiiCS+XGSRAly6v9UN2Xg=; b=GhUtpqQuHip55h5JnmsooWELdJrik1PvQj6uD6+nlkWRoAcnkDuaW02q8dUS3Yp1G7h12+ Q52MaA1NhSyNmMp0ICaP44zhUa8oDYf352lvK1E7BNqYK3SXGB11hOZ6q1VOKBonFE4dIB uuaU02uXR3mVufTffmjjdIum/jaNqjA= X-MC-Unique: WhlVt-nWPFWTlcm-AqS2qg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake , "Dr . David Alan Gilbert" Subject: [PATCH v2 04/43] migration: Create options.c Date: Thu, 20 Apr 2023 15:39:23 +0200 Message-Id: <20230420134002.29531-5-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998449701100003 Content-Type: text/plain; charset="utf-8" We move there all capabilities helpers from migration.c. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- Following David advise: - looked through the history, capabilities are newer than 2012, so we can remove that bit of the header. - This part is posterior to Anthony. Original Author is Orit. Once there, I put myself. Peter Xu also did quite a bit of work here. Anyone else wants/needs to be there? I didn't search too hard because nobody asked before to be added. What do you think? --- hw/virtio/virtio-balloon.c | 1 + migration/block-dirty-bitmap.c | 1 + migration/block.c | 1 + migration/colo.c | 1 + migration/meson.build | 1 + migration/migration.c | 109 +---------------------------- migration/migration.h | 12 ---- migration/options.c | 124 +++++++++++++++++++++++++++++++++ migration/options.h | 32 +++++++++ migration/postcopy-ram.c | 1 + migration/ram.c | 1 + migration/savevm.c | 1 + migration/socket.c | 1 + 13 files changed, 166 insertions(+), 120 deletions(-) create mode 100644 migration/options.c create mode 100644 migration/options.h diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 746f07c4d2..43092aa634 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -32,6 +32,7 @@ #include "qemu/error-report.h" #include "migration/misc.h" #include "migration/migration.h" +#include "migration/options.h" =20 #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index fe73aa94b1..a6ffae0002 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -79,6 +79,7 @@ #include "qapi/qapi-visit-migration.h" #include "qapi/clone-visitor.h" #include "trace.h" +#include "options.h" =20 #define CHUNK_SIZE (1 << 10) =20 diff --git a/migration/block.c b/migration/block.c index b2497bbd32..4b167fa5cf 100644 --- a/migration/block.c +++ b/migration/block.c @@ -28,6 +28,7 @@ #include "migration/vmstate.h" #include "sysemu/block-backend.h" #include "trace.h" +#include "options.h" =20 #define BLK_MIG_BLOCK_SIZE (1ULL << 20) #define BDRV_SECTORS_PER_DIRTY_CHUNK (BLK_MIG_BLOCK_SIZE >> BDRV_SECTOR_BI= TS) diff --git a/migration/colo.c b/migration/colo.c index 0716e64689..93b78c9270 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -36,6 +36,7 @@ #include "sysemu/cpus.h" #include "sysemu/runstate.h" #include "net/filter.h" +#include "options.h" =20 static bool vmstate_loading; static Notifier packets_compare_notifier; diff --git a/migration/meson.build b/migration/meson.build index 0d1bb9f96e..480ff6854a 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -22,6 +22,7 @@ softmmu_ss.add(files( 'migration.c', 'multifd.c', 'multifd-zlib.c', + 'options.c', 'postcopy-ram.c', 'savevm.c', 'socket.c', diff --git a/migration/migration.c b/migration/migration.c index 4bf5df4778..4bcccdd129 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -63,6 +63,7 @@ #include "sysemu/cpus.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "options.h" =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 @@ -357,15 +358,6 @@ static void migrate_generate_event(int new_state) } } =20 -static bool migrate_late_block_activate(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; -} - /* * Send a message on the return channel back to the source * of the migration. @@ -2526,56 +2518,11 @@ void qmp_migrate_continue(MigrationStatus state, Er= ror **errp) qemu_sem_post(&s->pause_sem); } =20 -bool migrate_release_ram(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; -} - -bool migrate_postcopy_ram(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; -} - bool migrate_postcopy(void) { return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -bool migrate_auto_converge(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; -} - -bool migrate_zero_blocks(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; -} - -bool migrate_postcopy_blocktime(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; -} - bool migrate_use_compression(void) { MigrationState *s; @@ -2621,33 +2568,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_dirty_bitmaps(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; -} - -bool migrate_ignore_shared(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; -} - -bool migrate_validate_uuid(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; -} - bool migrate_use_events(void) { MigrationState *s; @@ -2666,15 +2586,6 @@ bool migrate_use_multifd(void) return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 -bool migrate_pause_before_switchover(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; -} - int migrate_multifd_channels(void) { MigrationState *s; @@ -2786,24 +2697,6 @@ bool migrate_use_block_incremental(void) return s->parameters.block_incremental; } =20 -bool migrate_background_snapshot(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; -} - -bool migrate_postcopy_preempt(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 04e0860b4e..a25fed6ef0 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,16 +449,7 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -bool migrate_release_ram(void); -bool migrate_postcopy_ram(void); -bool migrate_zero_blocks(void); -bool migrate_dirty_bitmaps(void); -bool migrate_ignore_shared(void); -bool migrate_validate_uuid(void); - -bool migrate_auto_converge(void); bool migrate_use_multifd(void); -bool migrate_pause_before_switchover(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); @@ -487,9 +478,6 @@ int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); bool migrate_use_events(void); -bool migrate_postcopy_blocktime(void); -bool migrate_background_snapshot(void); -bool migrate_postcopy_preempt(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/migration/options.c b/migration/options.c new file mode 100644 index 0000000000..88a9a45913 --- /dev/null +++ b/migration/options.c @@ -0,0 +1,124 @@ +/* + * QEMU migration capabilities + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Orit Wasserman + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "migration.h" +#include "options.h" + +bool migrate_auto_converge(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; +} + +bool migrate_background_snapshot(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; +} + +bool migrate_dirty_bitmaps(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; +} + +bool migrate_ignore_shared(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; +} + +bool migrate_late_block_activate(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; +} + +bool migrate_pause_before_switchover(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; +} + +bool migrate_postcopy_blocktime(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; +} + +bool migrate_postcopy_preempt(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; +} + +bool migrate_postcopy_ram(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; +} + +bool migrate_release_ram(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; +} + +bool migrate_validate_uuid(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; +} + +bool migrate_zero_blocks(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; +} diff --git a/migration/options.h b/migration/options.h new file mode 100644 index 0000000000..0dfa0af245 --- /dev/null +++ b/migration/options.h @@ -0,0 +1,32 @@ +/* + * QEMU migration capabilities + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Orit Wasserman + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_MIGRATION_OPTIONS_H +#define QEMU_MIGRATION_OPTIONS_H + +/* capabilities */ + +bool migrate_auto_converge(void); +bool migrate_background_snapshot(void); +bool migrate_dirty_bitmaps(void); +bool migrate_ignore_shared(void); +bool migrate_late_block_activate(void); +bool migrate_pause_before_switchover(void); +bool migrate_postcopy_blocktime(void); +bool migrate_postcopy_preempt(void); +bool migrate_postcopy_ram(void); +bool migrate_release_ram(void); +bool migrate_validate_uuid(void); +bool migrate_zero_blocks(void); + +#endif diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index d7b48dd920..0711500036 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -37,6 +37,7 @@ #include "tls.h" #include "qemu/userfaultfd.h" #include "qemu/mmap-alloc.h" +#include "options.h" =20 /* Arbitrary limit on size of each discard command, * keeps them around ~200 bytes diff --git a/migration/ram.c b/migration/ram.c index 7ad92f8756..4019fb6500 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -57,6 +57,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "options.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ =20 diff --git a/migration/savevm.c b/migration/savevm.c index 589ef926ab..ebcf571e37 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -67,6 +67,7 @@ #include "qemu/yank.h" #include "yank_functions.h" #include "sysemu/qtest.h" +#include "options.h" =20 const unsigned int postcopy_ram_discard_version; =20 diff --git a/migration/socket.c b/migration/socket.c index e6fdf3c5e1..ebf9ac41af 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -27,6 +27,7 @@ #include "io/net-listener.h" #include "trace.h" #include "postcopy-ram.h" +#include "options.h" =20 struct SocketOutgoingArgs { SocketAddress *saddr; --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998179; cv=none; d=zohomail.com; s=zohoarc; b=A6vdWo1qxs2QEyTPJOO9pk1Vy+hH02jQ1pcBTR3N5XzPdx4uITuBUFpmttycTiIz4DBpvfIzemjyOYVeX4hNaKxYQretx3TQA/ObgamShtvOtAv8K240HUxQtuFEcOm6j4vqpYysfArBZl8TafQb2Gq0EPUN5IXO5wNoxE4RjdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998179; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rh+HGfvDgvORB+TuQC+y2gJAhXauzzVs02CvLbgdBao=; b=lbAu3bGUEH8O6GCmTwbpfNFDkLJFZSBA7F901uLEqCHV8/cLqdT6XzBq8qtUbMeLHLEaSatnTXbCxSOPpZtUuAzAeM8VEyvAjhNOwd5bLAduEY+bhrbnSwA6TcKyUwqffgmtCMXk4LKJubC7BdSYVpNPrmzzi5iDsVeUFbZ3Fkc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168199817944138.87453584459604; Thu, 20 Apr 2023 06:42:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWV-0003sx-ED; Thu, 20 Apr 2023 09:40:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWT-0003rB-9P for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWR-0005i6-NN for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:29 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-AyD7q51ZOz2ggL4bgXk2eQ-1; Thu, 20 Apr 2023 09:40:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E462D280AA28; Thu, 20 Apr 2023 13:40:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59F654020BF1; Thu, 20 Apr 2023 13:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rh+HGfvDgvORB+TuQC+y2gJAhXauzzVs02CvLbgdBao=; b=VC3z3MioVtaksioYe9wE9hObfxsBIN/klVdWR+rhOPqvFHrTAMpDL9I4I360h36TXz6zLY Y9pdaf/Di5Iwrng3TlzpiY5ABTZ5HI/7qmPrc15XoFj8FTjYmCMxvtCodxSFkQXNdqiUjN K4kDX/IRGDk/mR06G/dedmIsNHdbqJU= X-MC-Unique: AyD7q51ZOz2ggL4bgXk2eQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 05/43] migration: Move migrate_colo_enabled() to options.c Date: Thu, 20 Apr 2023 15:39:24 +0200 Message-Id: <20230420134002.29531-6-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998180739100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_colo() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 16 +++++----------- migration/migration.h | 1 - migration/options.c | 6 ++++++ migration/options.h | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4bcccdd129..c1ffb3c180 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2412,7 +2412,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, } =20 if (blk || blk_inc) { - if (migrate_colo_enabled()) { + if (migrate_colo()) { error_setg(errp, "No disk migration is required in COLO mode"); return false; } @@ -3293,7 +3293,7 @@ static void migration_completion(MigrationState *s) ret =3D global_state_store(); =20 if (!ret) { - bool inactivate =3D !migrate_colo_enabled(); + bool inactivate =3D !migrate_colo(); ret =3D vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); trace_migration_completion_vm_stop(ret); if (ret >=3D 0) { @@ -3354,7 +3354,7 @@ static void migration_completion(MigrationState *s) goto fail_invalidate; } =20 - if (migrate_colo_enabled() && s->state =3D=3D MIGRATION_STATUS_ACTIVE)= { + if (migrate_colo() && s->state =3D=3D MIGRATION_STATUS_ACTIVE) { /* COLO does not support postcopy */ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); @@ -3433,12 +3433,6 @@ fail: MIGRATION_STATUS_FAILED); } =20 -bool migrate_colo_enabled(void) -{ - MigrationState *s =3D migrate_get_current(); - return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; -} - typedef enum MigThrError { /* No error detected */ MIG_THR_ERR_NONE =3D 0, @@ -3772,7 +3766,7 @@ static void migration_iteration_finish(MigrationState= *s) runstate_set(RUN_STATE_POSTMIGRATE); break; case MIGRATION_STATUS_COLO: - if (!migrate_colo_enabled()) { + if (!migrate_colo()) { error_report("%s: critical error: calling COLO code without " "COLO enabled", __func__); } @@ -3968,7 +3962,7 @@ static void *migration_thread(void *opaque) qemu_savevm_send_postcopy_advise(s->to_dst_file); } =20 - if (migrate_colo_enabled()) { + if (migrate_colo()) { /* Notify migration destination that we enable COLO */ qemu_savevm_send_colo_enable(s->to_dst_file); } diff --git a/migration/migration.h b/migration/migration.h index a25fed6ef0..42f0c68b6f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -463,7 +463,6 @@ bool migrate_use_zero_copy_send(void); int migrate_use_tls(void); int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); -bool migrate_colo_enabled(void); =20 bool migrate_use_block(void); bool migrate_use_block_incremental(void); diff --git a/migration/options.c b/migration/options.c index 88a9a45913..bd33c5da0a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,6 +33,12 @@ bool migrate_background_snapshot(void) return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 +bool migrate_colo(void) +{ + MigrationState *s =3D migrate_get_current(); + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; +} + bool migrate_dirty_bitmaps(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 0dfa0af245..2a0ee61ff8 100644 --- a/migration/options.h +++ b/migration/options.h @@ -18,6 +18,7 @@ =20 bool migrate_auto_converge(void); bool migrate_background_snapshot(void); +bool migrate_colo(void); bool migrate_dirty_bitmaps(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998601; cv=none; d=zohomail.com; s=zohoarc; b=A0chowmYQjzLgBxuEH3xEB34mkjUX3bsDp6nFEnSXfJPGTyd5uxY7j1Kfqtcdyg9Og30EX+wG/+z48Q1wGSNtp5nD+8qAHPqcs1//yHyuxkXB0W7b1GZ8i1/UUdqglwt44OtR4KYFGPeYqjnjLlGklRQSxROuH2lsryEEMD/KRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998601; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WKxiGVXdtKeEblrxuDwHBqOXazy2WQkJc0+ntTO+Tzo=; b=eYaPBQYLqVVxnV7wfFjLYl9cf/7rYBzlUhWD00o14u0yoyJuHVAELm9WWPmak7mpbuO5cGJM/C7swWuntgpkq1x7zbF0rIWgBQSCbmKuMsRWgJa2qBJZwsb4ZVFb8kmxTeaaZz0QxBGQ8hAWXcK0vLj1JLPtFTW2jU2MNlu7Z6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998601586881.3321613117528; Thu, 20 Apr 2023 06:50:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWX-0003uY-HB; Thu, 20 Apr 2023 09:40:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWU-0003rj-SM for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWT-0005kR-4H for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:30 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-275-Ki_AdqpZNXOAXenHw2T0Pw-1; Thu, 20 Apr 2023 09:40:24 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03335280AA2E; Thu, 20 Apr 2023 13:40:24 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38A0E4020BED; Thu, 20 Apr 2023 13:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WKxiGVXdtKeEblrxuDwHBqOXazy2WQkJc0+ntTO+Tzo=; b=SSEq7LUQRBG3rJlpzcKId2jvN13R0kJilS2/h2rDbACeIcbH91/LLi3Q+rEzaPitj7Hi7W XokAJi1qUI7cGnhdsF9V5Ue7DmUUDQzHNg20EXBqhReho0OYolXU6F3O3PbI1sbR2xTClz N+Mm36BFX6qQD911PLAOpHYCrmFqHhQ= X-MC-Unique: Ki_AdqpZNXOAXenHw2T0Pw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 06/43] migration: Move migrate_use_compression() to options.c Date: Thu, 20 Apr 2023 15:39:25 +0200 Message-Id: <20230420134002.29531-7-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998603145100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_compress() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c1ffb3c180..4f77e7e1b3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1133,7 +1133,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->xbzrle_cache->overflow =3D xbzrle_counters.overflow; } =20 - if (migrate_use_compression()) { + if (migrate_compress()) { info->compression =3D g_malloc0(sizeof(*info->compression)); info->compression->pages =3D compression_counters.pages; info->compression->busy =3D compression_counters.busy; @@ -2523,15 +2523,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -bool migrate_use_compression(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; -} - int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 42f0c68b6f..77aa91c840 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -471,7 +471,6 @@ bool migrate_use_return_path(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 -bool migrate_use_compression(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); diff --git a/migration/options.c b/migration/options.c index bd33c5da0a..fa7a13d3dc 100644 --- a/migration/options.c +++ b/migration/options.c @@ -39,6 +39,15 @@ bool migrate_colo(void) return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 +bool migrate_compress(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; +} + bool migrate_dirty_bitmaps(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 2a0ee61ff8..da2193fd94 100644 --- a/migration/options.h +++ b/migration/options.h @@ -19,6 +19,7 @@ bool migrate_auto_converge(void); bool migrate_background_snapshot(void); bool migrate_colo(void); +bool migrate_compress(void); bool migrate_dirty_bitmaps(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); diff --git a/migration/ram.c b/migration/ram.c index 4019fb6500..9bb7cbd4bb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -586,7 +586,7 @@ static void compress_threads_save_cleanup(void) { int i, thread_count; =20 - if (!migrate_use_compression() || !comp_param) { + if (!migrate_compress() || !comp_param) { return; } =20 @@ -625,7 +625,7 @@ static int compress_threads_save_setup(void) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } thread_count =3D migrate_compress_threads(); @@ -1156,7 +1156,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) rs->xbzrle_bytes_prev =3D xbzrle_counters.bytes; } =20 - if (migrate_use_compression()) { + if (migrate_compress()) { compression_counters.busy_rate =3D (double)(compression_counters.b= usy - rs->compress_thread_busy_prev) / page_count; rs->compress_thread_busy_prev =3D compression_counters.busy; @@ -2272,7 +2272,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr= _t start, ram_addr_t len) =20 static bool save_page_use_compression(RAMState *rs) { - if (!migrate_use_compression()) { + if (!migrate_compress()) { return false; } =20 @@ -3736,7 +3736,7 @@ static int wait_for_decompress_done(void) { int idx, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -3755,7 +3755,7 @@ static void compress_threads_load_cleanup(void) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return; } thread_count =3D migrate_decompress_threads(); @@ -3796,7 +3796,7 @@ static int compress_threads_load_setup(QEMUFile *f) { int i, thread_count; =20 - if (!migrate_use_compression()) { + if (!migrate_compress()) { return 0; } =20 @@ -4262,7 +4262,7 @@ static int ram_load_precopy(QEMUFile *f) int flags =3D 0, ret =3D 0, invalid_flags =3D 0, len =3D 0, i =3D 0; /* ADVISE is earlier, it shows the source has the postcopy capability = on */ bool postcopy_advised =3D migration_incoming_postcopy_advised(); - if (!migrate_use_compression()) { + if (!migrate_compress()) { invalid_flags |=3D RAM_SAVE_FLAG_COMPRESS_PAGE; } =20 --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998407; cv=none; d=zohomail.com; s=zohoarc; b=UP3evlYFr14dBSWRWiQlhOmCGFaTBkT7f+WE7vkLp5dYk2MNpnAZ4PYowhthZnjj6WVITcg90jkUzSiiIKikJSp7l0NPpvh7Q4HMqazz1r2xT3kUPGAdJcSKqLyXN1XWeomS6jF2rtGijkNoCIPQgdEopDwi/5dNdJQkRX8LmmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998407; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SDAiqwRiq+7dpHvuuXFUHRNde/vyRWmENjj4wmjnALI=; b=TU3vEQ0T5woi7R2DjX9u1IublPz5Y9moLGYWDZrGnYZ7SADnTfvVEKA80guQtmyqz6+xsmcgDmjQhjm2BleneiyLP5KWAldkC+rngClnZMTa00UmITl0nX7tSxU9juttBgTKDKZKo78uKvH80BxjXUBjJ7lg9arHq8LDDWFxvJ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998407257794.71330625404; Thu, 20 Apr 2023 06:46:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWZ-0003vI-4S; Thu, 20 Apr 2023 09:40:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWX-0003ud-L3 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWV-0005lK-4D for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-0hmLqjmoOhCyngEhm2W4Xw-1; Thu, 20 Apr 2023 09:40:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D80D988562A; Thu, 20 Apr 2023 13:40:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47A4B4020BF1; Thu, 20 Apr 2023 13:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SDAiqwRiq+7dpHvuuXFUHRNde/vyRWmENjj4wmjnALI=; b=htEyYN2LwsZ6El1HMZ88AZdai9hpNrWUfMdjqXMZm1gcNhBsasClozSzpjbeEUFziSuT5C lXk0SYC/zfkpKVVndkFuBCbRpKiBfuvl2BmqmLYppyAqZce0yfxGwOz2acj2pHHbf+J408 BbHOX+mlH1FBJvfrUNV4Q+Fvc5yOGf4= X-MC-Unique: 0hmLqjmoOhCyngEhm2W4Xw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 07/43] migration: Move migrate_use_events() to options.c Date: Thu, 20 Apr 2023 15:39:26 +0200 Message-Id: <20230420134002.29531-8-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998409789100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_events() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4f77e7e1b3..de797c4114 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -353,7 +353,7 @@ void migration_incoming_state_destroy(void) =20 static void migrate_generate_event(int new_state) { - if (migrate_use_events()) { + if (migrate_events()) { qapi_event_send_migration(new_state); } } @@ -2559,15 +2559,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_use_events(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; -} - bool migrate_use_multifd(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 77aa91c840..bd06520c19 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -475,7 +475,6 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); -bool migrate_use_events(void); =20 /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, diff --git a/migration/options.c b/migration/options.c index fa7a13d3dc..d2219ee0e4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -57,6 +57,15 @@ bool migrate_dirty_bitmaps(void) return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 +bool migrate_events(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; +} + bool migrate_ignore_shared(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index da2193fd94..b998024eba 100644 --- a/migration/options.h +++ b/migration/options.h @@ -21,6 +21,7 @@ bool migrate_background_snapshot(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); +bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); bool migrate_pause_before_switchover(void); diff --git a/migration/ram.c b/migration/ram.c index 9bb7cbd4bb..663f20d6f0 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1248,7 +1248,7 @@ static void migration_bitmap_sync(RAMState *rs) rs->num_dirty_pages_period =3D 0; rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } - if (migrate_use_events()) { + if (migrate_events()) { uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); qapi_event_send_migration_pass(generation); } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998606; cv=none; d=zohomail.com; s=zohoarc; b=mesATHtrso670nbBOLOm21DD/GfLIpoOh7/PJkS4fxPR4a7wkEqz6aqGpKXZBwEG/4JzMz1fBovK2h+eZ/w/wnGli8+0QTf+Ru3qEaCMFV9oAbQ7WPFr0tplvSc00eD/U2giq7kvBHg+r6+34uLw/mbOtJ/zEkc+cR9wZlBt4XY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998606; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NxKHi/IoxvF9Uw4va4Ge9DHM89puqo4EbUxS6NA3fTY=; b=ibWhKmpBRPYumdcoRhhWy9LZoc6JBYvVZcmdPsODQMnWBQ8sNiF595UX2BDi7Pn0qki2JvHmtPl+DGTF0LiV8XWrffsZh9BkRH+zeQfy5hxWjb74gIsziGu0XssEgq/OKPQ5JmlrnHHvXN0ajOXuBz7CEaGf7k6EviWvlJsfFFg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998606919779.3788344755884; Thu, 20 Apr 2023 06:50:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWc-0003yA-QN; Thu, 20 Apr 2023 09:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWb-0003xJ-9R for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWY-0005mM-GJ for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-lY4wwrAVPeOusCpD17wIBw-1; Thu, 20 Apr 2023 09:40:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B540C8028A5; Thu, 20 Apr 2023 13:40:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 279F14020BED; Thu, 20 Apr 2023 13:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NxKHi/IoxvF9Uw4va4Ge9DHM89puqo4EbUxS6NA3fTY=; b=a4/AXdsoDxRqcx3J9oD59l6KyST1LeKl6tHi297t4OUZvuR1laqO2Fv90Rb9T0AHfT6Ih6 0mV+tmDI5NZQqVNlh3KsSxUVm4X/CaD4LPtENdF+KXywkhBnJUqqhbI3hGt4riE7+J1MLQ p+7KMfpwTfhRB+P09vdEoKSuY/avsYs= X-MC-Unique: lY4wwrAVPeOusCpD17wIBw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 08/43] migration: Move migrate_use_multifd() to options.c Date: Thu, 20 Apr 2023 15:39:27 +0200 Message-Id: <20230420134002.29531-9-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998608861100017 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_multifd() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 19 +++++-------------- migration/migration.h | 1 - migration/multifd.c | 16 ++++++++-------- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- migration/socket.c | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index de797c4114..465b7ba5a5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -186,7 +186,7 @@ static void migrate_fd_cancel(MigrationState *s); =20 static bool migration_needs_multiple_sockets(void) { - return migrate_use_multifd() || migrate_postcopy_preempt(); + return migrate_multifd() || migrate_postcopy_preempt(); } =20 static bool uri_supports_multi_channels(const char *uri) @@ -732,7 +732,7 @@ void migration_fd_process_incoming(QEMUFile *f, Error *= *errp) static bool migration_should_start_incoming(bool main_channel) { /* Multifd doesn't start unless all channels are established */ - if (migrate_use_multifd()) { + if (migrate_multifd()) { return migration_has_all_channels(); } =20 @@ -759,7 +759,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Er= ror **errp) uint32_t channel_magic =3D 0; int ret =3D 0; =20 - if (migrate_use_multifd() && !migrate_postcopy_ram() && + if (migrate_multifd() && !migrate_postcopy_ram() && qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_READ_MSG_PEEK)) { /* * With multiple channels, it is possible that we receive channels @@ -798,7 +798,7 @@ void migration_ioc_process_incoming(QIOChannel *ioc, Er= ror **errp) } else { /* Multiple connections */ assert(migration_needs_multiple_sockets()); - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_new_channel(ioc, &local_err); } else { assert(migrate_postcopy_preempt()); @@ -834,7 +834,7 @@ bool migration_has_all_channels(void) return false; } =20 - if (migrate_use_multifd()) { + if (migrate_multifd()) { return multifd_recv_all_channels_created(); } =20 @@ -2559,15 +2559,6 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 -bool migrate_use_multifd(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; -} - int migrate_multifd_channels(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index bd06520c19..49c0e13f41 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,7 +449,6 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -bool migrate_use_multifd(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); diff --git a/migration/multifd.c b/migration/multifd.c index 903df2117b..6807328189 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -516,7 +516,7 @@ void multifd_save_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_send_terminate_threads(NULL); @@ -587,7 +587,7 @@ int multifd_send_sync_main(QEMUFile *f) int i; bool flush_zero_copy; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } if (multifd_send_state->pages->num) { @@ -911,7 +911,7 @@ int multifd_save_setup(Error **errp) uint32_t page_count =3D MULTIFD_PACKET_SIZE / qemu_target_page_size(); uint8_t i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return 0; } =20 @@ -1016,7 +1016,7 @@ static void multifd_recv_terminate_threads(Error *err) =20 void multifd_load_shutdown(void) { - if (migrate_use_multifd()) { + if (migrate_multifd()) { multifd_recv_terminate_threads(NULL); } } @@ -1025,7 +1025,7 @@ void multifd_load_cleanup(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } multifd_recv_terminate_threads(NULL); @@ -1072,7 +1072,7 @@ void multifd_recv_sync_main(void) { int i; =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return; } for (i =3D 0; i < migrate_multifd_channels(); i++) { @@ -1170,7 +1170,7 @@ int multifd_load_setup(Error **errp) * Return successfully if multiFD recv state is already initialised * or multiFD is not enabled. */ - if (multifd_recv_state || !migrate_use_multifd()) { + if (multifd_recv_state || !migrate_multifd()) { return 0; } =20 @@ -1216,7 +1216,7 @@ bool multifd_recv_all_channels_created(void) { int thread_count =3D migrate_multifd_channels(); =20 - if (!migrate_use_multifd()) { + if (!migrate_multifd()) { return true; } =20 diff --git a/migration/options.c b/migration/options.c index d2219ee0e4..58673fc101 100644 --- a/migration/options.c +++ b/migration/options.c @@ -84,6 +84,15 @@ bool migrate_late_block_activate(void) return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 +bool migrate_multifd(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; +} + bool migrate_pause_before_switchover(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index b998024eba..d07269ee38 100644 --- a/migration/options.h +++ b/migration/options.h @@ -24,6 +24,7 @@ bool migrate_dirty_bitmaps(void); bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); +bool migrate_multifd(void); bool migrate_pause_before_switchover(void); bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); diff --git a/migration/ram.c b/migration/ram.c index 663f20d6f0..f2341e25f2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2364,7 +2364,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) * if host page size =3D=3D guest page size the dest guest during run = may * still see partially copied pages which is data corruption. */ - if (migrate_use_multifd() && !migration_in_postcopy()) { + if (migrate_multifd() && !migration_in_postcopy()) { return ram_save_multifd_page(pss->pss_channel, block, offset); } =20 diff --git a/migration/socket.c b/migration/socket.c index ebf9ac41af..f4835a256a 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -183,7 +183,7 @@ socket_start_incoming_migration_internal(SocketAddress = *saddr, =20 qio_net_listener_set_name(listener, "migration-socket-listener"); =20 - if (migrate_use_multifd()) { + if (migrate_multifd()) { num =3D migrate_multifd_channels(); } else if (migrate_postcopy_preempt()) { num =3D RAM_CHANNEL_MAX; --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998089; cv=none; d=zohomail.com; s=zohoarc; b=nM3OyNFmIKVsX+owiLJWRGiS56FiVBXi8BZP5Kh7iGTDCpgULKCpeI7Z5a9v/vvGwSA2OZzTXI0pBSljxDfoQnkuKkioB1L1JCCRf6Gth8SsnRNqYOzH0RPyP9c/AgQFQjO8kmFGfd3yu/MQ3xKZXqpC81T43ImZ5BHOy/8JMvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998089; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q9IuF7Cqxone8erMv1YEL2OagXSlhKaIjTkV6mjrdCI=; b=eCWkaxOoccaE2u2pc+2JqGlFvH+dzNxsBxeXdObKFjO1jB7wZpy1JkVD8c32qWH7DLo3DJf/gISse5ahKKHGL4wd52jQ+8rzuQpudpGssiYrN7TiTTOwNcHEnuPH5hnHtVtuI3Y95A6CJLVa0s1ozDTDNqel3RXiedWoqbvahpM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998089544867.2375700819955; Thu, 20 Apr 2023 06:41:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWh-00042K-Vo; Thu, 20 Apr 2023 09:40:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWg-00041c-Q0 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWc-0005ng-3L for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:42 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519--a4cJJTzMqehau7o0vC0AQ-1; Thu, 20 Apr 2023 09:40:33 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD4E0185A7A4; Thu, 20 Apr 2023 13:40:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04ADC4020BF1; Thu, 20 Apr 2023 13:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q9IuF7Cqxone8erMv1YEL2OagXSlhKaIjTkV6mjrdCI=; b=DZ78K3vzJRyRL4LkFtkwUjwTC1WBd0otNTeH0e3nbWeQhGhP5kRcZV1PYmmmIPDdACnJvD SCDqsVJLPG1DZkhtClF1boj6doW9qZaDbyoOsKLJ82L2aYGlIkb1kf/igqsQRGATNwVzX8 a0Xoab5F1i4JKxpxzhdduJ1AnGfhcUA= X-MC-Unique: -a4cJJTzMqehau7o0vC0AQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 09/43] migration: Move migrate_use_zero_copy_send() to options.c Date: Thu, 20 Apr 2023 15:39:28 +0200 Message-Id: <20230420134002.29531-10-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998090625100005 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_zero_copy_send() to be consistent with all other capabilities. We can remove the CONFIG_LINUX guard. We already check that we can't setup this capability in migrate_caps_check(). Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 13 +------------ migration/migration.h | 5 ----- migration/multifd.c | 8 ++++---- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/socket.c | 2 +- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 465b7ba5a5..a17b1598dc 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1610,7 +1610,7 @@ static bool migrate_params_check(MigrationParameters = *params, Error **errp) } =20 #ifdef CONFIG_LINUX - if (migrate_use_zero_copy_send() && + if (migrate_zero_copy_send() && ((params->has_multifd_compression && params->multifd_compression) = || (params->tls_creds && *params->tls_creds))) { error_setg(errp, @@ -2596,17 +2596,6 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } =20 -#ifdef CONFIG_LINUX -bool migrate_use_zero_copy_send(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; -} -#endif - int migrate_use_tls(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 49c0e13f41..c939f82d53 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -454,11 +454,6 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); =20 -#ifdef CONFIG_LINUX -bool migrate_use_zero_copy_send(void); -#else -#define migrate_use_zero_copy_send() (false) -#endif int migrate_use_tls(void); int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); diff --git a/migration/multifd.c b/migration/multifd.c index 6807328189..cce3ad6988 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -25,7 +25,7 @@ #include "trace.h" #include "multifd.h" #include "threadinfo.h" - +#include "options.h" #include "qemu/yank.h" #include "io/channel-socket.h" #include "yank_functions.h" @@ -608,7 +608,7 @@ int multifd_send_sync_main(QEMUFile *f) * all the dirty bitmaps. */ =20 - flush_zero_copy =3D migrate_use_zero_copy_send(); + flush_zero_copy =3D migrate_zero_copy_send(); =20 for (i =3D 0; i < migrate_multifd_channels(); i++) { MultiFDSendParams *p =3D &multifd_send_state->params[i]; @@ -653,7 +653,7 @@ static void *multifd_send_thread(void *opaque) MigrationThread *thread =3D NULL; Error *local_err =3D NULL; int ret =3D 0; - bool use_zero_copy_send =3D migrate_use_zero_copy_send(); + bool use_zero_copy_send =3D migrate_zero_copy_send(); =20 thread =3D MigrationThreadAdd(p->name, qemu_get_thread_id()); =20 @@ -945,7 +945,7 @@ int multifd_save_setup(Error **errp) p->page_size =3D qemu_target_page_size(); p->page_count =3D page_count; =20 - if (migrate_use_zero_copy_send()) { + if (migrate_zero_copy_send()) { p->write_flags =3D QIO_CHANNEL_WRITE_FLAG_ZERO_COPY; } else { p->write_flags =3D 0; diff --git a/migration/options.c b/migration/options.c index 58673fc101..f357c99996 100644 --- a/migration/options.c +++ b/migration/options.c @@ -155,3 +155,12 @@ bool migrate_zero_blocks(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } + +bool migrate_zero_copy_send(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; +} diff --git a/migration/options.h b/migration/options.h index d07269ee38..ad22f4d24a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -32,5 +32,6 @@ bool migrate_postcopy_ram(void); bool migrate_release_ram(void); bool migrate_validate_uuid(void); bool migrate_zero_blocks(void); +bool migrate_zero_copy_send(void); =20 #endif diff --git a/migration/socket.c b/migration/socket.c index f4835a256a..1b6f5baefb 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -98,7 +98,7 @@ static void socket_outgoing_migration(QIOTask *task, =20 trace_migration_socket_outgoing_connected(data->hostname); =20 - if (migrate_use_zero_copy_send() && + if (migrate_zero_copy_send() && !qio_channel_has_feature(sioc, QIO_CHANNEL_FEATURE_WRITE_ZERO_COPY= )) { error_setg(&err, "Zero copy send feature not detected in host kern= el"); } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998113; cv=none; d=zohomail.com; s=zohoarc; b=AVpbpW9QT3JgG6TUjvO77A96Cf51XVl7qz3LnZZdjuJQWZjKdCiiw5XpBzN7XUr0nWkNIO8m52jemRQwS9IulzVhOg1ee67c4WC/7bGu6rf0x3hQIIXAOzx8pehB0cf5On7S3p1jA7ZhEj9ljE1pS1Aur9k37lA8wlq/o79/O48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998113; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fw/JwC3B8wKdI2zwfn320zzwq7sI5H8AmnPVJNTwB0I=; b=XaywiKY4A6g2Jl5MRdBb+9XqFvYMm9NKYPrUewVHdh3fBjC650FJ9OwyzdbO0BiCZoka4pK10yz5s/228FBh7WMOB2I2eXe3cYmEM419csPrj/r7DvYZenCTELVbObYzX1tWUJ2WwLMA0Gj882DYbEeljh/NTWa+REzb0ONhAmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998113504206.299068396017; Thu, 20 Apr 2023 06:41:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWj-00043w-N7; Thu, 20 Apr 2023 09:40:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWi-00042Z-AK for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWe-0005oD-Vo for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-625-XHjlsUjbM42dxqA4ZaYFyQ-1; Thu, 20 Apr 2023 09:40:36 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86D0A885620; Thu, 20 Apr 2023 13:40:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1AEB4020BF1; Thu, 20 Apr 2023 13:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fw/JwC3B8wKdI2zwfn320zzwq7sI5H8AmnPVJNTwB0I=; b=Khu+YwpJX8T86xrDyUvrnyIIDAvae8v0Pi/svvi345O92eymrP6F4VMqzMkG1ecO23DuDS /cmgGD9KEcklJdbHX/rMAzKwih5Pzth7/06h5Rr+RndbrWu9h7WVBSmV2x6nqbadWiUn/j LewjJcqU8miu8mmuCLSgh2dUm9bGzMM= X-MC-Unique: XHjlsUjbM42dxqA4ZaYFyQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 10/43] migration: Move migrate_use_xbzrle() to options.c Date: Thu, 20 Apr 2023 15:39:29 +0200 Message-Id: <20230420134002.29531-11-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998115434100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_xbzrle() to be consistent with all other capabilities. We change the type to return bool also for consistency. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a17b1598dc..f34c5f1895 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1122,7 +1122,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->downtime_bytes =3D stat64_get(&ram_counters.downtime_bytes); info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { info->xbzrle_cache =3D g_malloc0(sizeof(*info->xbzrle_cache)); info->xbzrle_cache->cache_size =3D migrate_xbzrle_cache_size(); info->xbzrle_cache->bytes =3D xbzrle_counters.bytes; @@ -2605,15 +2605,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -int migrate_use_xbzrle(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; -} - uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index c939f82d53..e2bb5b1e2f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -455,7 +455,6 @@ int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); =20 int migrate_use_tls(void); -int migrate_use_xbzrle(void); uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block(void); diff --git a/migration/options.c b/migration/options.c index f357c99996..25264c500e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -147,6 +147,15 @@ bool migrate_validate_uuid(void) return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 +bool migrate_xbzrle(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; +} + bool migrate_zero_blocks(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index ad22f4d24a..8f76a88329 100644 --- a/migration/options.h +++ b/migration/options.h @@ -31,6 +31,7 @@ bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); bool migrate_release_ram(void); bool migrate_validate_uuid(void); +bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 diff --git a/migration/ram.c b/migration/ram.c index f2341e25f2..7f28588dde 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -156,14 +156,14 @@ static struct { =20 static void XBZRLE_cache_lock(void) { - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { qemu_mutex_lock(&XBZRLE.lock); } } =20 static void XBZRLE_cache_unlock(void) { - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { qemu_mutex_unlock(&XBZRLE.lock); } } @@ -1138,7 +1138,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) return; } =20 - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { double encoded_size, unencoded_size; =20 xbzrle_counters.cache_miss_rate =3D (double)(xbzrle_counters.cache= _miss - @@ -1628,7 +1628,7 @@ static int find_dirty_block(RAMState *rs, PageSearchS= tatus *pss) /* Flag that we've looped */ pss->complete_round =3D true; /* After the first round, enable XBZRLE. */ - if (migrate_use_xbzrle()) { + if (migrate_xbzrle()) { rs->xbzrle_enabled =3D true; } } @@ -2981,7 +2981,7 @@ static int xbzrle_init(void) { Error *local_err =3D NULL; =20 - if (!migrate_use_xbzrle()) { + if (!migrate_xbzrle()) { return 0; } =20 --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998329; cv=none; d=zohomail.com; s=zohoarc; b=AK2gKWAV3P2ffuJhyxbVNx1KJsbMX3jqHdvyEHlct9xj6PzTnJiK7Zw6y9GkDXXZoF+sdJphr+SWmwsmiVhgWhJrJIv6HYFFnfSLhDVNVDH629h1/8Pl06WuL5kjEKq0OVqYUo6Og6di9bx6J+thuQr+Bd8r/R7VbaOF8auPYvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998329; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NbACSbLD6TT3PMvN0t6DBf2kj8d98vsz5xRkBT+paac=; b=dVux+6g4bWq7UG4RhNty960o7X77MUW4h9oNoQ5RhEckhbouDo1OduuzU7oTnqnu83s2w1Tv5klNBe5yektOFgiszkuUA1ErIdyxmUrMcD+KQdRvNPsR2bt4rRGLumi8/NzSa71G5wQ2iESZLLK/Zkfs6gvXzLPPgbgzMmZZ/cU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998329081201.40036367418952; Thu, 20 Apr 2023 06:45:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWl-00045c-72; Thu, 20 Apr 2023 09:40:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWj-00043y-O0 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWg-0005oe-Qu for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-331-S7Vt_08iML64wXOwHN19Yg-1; Thu, 20 Apr 2023 09:40:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63B36885621; Thu, 20 Apr 2023 13:40:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB5864020BF1; Thu, 20 Apr 2023 13:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NbACSbLD6TT3PMvN0t6DBf2kj8d98vsz5xRkBT+paac=; b=cAV9BsAZTbuF6WAho6GXsX7LxI1oXdPYCJY0+Y6Iu0/zdajPmbW9WTXse99xUjpiW92i7b nBxYP9UmIXGlLJS+MWOTQAJ1UQ0uSBfhRkqwZJ6Za/+Fg9BhMCx1IY+Yo6b4d1TfuAa4GB L2YIOqjQzDyTPZRKjkc2X38ABfSPNdM= X-MC-Unique: S7Vt_08iML64wXOwHN19Yg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 11/43] migration: Move migrate_use_block() to options.c Date: Thu, 20 Apr 2023 15:39:30 +0200 Message-Id: <20230420134002.29531-12-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998331393100001 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_block() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/savevm.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/block.c b/migration/block.c index 4b167fa5cf..f0977217cf 100644 --- a/migration/block.c +++ b/migration/block.c @@ -1001,7 +1001,7 @@ static int block_load(QEMUFile *f, void *opaque, int = version_id) =20 static bool block_is_active(void *opaque) { - return migrate_use_block(); + return migrate_block(); } =20 static SaveVMHandlers savevm_block_handlers =3D { diff --git a/migration/migration.c b/migration/migration.c index f34c5f1895..1d0fe27b92 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2416,7 +2416,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, error_setg(errp, "No disk migration is required in COLO mode"); return false; } - if (migrate_use_block() || migrate_use_block_incremental()) { + if (migrate_block() || migrate_use_block_incremental()) { error_setg(errp, "Command options are incompatible with " "current migration capabilities"); return false; @@ -2623,15 +2623,6 @@ static int64_t migrate_max_postcopy_bandwidth(void) return s->parameters.max_postcopy_bandwidth; } =20 -bool migrate_use_block(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; -} - bool migrate_use_return_path(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index e2bb5b1e2f..d4b68b08a5 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -457,7 +457,6 @@ int migrate_multifd_zstd_level(void); int migrate_use_tls(void); uint64_t migrate_xbzrle_cache_size(void); =20 -bool migrate_use_block(void); bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); bool migrate_use_return_path(void); diff --git a/migration/options.c b/migration/options.c index 25264c500e..fe1eadeed6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,6 +33,15 @@ bool migrate_background_snapshot(void) return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 +bool migrate_block(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; +} + bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 8f76a88329..e985a5233e 100644 --- a/migration/options.h +++ b/migration/options.h @@ -18,6 +18,7 @@ =20 bool migrate_auto_converge(void); bool migrate_background_snapshot(void); +bool migrate_block(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); diff --git a/migration/savevm.c b/migration/savevm.c index ebcf571e37..9671211339 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1612,7 +1612,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) return -EINVAL; } =20 - if (migrate_use_block()) { + if (migrate_block()) { error_setg(errp, "Block migration and snapshots are incompatible"); return -EINVAL; } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998138; cv=none; d=zohomail.com; s=zohoarc; b=BsuO/3h0H5Jo66oOm2heoJ/6tjnlFlsFywrWdE/3WO79gN8P5m3nfKFTq9S2PcB2nuPDCrLVJz68EhtJVrrF+DpolGFlWUr/H8zg27uAqvbz3PT6NU8cvJpcC/F3cuXavc9PSPe2zvO8XEb/swX+JRiUMeG3BUKtaBVcL7+xU6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998138; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9VTc5hKgcUPKvZc1WyTdjgpOdDhsu9ZZFegrwamUFaE=; b=ZiaEdgP/pvrhy8Zwdf9FrTLyaUSdVq7BkR1nZWH2OaMJ1LCLIApUW5oGml/Tu81HulcjUPcwdSXUdsycWDAUXqQhNZXTzT9+upSkPWBqOxPXHSeVt+hNqROnzZyixPI8m5iK6IV2hUJu3XcG8hmMAcYH4ZEWY527jYtKOq+JQGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998138002266.5768382249846; Thu, 20 Apr 2023 06:42:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWn-00046K-34; Thu, 20 Apr 2023 09:40:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWk-00045A-Hn for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWh-0005pC-Hj for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:46 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-201-fK8YLe8EPtyS96AHkTzPCg-1; Thu, 20 Apr 2023 09:40:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4849A811E7C; Thu, 20 Apr 2023 13:40:41 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A845C4020BF1; Thu, 20 Apr 2023 13:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9VTc5hKgcUPKvZc1WyTdjgpOdDhsu9ZZFegrwamUFaE=; b=M+AC157HqABen2NkqMOsSy85Fi/TncqgUfXbEBVFTTnlauhoyiIGQRppWdRrdxLScvlsQn PuFj+tbD6aIsnWfyGbqDJTfxF7asvU6CtQpUagz+EqObc6R62FYkXd79apxjDIyafpZZFb pxmMIZ/NGt2X+R4HLVztsEegan1iiFo= X-MC-Unique: fK8YLe8EPtyS96AHkTzPCg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 12/43] migration: Move migrate_use_return() to options.c Date: Thu, 20 Apr 2023 15:39:31 +0200 Message-Id: <20230420134002.29531-13-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998139395100003 Content-Type: text/plain; charset="utf-8" Once that we are there, we rename the function to migrate_return_path() to be consistent with all other capabilities. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/rdma.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1d0fe27b92..f907e17d65 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2623,15 +2623,6 @@ static int64_t migrate_max_postcopy_bandwidth(void) return s->parameters.max_postcopy_bandwidth; } =20 -bool migrate_use_return_path(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; -} - bool migrate_use_block_incremental(void) { MigrationState *s; @@ -4176,7 +4167,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) * precopy, only if user specified "return-path" capability would * QEMU uses the return path. */ - if (migrate_postcopy_ram() || migrate_use_return_path()) { + if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s, !resume)) { error_report("Unable to open return-path for postcopy"); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); diff --git a/migration/migration.h b/migration/migration.h index d4b68b08a5..24184622a8 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -459,7 +459,6 @@ uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); -bool migrate_use_return_path(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 diff --git a/migration/options.c b/migration/options.c index fe1eadeed6..2003e413da 100644 --- a/migration/options.c +++ b/migration/options.c @@ -147,6 +147,15 @@ bool migrate_release_ram(void) return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 +bool migrate_return_path(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; +} + bool migrate_validate_uuid(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index e985a5233e..316efd1063 100644 --- a/migration/options.h +++ b/migration/options.h @@ -31,6 +31,7 @@ bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); bool migrate_release_ram(void); +bool migrate_return_path(void); bool migrate_validate_uuid(void); bool migrate_xbzrle(void); bool migrate_zero_blocks(void); diff --git a/migration/rdma.c b/migration/rdma.c index f35f021963..bf55e2f163 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3373,7 +3373,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) * initialize the RDMAContext for return path for postcopy after first * connection request reached. */ - if ((migrate_postcopy() || migrate_use_return_path()) + if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { rdma_return_path =3D qemu_rdma_data_init(rdma->host_port, NULL); if (rdma_return_path =3D=3D NULL) { @@ -3456,7 +3456,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) } =20 /* Accept the second connection request for return path */ - if ((migrate_postcopy() || migrate_use_return_path()) + if ((migrate_postcopy() || migrate_return_path()) && !rdma->is_return_path) { qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migrat= ion, NULL, @@ -4193,7 +4193,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 /* RDMA postcopy need a separate queue pair for return path */ - if (migrate_postcopy() || migrate_use_return_path()) { + if (migrate_postcopy() || migrate_return_path()) { rdma_return_path =3D qemu_rdma_data_init(host_port, errp); =20 if (rdma_return_path =3D=3D NULL) { --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998213; cv=none; d=zohomail.com; s=zohoarc; b=LUficRp3tjsJuwsKYUoPzVNj3zLAfAI2yHU+ltjoeUtniMBxYaqBix4/krzva0JuoGxNNfK5BJCOw+V174dC8NmtqJPYYLwyKaHo7TBpn78MUwm9wDyqB6tEi7CEeGb9nT+ojMfG8eR7Q23g9ZIhdohN0EA7fGCDnIeKK19RGfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998213; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mxw7eE71bAW2feJPJIGftq669PA9w96E/b1BrG6sSYQ=; b=XprFgI+kno+P1gqpEobZpZp+nvzdpol8+iPMvp7QB1OYP5Etu+PBOAyvzNtAu7dI0rCifS5duqZce7zgbVTMcgrXPUCIlP/PUDUAGc/6fLY7J5uyoBYXQXaunTKJaERdA/mAEtvz5yVSAIsCvFM/W2CRQAXClzpzuDbxol2mg9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168199821376232.42105466911221; Thu, 20 Apr 2023 06:43:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWr-0004Bd-NU; Thu, 20 Apr 2023 09:40:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWq-0004Ad-4J for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWo-0005sn-Nu for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-193-kqbJL1uXMrWr_X-iPVPqeQ-1; Thu, 20 Apr 2023 09:40:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2557A1C087B3; Thu, 20 Apr 2023 13:40:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A59A4020BED; Thu, 20 Apr 2023 13:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxw7eE71bAW2feJPJIGftq669PA9w96E/b1BrG6sSYQ=; b=QyVbhQ8YLddiWNdkyscBn8cBJQTikmYZouVt1FlPfD1Am8qWHgljUIaREpjrLjAKvt5R6u DBn5YECX5e6VIGZ+ckPC/rMi1QG0wXQpnR3qIG7KvshxwBV/eKNYb1yh9weujo0EABSu0b xV33jqyfptdhkOnlAv4ewbjfQeKKMKk= X-MC-Unique: kqbJL1uXMrWr_X-iPVPqeQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 13/43] migration: Create migrate_rdma_pin_all() function Date: Thu, 20 Apr 2023 15:39:32 +0200 Message-Id: <20230420134002.29531-14-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998214209100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/rdma.c | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/options.c b/migration/options.c index 2003e413da..9c9b8e5863 100644 --- a/migration/options.c +++ b/migration/options.c @@ -138,6 +138,13 @@ bool migrate_postcopy_ram(void) return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } =20 +bool migrate_rdma_pin_all(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL]; +} + bool migrate_release_ram(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 316efd1063..25c002b37a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -30,6 +30,7 @@ bool migrate_pause_before_switchover(void); bool migrate_postcopy_blocktime(void); bool migrate_postcopy_preempt(void); bool migrate_postcopy_ram(void); +bool migrate_rdma_pin_all(void); bool migrate_release_ram(void); bool migrate_return_path(void); bool migrate_validate_uuid(void); diff --git a/migration/rdma.c b/migration/rdma.c index bf55e2f163..3e7b68c482 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -35,6 +35,7 @@ #include #include "trace.h" #include "qom/object.h" +#include "options.h" #include =20 /* @@ -4178,8 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque, goto err; } =20 - ret =3D qemu_rdma_source_init(rdma, - s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + ret =3D qemu_rdma_source_init(rdma,migrate_rdma_pin_all(), errp); =20 if (ret) { goto err; @@ -4201,7 +4201,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma_return_path, - s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + migrate_rdma_pin_all(), errp); =20 if (ret) { goto return_path_err; --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998248; cv=none; d=zohomail.com; s=zohoarc; b=PZ+826GEB5T8UTxp2dYkYKiWsseeQ2yjlhkBDv52vVHXryDQdeUauaa5n8iVvss9F+sdXxJUN4EwCurOC8h9gJ+ox24JI/IYvSKrhLls4h4Fel3c0jT1a25ErEUCbhLzH46h9t72MnWFirUp2jvYC+ANiowZFPokp1wr2Lq8WqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998248; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gaH9CYCWVNvjuDaTToL8xcrTSrcRoFN0alU8wsLStAM=; b=K/BVHPdtStHPNQxh5YnlpHXWyaDcTBvch/ohgx/QqZijVGxw4Njs0k2idbS43G0BxMdnPfsM62LpfF2uThACf6soSwuPj7LSR3n2fhxfPbYMBl/f06WFXuTwpq79rZmOsjhXUvlrwd6cyP5wHdPgUvwDcZI5TIzHrfb2BHBeiQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998248199791.7248897702309; Thu, 20 Apr 2023 06:44:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWx-0004Kj-4Z; Thu, 20 Apr 2023 09:40:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWu-0004Dh-Rr for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWs-0005vI-Mo for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-3rNXF65FN5mXBZ7eLLPLrQ-1; Thu, 20 Apr 2023 09:40:47 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B012885624; Thu, 20 Apr 2023 13:40:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B6444020BF1; Thu, 20 Apr 2023 13:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gaH9CYCWVNvjuDaTToL8xcrTSrcRoFN0alU8wsLStAM=; b=Gx1zAj3gZ9hlceahebXyvtpWkQtVnJio30zQMcASetxJWP80Vu2r9bnIPC47RTUr1yntKA oEUyrhFg4nVarFsW5DiysSnLw2p3VLgRfvRbqlOMrlRYzXj99GUajwJcCke+HHLWmibrSX 5qg6P35fFj2AGEkTLg7yGsHo4nawctE= X-MC-Unique: 3rNXF65FN5mXBZ7eLLPLrQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 14/43] migration: Move migrate_caps_check() to options.c Date: Thu, 20 Apr 2023 15:39:33 +0200 Message-Id: <20230420134002.29531-15-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998248549100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 190 ----------------------------------------- migration/options.c | 192 ++++++++++++++++++++++++++++++++++++++++++ migration/options.h | 4 + 3 files changed, 196 insertions(+), 190 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f907e17d65..933c96792b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -136,39 +136,6 @@ enum mig_rp_message_type { MIG_RP_MSG_MAX }; =20 -/* Migration capabilities set */ -struct MigrateCapsSet { - int size; /* Capability set size */ - MigrationCapability caps[]; /* Variadic array of capabilities */ -}; -typedef struct MigrateCapsSet MigrateCapsSet; - -/* Define and initialize MigrateCapsSet */ -#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ - MigrateCapsSet _name =3D { \ - .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ - .caps =3D { __VA_ARGS__ } \ - } - -/* Background-snapshot compatibility check list */ -static const -INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, - MIGRATION_CAPABILITY_POSTCOPY_RAM, - MIGRATION_CAPABILITY_DIRTY_BITMAPS, - MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, - MIGRATION_CAPABILITY_RETURN_PATH, - MIGRATION_CAPABILITY_MULTIFD, - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, - MIGRATION_CAPABILITY_AUTO_CONVERGE, - MIGRATION_CAPABILITY_RELEASE_RAM, - MIGRATION_CAPABILITY_RDMA_PIN_ALL, - MIGRATION_CAPABILITY_COMPRESS, - MIGRATION_CAPABILITY_XBZRLE, - MIGRATION_CAPABILITY_X_COLO, - MIGRATION_CAPABILITY_VALIDATE_UUID, - MIGRATION_CAPABILITY_ZERO_COPY_SEND); - /* When we add fault tolerance, we could have several migrations at once. For now we don't need to add dynamic creation of migration */ @@ -1236,163 +1203,6 @@ static void fill_source_migration_info(MigrationInf= o *info) info->status =3D state; } =20 -typedef enum WriteTrackingSupport { - WT_SUPPORT_UNKNOWN =3D 0, - WT_SUPPORT_ABSENT, - WT_SUPPORT_AVAILABLE, - WT_SUPPORT_COMPATIBLE -} WriteTrackingSupport; - -static -WriteTrackingSupport migrate_query_write_tracking(void) -{ - /* Check if kernel supports required UFFD features */ - if (!ram_write_tracking_available()) { - return WT_SUPPORT_ABSENT; - } - /* - * Check if current memory configuration is - * compatible with required UFFD features. - */ - if (!ram_write_tracking_compatible()) { - return WT_SUPPORT_AVAILABLE; - } - - return WT_SUPPORT_COMPATIBLE; -} - -/** - * @migration_caps_check - check capability compatibility - * - * @old_caps: old capability list - * @new_caps: new capability list - * @errp: set *errp if the check failed, with reason - * - * Returns true if check passed, otherwise false. - */ -static bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **err= p) -{ - MigrationIncomingState *mis =3D migration_incoming_get_current(); - -#ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { - error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " - "block migration"); - error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); - return false; - } -#endif - -#ifndef CONFIG_REPLICATION - if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { - error_setg(errp, "QEMU compiled without replication module" - " can't enable COLO"); - error_append_hint(errp, "Please enable replication before COLO.\n"= ); - return false; - } -#endif - - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { - /* This check is reasonably expensive, so only when it's being - * set the first time, also it's only the destination that needs - * special support. - */ - if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && - runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host(mis)) { - /* postcopy_ram_supported_by_host will have emitted a more - * detailed message - */ - error_setg(errp, "Postcopy is not supported"); - return false; - } - - if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { - error_setg(errp, "Postcopy is not compatible with ignore-share= d"); - return false; - } - } - - if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { - WriteTrackingSupport wt_support; - int idx; - /* - * Check if 'background-snapshot' capability is supported by - * host kernel and compatible with guest memory configuration. - */ - wt_support =3D migrate_query_write_tracking(); - if (wt_support < WT_SUPPORT_AVAILABLE) { - error_setg(errp, "Background-snapshot is not supported by host= kernel"); - return false; - } - if (wt_support < WT_SUPPORT_COMPATIBLE) { - error_setg(errp, "Background-snapshot is not compatible " - "with guest memory configuration"); - return false; - } - - /* - * Check if there are any migration capabilities - * incompatible with 'background-snapshot'. - */ - for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { - int incomp_cap =3D check_caps_background_snapshot.caps[idx]; - if (new_caps[incomp_cap]) { - error_setg(errp, - "Background-snapshot is not compatible with %s", - MigrationCapability_str(incomp_cap)); - return false; - } - } - } - -#ifdef CONFIG_LINUX - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && - (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || - new_caps[MIGRATION_CAPABILITY_COMPRESS] || - new_caps[MIGRATION_CAPABILITY_XBZRLE] || - migrate_multifd_compression() || - migrate_use_tls())) { - error_setg(errp, - "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); - return false; - } -#else - if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { - error_setg(errp, - "Zero copy currently only available on Linux"); - return false; - } -#endif - - if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { - if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { - error_setg(errp, "Postcopy preempt requires postcopy-ram"); - return false; - } - - /* - * Preempt mode requires urgent pages to be sent in separate - * channel, OTOH compression logic will disorder all pages into - * different compression channels, which is not compatible with the - * preempt assumptions on channel assignments. - */ - if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { - error_setg(errp, "Postcopy preempt not compatible with compres= s"); - return false; - } - } - - if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { - if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { - error_setg(errp, "Multifd is not compatible with compress"); - return false; - } - } - - return true; -} - static void fill_destination_migration_info(MigrationInfo *info) { MigrationIncomingState *mis =3D migration_incoming_get_current(); diff --git a/migration/options.c b/migration/options.c index 9c9b8e5863..367c930f46 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,7 +12,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" +#include "sysemu/runstate.h" #include "migration.h" +#include "ram.h" #include "options.h" =20 bool migrate_auto_converge(void) @@ -198,3 +201,192 @@ bool migrate_zero_copy_send(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } +typedef enum WriteTrackingSupport { + WT_SUPPORT_UNKNOWN =3D 0, + WT_SUPPORT_ABSENT, + WT_SUPPORT_AVAILABLE, + WT_SUPPORT_COMPATIBLE +} WriteTrackingSupport; + +static +WriteTrackingSupport migrate_query_write_tracking(void) +{ + /* Check if kernel supports required UFFD features */ + if (!ram_write_tracking_available()) { + return WT_SUPPORT_ABSENT; + } + /* + * Check if current memory configuration is + * compatible with required UFFD features. + */ + if (!ram_write_tracking_compatible()) { + return WT_SUPPORT_AVAILABLE; + } + + return WT_SUPPORT_COMPATIBLE; +} + +/* Migration capabilities set */ +struct MigrateCapsSet { + int size; /* Capability set size */ + MigrationCapability caps[]; /* Variadic array of capabilities */ +}; +typedef struct MigrateCapsSet MigrateCapsSet; + +/* Define and initialize MigrateCapsSet */ +#define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \ + MigrateCapsSet _name =3D { \ + .size =3D sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \ + .caps =3D { __VA_ARGS__ } \ + } + +/* Background-snapshot compatibility check list */ +static const +INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot, + MIGRATION_CAPABILITY_POSTCOPY_RAM, + MIGRATION_CAPABILITY_DIRTY_BITMAPS, + MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME, + MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE, + MIGRATION_CAPABILITY_RETURN_PATH, + MIGRATION_CAPABILITY_MULTIFD, + MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER, + MIGRATION_CAPABILITY_AUTO_CONVERGE, + MIGRATION_CAPABILITY_RELEASE_RAM, + MIGRATION_CAPABILITY_RDMA_PIN_ALL, + MIGRATION_CAPABILITY_COMPRESS, + MIGRATION_CAPABILITY_XBZRLE, + MIGRATION_CAPABILITY_X_COLO, + MIGRATION_CAPABILITY_VALIDATE_UUID, + MIGRATION_CAPABILITY_ZERO_COPY_SEND); + +/** + * @migration_caps_check - check capability compatibility + * + * @old_caps: old capability list + * @new_caps: new capability list + * @errp: set *errp if the check failed, with reason + * + * Returns true if check passed, otherwise false. + */ +bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp) +{ + MigrationIncomingState *mis =3D migration_incoming_get_current(); + +#ifndef CONFIG_LIVE_BLOCK_MIGRATION + if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { + error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " + "block migration"); + error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); + return false; + } +#endif + +#ifndef CONFIG_REPLICATION + if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { + error_setg(errp, "QEMU compiled without replication module" + " can't enable COLO"); + error_append_hint(errp, "Please enable replication before COLO.\n"= ); + return false; + } +#endif + + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + /* This check is reasonably expensive, so only when it's being + * set the first time, also it's only the destination that needs + * special support. + */ + if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && + runstate_check(RUN_STATE_INMIGRATE) && + !postcopy_ram_supported_by_host(mis)) { + /* postcopy_ram_supported_by_host will have emitted a more + * detailed message + */ + error_setg(errp, "Postcopy is not supported"); + return false; + } + + if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + error_setg(errp, "Postcopy is not compatible with ignore-share= d"); + return false; + } + } + + if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { + WriteTrackingSupport wt_support; + int idx; + /* + * Check if 'background-snapshot' capability is supported by + * host kernel and compatible with guest memory configuration. + */ + wt_support =3D migrate_query_write_tracking(); + if (wt_support < WT_SUPPORT_AVAILABLE) { + error_setg(errp, "Background-snapshot is not supported by host= kernel"); + return false; + } + if (wt_support < WT_SUPPORT_COMPATIBLE) { + error_setg(errp, "Background-snapshot is not compatible " + "with guest memory configuration"); + return false; + } + + /* + * Check if there are any migration capabilities + * incompatible with 'background-snapshot'. + */ + for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { + int incomp_cap =3D check_caps_background_snapshot.caps[idx]; + if (new_caps[incomp_cap]) { + error_setg(errp, + "Background-snapshot is not compatible with %s", + MigrationCapability_str(incomp_cap)); + return false; + } + } + } + +#ifdef CONFIG_LINUX + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && + (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || + new_caps[MIGRATION_CAPABILITY_COMPRESS] || + new_caps[MIGRATION_CAPABILITY_XBZRLE] || + migrate_multifd_compression() || + migrate_use_tls())) { + error_setg(errp, + "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); + return false; + } +#else + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { + error_setg(errp, + "Zero copy currently only available on Linux"); + return false; + } +#endif + + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { + if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + error_setg(errp, "Postcopy preempt requires postcopy-ram"); + return false; + } + + /* + * Preempt mode requires urgent pages to be sent in separate + * channel, OTOH compression logic will disorder all pages into + * different compression channels, which is not compatible with the + * preempt assumptions on channel assignments. + */ + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { + error_setg(errp, "Postcopy preempt not compatible with compres= s"); + return false; + } + } + + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { + error_setg(errp, "Multifd is not compatible with compress"); + return false; + } + } + + return true; +} diff --git a/migration/options.h b/migration/options.h index 25c002b37a..e779f14161 100644 --- a/migration/options.h +++ b/migration/options.h @@ -38,4 +38,8 @@ bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 +/* capabilities helpers */ + +bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); + #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998235; cv=none; d=zohomail.com; s=zohoarc; b=LUOBLUhjxEedgkQ6O6Eltv8b5RQruao69lmttLtE+thifohlj1o7dBKjElNdyaJ3XyF17gA+6N2U/soCCgmuSg5H7512jSfQdrYUnIYu+wUTbeZLkvRGi7turp7bogGjeNn1Y+KrZ9cldF6pI57qW2gic3QymuSZBxSShoEVNaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998235; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x2cN1elcFF9HEvtThopH96c9TG/eJg12zNlyPzwsROg=; b=dUdASfmeHmanEWiZ/3ruKBUw/cKcI6g9nmW9ulaeD3jpdnygNHmLor4eo/abKhNmh90HHlQuylugNCuTPv7lLPsaZscGT64WSb/BpZ87NsKe7jzG9jhBmTdfveCgStYfHZQdfQh118XGDK4XTLswgi63fe8AUyhGiWopizC9p2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998235918907.5660054535568; Thu, 20 Apr 2023 06:43:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUWx-0004MO-8G; Thu, 20 Apr 2023 09:40:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWv-0004Dt-9F for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWt-0005vl-Dh for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:57 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-YAK8AZpyOumIlyjouQVBZg-1; Thu, 20 Apr 2023 09:40:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3B0B785A588; Thu, 20 Apr 2023 13:40:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FB714020BED; Thu, 20 Apr 2023 13:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x2cN1elcFF9HEvtThopH96c9TG/eJg12zNlyPzwsROg=; b=Gc5HuAw1TUsj9xIzrcv1J0JJSJTG0nU7Bq0iI9iSK61rfMLPdfEnCJJ042wY+2rCH48TJZ 0ZJsZ+jp7fs0sifWFiFS3A9lobrfbp9TE1s5GlISg4lTqodbrikIvplkqCDXx+eIo9Rm14 7Fau09SnVWmZmX3BvpSpyuyC5DET2Hg= X-MC-Unique: YAK8AZpyOumIlyjouQVBZg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 15/43] migration: Move qmp_query_migrate_capabilities() to options.c Date: Thu, 20 Apr 2023 15:39:34 +0200 Message-Id: <20230420134002.29531-16-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998236430100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 22 ---------------------- migration/options.c | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 933c96792b..bc796879c0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -886,28 +886,6 @@ void migrate_send_rp_resume_ack(MigrationIncomingState= *mis, uint32_t value) migrate_send_rp_message(mis, MIG_RP_MSG_RESUME_ACK, sizeof(buf), &buf); } =20 -MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) -{ - MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; - MigrationCapabilityStatus *caps; - MigrationState *s =3D migrate_get_current(); - int i; - - for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { -#ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (i =3D=3D MIGRATION_CAPABILITY_BLOCK) { - continue; - } -#endif - caps =3D g_malloc0(sizeof(*caps)); - caps->capability =3D i; - caps->state =3D s->capabilities[i]; - QAPI_LIST_APPEND(tail, caps); - } - - return head; -} - MigrationParameters *qmp_query_migrate_parameters(Error **errp) { MigrationParameters *params; diff --git a/migration/options.c b/migration/options.c index 367c930f46..ff621bdeb3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" #include "sysemu/runstate.h" #include "migration.h" #include "ram.h" @@ -390,3 +391,25 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) =20 return true; } + +MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) +{ + MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; + MigrationCapabilityStatus *caps; + MigrationState *s =3D migrate_get_current(); + int i; + + for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { +#ifndef CONFIG_LIVE_BLOCK_MIGRATION + if (i =3D=3D MIGRATION_CAPABILITY_BLOCK) { + continue; + } +#endif + caps =3D g_malloc0(sizeof(*caps)); + caps->capability =3D i; + caps->state =3D s->capabilities[i]; + QAPI_LIST_APPEND(tail, caps); + } + + return head; +} --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998165; cv=none; d=zohomail.com; s=zohoarc; b=GYOiIKCXRCVTuqfrSANpdb8HtR9H4GGIw3OqE3dD7kYQMPq3G7LLaG8vP+z2aYFmOdFPuJaad4l3Z/toUyrbvx1PfTpQh1AtMP0rHoG5FSnIgciRz6PzTwJMcGYimyZsTPuwHgjVtGko7lA8O7UQKmVzBrqhStA94dfkPn0jMCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998165; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=phOfzRXJoKlGUXTaPHFPkHS6a/ljDg3jq5lCIBPanlU=; b=dA33ghynACEaGAlfwD+ITwpZIZjl45yG5ewV+W3BLwirM82BY9BhgPGjI6MOd2wDtpVuU0M+VVcGjYfI8aNJXVRjpaTtVQzL+D9yc7PwG16Tc/3Y/JNQ3O0B3tIX0ODMYGhioS6aC0UAxKITCBZ+JSgsbM6F2iDqYSsw7YCc2hQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998165347439.26518552321534; Thu, 20 Apr 2023 06:42:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUX0-0004To-0a; Thu, 20 Apr 2023 09:41:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWx-0004O1-Mw for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWw-0005zC-7g for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:40:59 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-1bghk8kRO1uI-yllu4l0Cg-1; Thu, 20 Apr 2023 09:40:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16BA81C0897A; Thu, 20 Apr 2023 13:40:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EC184020BEE; Thu, 20 Apr 2023 13:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=phOfzRXJoKlGUXTaPHFPkHS6a/ljDg3jq5lCIBPanlU=; b=P1lGfHnApFBZr+rf3lizKGybIhQ7mrgVXZRu6C9khpn1q2Vd7V2qBrk89z/ga07PkjQkBC 0nQfpXiXOxvL1Ze0rAIUSvQWB5t1IqY8XulpxJD8PNAE5ry7YMuujyKkMRJqWeUHP16mja jpmdMbXfQxXIEKdsu3K4vYT7V5W473Y= X-MC-Unique: 1bghk8kRO1uI-yllu4l0Cg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 16/43] migration: Move qmp_migrate_set_capabilities() to options.c Date: Thu, 20 Apr 2023 15:39:35 +0200 Message-Id: <20230420134002.29531-17-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998165758100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 26 -------------------------- migration/options.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index bc796879c0..854be12ca6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1223,32 +1223,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, - Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - MigrationCapabilityStatusList *cap; - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); - return; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - for (cap =3D params; cap; cap =3D cap->next) { - new_caps[cap->value->capability] =3D cap->value->state; - } - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return; - } - - for (cap =3D params; cap; cap =3D cap->next) { - s->capabilities[cap->value->capability] =3D cap->value->state; - } -} - /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. diff --git a/migration/options.c b/migration/options.c index ff621bdeb3..4cbe77e35a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -413,3 +413,29 @@ MigrationCapabilityStatusList *qmp_query_migrate_capab= ilities(Error **errp) =20 return head; } + +void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, + Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + MigrationCapabilityStatusList *cap; + bool new_caps[MIGRATION_CAPABILITY__MAX]; + + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return; + } + + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + for (cap =3D params; cap; cap =3D cap->next) { + new_caps[cap->value->capability] =3D cap->value->state; + } + + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return; + } + + for (cap =3D params; cap; cap =3D cap->next) { + s->capabilities[cap->value->capability] =3D cap->value->state; + } +} --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998090; cv=none; d=zohomail.com; s=zohoarc; b=N5KBaGHy+c/Nokuz81K8YhJ7OknC2xqcpiuRxZD+fYxnRBRZwB1m/95l2iXyiGuXEyOpnRN9d0EkhToq9gaLjGw8t+tpuIk4bsZkWRHyRx5taHPwtfZ7gkNo8EjQVu9E9YWh6zpHcn+lmItDc/g6OtlVw1aPx0X9/m4009okmIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998090; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ronnoDXK6gxOuMRXUqfqbNKQGBf0n9I4RP5izYHcDLg=; b=A6BYh5eV7b1KfIbuHfXXyhcQaB8kj+axxqNDNYKlGd9OEQ8L+liFlNEAZvzvJ2gDxzjLKxfZsAQxPNXGKKc3UuYjt1J7BS8t9GvaGYOIKIvhhKoNa7m3BZh6NPrFX2opRBfp8azse7QvmyBwMFFmbhlGgoioWPmDH8fR4lJgwyU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998090973736.9208211779668; Thu, 20 Apr 2023 06:41:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUX1-0004W2-UE; Thu, 20 Apr 2023 09:41:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWz-0004Tl-Ts for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUWy-0005zv-DV for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-SBL9yICbNGyzreB_WWFUgA-1; Thu, 20 Apr 2023 09:40:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F15CD381D4CA; Thu, 20 Apr 2023 13:40:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59FB64020BED; Thu, 20 Apr 2023 13:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ronnoDXK6gxOuMRXUqfqbNKQGBf0n9I4RP5izYHcDLg=; b=a6V4/4gUze+tVpk4LuTehLW6nxzzAyValzgo/9rmR1tIPmF/xSrVa5oC7yK0vow6zsAP5B 3MYra96EX+spYYVhuMbLYCHME6EXysQPOi+zW9f+juSr7p6fnC9DoBkeAkDm9IsGzsIkNw 0+pvyxXyKrf5e15a+8zP2G8MVTacX0E= X-MC-Unique: SBL9yICbNGyzreB_WWFUgA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 17/43] migration: Move migrate_cap_set() to options.c Date: Thu, 20 Apr 2023 15:39:36 +0200 Message-Id: <20230420134002.29531-18-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998091765100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 20 -------------------- migration/options.c | 21 +++++++++++++++++++++ migration/options.h | 1 + 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 854be12ca6..4aac939833 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1667,26 +1667,6 @@ void migrate_set_state(int *state, int old_state, in= t new_state) } } =20 -static bool migrate_cap_set(int cap, bool value, Error **errp) -{ - MigrationState *s =3D migrate_get_current(); - bool new_caps[MIGRATION_CAPABILITY__MAX]; - - if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); - return false; - } - - memcpy(new_caps, s->capabilities, sizeof(new_caps)); - new_caps[cap] =3D value; - - if (!migrate_caps_check(s->capabilities, new_caps, errp)) { - return false; - } - s->capabilities[cap] =3D value; - return true; -} - static void migrate_set_block_incremental(MigrationState *s, bool value) { s->parameters.block_incremental =3D value; diff --git a/migration/options.c b/migration/options.c index 4cbe77e35a..f3b2d6e482 100644 --- a/migration/options.c +++ b/migration/options.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" +#include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" #include "migration.h" #include "ram.h" @@ -392,6 +393,26 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) return true; } =20 +bool migrate_cap_set(int cap, bool value, Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + bool new_caps[MIGRATION_CAPABILITY__MAX]; + + if (migration_is_running(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return false; + } + + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + new_caps[cap] =3D value; + + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { + return false; + } + s->capabilities[cap] =3D value; + return true; +} + MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) { MigrationCapabilityStatusList *head =3D NULL, **tail =3D &head; diff --git a/migration/options.h b/migration/options.h index e779f14161..5979e4ff90 100644 --- a/migration/options.h +++ b/migration/options.h @@ -41,5 +41,6 @@ bool migrate_zero_copy_send(void); /* capabilities helpers */ =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); +bool migrate_cap_set(int cap, bool value, Error **errp); =20 #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998578; cv=none; d=zohomail.com; s=zohoarc; b=kzKSn2Ychaf4vIlrS36fKmJiGBEINJfeDdyj4sLdHs/TxLhVQljjA6wn94agF/8pa4bjonZHCkouOTi54gdbL0eXzcEAmTe+WzJLOOTmxt/akrlvG2pfc6D+Ruk3GE6Llw3EqgK8ReVLK3cPWAl0r70IRSMdnxUVRbPN8vRCn5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998578; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FlQ6pWvHqvGWVP8QEAnfYhJzq8gskbcOIpeo6kzz9V4=; b=eUDfMaifYUjyvjWX606idSA6D5pfD7iaM+6I6LbIl4hiwdXY6Ypt0wtHwhLoFtErwmRL5qJoHgNqPsn7pwzqOm44Cjk7Za3ZXeYoHuchmRVNpOW5se88rcIHfmxk8uQYliAbQVOkk9jZlxTMyXWhWTRIMNQGeHhTNbwnNnLS1IY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998578115498.0400330568243; Thu, 20 Apr 2023 06:49:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUX4-0004gG-Ve; Thu, 20 Apr 2023 09:41:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX3-0004Wu-7v for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX1-00060e-FS for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:05 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-164-6ugD8-cBNTyVi6k9Ygw-rg-1; Thu, 20 Apr 2023 09:40:59 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A49E1C0897F; Thu, 20 Apr 2023 13:40:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 470DA4020BED; Thu, 20 Apr 2023 13:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FlQ6pWvHqvGWVP8QEAnfYhJzq8gskbcOIpeo6kzz9V4=; b=GJb6t6UAQXQiTc9UPyqRUZhfSiNCeobV2G70s5qp4hxcl5DUYM/CeL1l2F6YdPwg+o/Dcr Tur2Ep5sfUvDHCUYlrg38u/QGpmhANy0jUor9rfi18z/6d/+z03ppsyF9ygWUM54/H7KyJ MqxmaMctc6VY0W/OZkG6TR+6uS9SnoM= X-MC-Unique: 6ugD8-cBNTyVi6k9Ygw-rg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 18/43] migration: Move parameters functions to option.c Date: Thu, 20 Apr 2023 15:39:37 +0200 Message-Id: <20230420134002.29531-19-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998579634100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 91 --------------------------------------- migration/migration.h | 11 ----- migration/multifd-zlib.c | 1 + migration/multifd-zstd.c | 1 + migration/options.c | 93 ++++++++++++++++++++++++++++++++++++++++ migration/options.h | 13 ++++++ 6 files changed, 108 insertions(+), 102 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4aac939833..028c297121 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2265,79 +2265,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -int migrate_compress_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_level; -} - -int migrate_compress_threads(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_threads; -} - -int migrate_compress_wait_thread(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.compress_wait_thread; -} - -int migrate_decompress_threads(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.decompress_threads; -} - -int migrate_multifd_channels(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_channels; -} - -MultiFDCompression migrate_multifd_compression(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); - return s->parameters.multifd_compression; -} - -int migrate_multifd_zlib_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_zlib_level; -} - -int migrate_multifd_zstd_level(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.multifd_zstd_level; -} - int migrate_use_tls(void) { MigrationState *s; @@ -2347,24 +2274,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -uint64_t migrate_xbzrle_cache_size(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.xbzrle_cache_size; -} - -static int64_t migrate_max_postcopy_bandwidth(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.max_postcopy_bandwidth; -} - bool migrate_use_block_incremental(void) { MigrationState *s; diff --git a/migration/migration.h b/migration/migration.h index 24184622a8..8451e5f2fe 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,24 +449,13 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -int migrate_multifd_channels(void); -MultiFDCompression migrate_multifd_compression(void); -int migrate_multifd_zlib_level(void); -int migrate_multifd_zstd_level(void); - int migrate_use_tls(void); -uint64_t migrate_xbzrle_cache_size(void); =20 bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); =20 uint64_t ram_get_total_transferred_pages(void); =20 -int migrate_compress_level(void); -int migrate_compress_threads(void); -int migrate_compress_wait_thread(void); -int migrate_decompress_threads(void); - /* Sending on the return path - generic and then for each message type */ void migrate_send_rp_shut(MigrationIncomingState *mis, uint32_t value); diff --git a/migration/multifd-zlib.c b/migration/multifd-zlib.c index 37770248e1..81701250ad 100644 --- a/migration/multifd-zlib.c +++ b/migration/multifd-zlib.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "migration.h" #include "trace.h" +#include "options.h" #include "multifd.h" =20 struct zlib_data { diff --git a/migration/multifd-zstd.c b/migration/multifd-zstd.c index f4a8e1ed1f..d1d29e76cc 100644 --- a/migration/multifd-zstd.c +++ b/migration/multifd-zstd.c @@ -18,6 +18,7 @@ #include "qapi/error.h" #include "migration.h" #include "trace.h" +#include "options.h" #include "multifd.h" =20 struct zstd_data { diff --git a/migration/options.c b/migration/options.c index f3b2d6e482..8d15be858c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -460,3 +460,96 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, s->capabilities[cap->value->capability] =3D cap->value->state; } } + +/* parameters */ + +int migrate_compress_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_level; +} + +int migrate_compress_threads(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_threads; +} + +int migrate_compress_wait_thread(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.compress_wait_thread; +} + +int migrate_decompress_threads(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.decompress_threads; +} + +int64_t migrate_max_postcopy_bandwidth(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_postcopy_bandwidth; +} + +int migrate_multifd_channels(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_channels; +} + +MultiFDCompression migrate_multifd_compression(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); + return s->parameters.multifd_compression; +} + +int migrate_multifd_zlib_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_zlib_level; +} + +int migrate_multifd_zstd_level(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.multifd_zstd_level; +} + +uint64_t migrate_xbzrle_cache_size(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.xbzrle_cache_size; +} diff --git a/migration/options.h b/migration/options.h index 5979e4ff90..b24ee92283 100644 --- a/migration/options.h +++ b/migration/options.h @@ -43,4 +43,17 @@ bool migrate_zero_copy_send(void); bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); bool migrate_cap_set(int cap, bool value, Error **errp); =20 +/* parameters */ + +int migrate_compress_level(void); +int migrate_compress_threads(void); +int migrate_compress_wait_thread(void); +int migrate_decompress_threads(void); +int64_t migrate_max_postcopy_bandwidth(void); +int migrate_multifd_channels(void); +MultiFDCompression migrate_multifd_compression(void); +int migrate_multifd_zlib_level(void); +int migrate_multifd_zstd_level(void); +uint64_t migrate_xbzrle_cache_size(void); + #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998170; cv=none; d=zohomail.com; s=zohoarc; b=SBHSlsjVG+hFkN9n3FbGbZ5qUZO07NStQsvcBpPh9NuENNrINV/9kDEApn5T9PjxkfISc78sIVm+M3ZYamoH/w9krxtRPKrvhun3N/tLxRLTP5ChJCyigcVNusbts6X21dT04PFqzlz9b9jCtBqv4dwpNKlEol3QlLXND3RpmZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998170; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5NehSuZRJQLLM7k/p6QH98AiXlb/MterREbi9CDFL/M=; b=ZnsAYddX9PMb2XtVWwfAoOVuIMnBnFKayybjLW791hG7+VQ+UWj6O7TGwEg0CNVbmSnvOcolQHFImUM1zgi1Qv9499ev5u+3w58SxJMvqbdfjGYbf+DPttXOdEETwlniycpc/1adX2kzRDg3LOh2Or/kd+odVjcWYldM2fxPj3g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998170223405.91110802184744; Thu, 20 Apr 2023 06:42:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUX7-0004sl-TG; Thu, 20 Apr 2023 09:41:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX5-0004iZ-KK for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX4-00061T-3T for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:07 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-sa2V8fqSNeWYW8sC6NaeWQ-1; Thu, 20 Apr 2023 09:41:02 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E751F280AA2E; Thu, 20 Apr 2023 13:41:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DDFB4020BED; Thu, 20 Apr 2023 13:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5NehSuZRJQLLM7k/p6QH98AiXlb/MterREbi9CDFL/M=; b=VsTEwY+2Kdo6JTOGUOm56EXoZSv5+7PtFxGxoppDF+OI8hcHtlD8rrqLLvrwJCPFjZpUFD at8V7hx2vXccKOUt/SkH1TP/a1OykH0iWT1+4czTy5Zm26OuNu2sAp7ORl5VoN36foa4C9 q0HTnxABb9wPJ+VnrWbm4b9lHY+QQs8= X-MC-Unique: sa2V8fqSNeWYW8sC6NaeWQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 19/43] migration: Use migrate_max_postcopy_bandwidth() Date: Thu, 20 Apr 2023 15:39:38 +0200 Message-Id: <20230420134002.29531-20-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998172297100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 028c297121..88bcaec08e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3800,7 +3800,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) =20 if (resume) { /* This is a resumed migration */ - rate_limit =3D s->parameters.max_postcopy_bandwidth / + rate_limit =3D migrate_max_postcopy_bandwidth() / XFER_LIMIT_RATIO; } else { /* This is a fresh new migration */ --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998154; cv=none; d=zohomail.com; s=zohoarc; b=GkB1qoerXPH2AAC/OG73H5XQwrbntXJa2VJaEjG4i4CwUUnInI4yxMnIs9+8LNP5yhkeZK0JXV047PmsHhJBKc3KMulf+d6v9g4nZ9bQWydOlZBey5ZktJdM0b6ivF1bVKktMMjJC3QIdpcSQkGxgm3jiFXGk4fqpaW2EyYMb3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998154; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Gixa/TYb0inFga0TuTQz0dtqas6xMuY3pBzeKeTotF8=; b=A8GKGru+MCtZ95ZfrGRw9D14rEJUWfl3bExn0oHGxWH7/3wY8Osgrdp+PqK/OnaDq825lt4n6O6E399XgLmjC6tU/X7XGr67cFau59KguZKt9LzQHkOY3SuWMGAONqu9ONlE8pNm6h9kG2Xr0OmDII+7vOIeqkq7hQMfQi3viMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998154765552.0868311810838; Thu, 20 Apr 2023 06:42:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXC-0005KF-0o; Thu, 20 Apr 2023 09:41:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX8-000506-IG for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUX6-00062U-V5 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-235-sOpXWq5gOWSmpcdN3xkMug-1; Thu, 20 Apr 2023 09:41:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB7C9280AA2E; Thu, 20 Apr 2023 13:41:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B3BE4020BED; Thu, 20 Apr 2023 13:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gixa/TYb0inFga0TuTQz0dtqas6xMuY3pBzeKeTotF8=; b=D/LlPjlX4m00VnTNjY2x7XiECAYCssz5HpOtxNJkEttxsEPKHYMGi5+NEr9PBIoAG+Bnnh A/1Sl9j89UZhCMSf8wVhuJDK72u/rnXVxUtU5MSvTfBR/MElA5LxkfrC1fHbxzNz9GTKm2 SdjhsccsHR+DoP7/dCDVrddA9F5PLRI= X-MC-Unique: sOpXWq5gOWSmpcdN3xkMug-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 20/43] migration: Move migrate_use_block_incremental() to option.c Date: Thu, 20 Apr 2023 15:39:39 +0200 Message-Id: <20230420134002.29531-21-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998156406100001 Content-Type: text/plain; charset="utf-8" To be consistent with every other parameter, rename to migrate_block_increm= ental(). Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/block.c | 2 +- migration/migration.c | 11 +---------- migration/migration.h | 1 - migration/options.c | 9 +++++++++ migration/options.h | 1 + 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/block.c b/migration/block.c index f0977217cf..6d532ac7a2 100644 --- a/migration/block.c +++ b/migration/block.c @@ -417,7 +417,7 @@ static int init_blk_migration(QEMUFile *f) bmds->bulk_completed =3D 0; bmds->total_sectors =3D sectors; bmds->completed_sectors =3D 0; - bmds->shared_base =3D migrate_use_block_incremental(); + bmds->shared_base =3D migrate_block_incremental(); =20 assert(i < num_bs); bmds_bs[i].bmds =3D bmds; diff --git a/migration/migration.c b/migration/migration.c index 88bcaec08e..dbb89c2e7b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2158,7 +2158,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, error_setg(errp, "No disk migration is required in COLO mode"); return false; } - if (migrate_block() || migrate_use_block_incremental()) { + if (migrate_block() || migrate_block_incremental()) { error_setg(errp, "Command options are incompatible with " "current migration capabilities"); return false; @@ -2274,15 +2274,6 @@ int migrate_use_tls(void) return s->parameters.tls_creds && *s->parameters.tls_creds; } =20 -bool migrate_use_block_incremental(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.block_incremental; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 8451e5f2fe..86051af132 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -451,7 +451,6 @@ bool migrate_postcopy(void); =20 int migrate_use_tls(void); =20 -bool migrate_use_block_incremental(void); int migrate_max_cpu_throttle(void); =20 uint64_t ram_get_total_transferred_pages(void); diff --git a/migration/options.c b/migration/options.c index 8d15be858c..2b6d88b4b9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -463,6 +463,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, =20 /* parameters */ =20 +bool migrate_block_incremental(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.block_incremental; +} + int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index b24ee92283..96d5a8e6e4 100644 --- a/migration/options.h +++ b/migration/options.h @@ -45,6 +45,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); =20 /* parameters */ =20 +bool migrate_block_incremental(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998158; cv=none; d=zohomail.com; s=zohoarc; b=CjkRvYOYW3ql08LQfuQZvdClgyYFkE+TPwMc1dGZ4ubczWAlBf2KqjrkKx6HB5ttMoUjI4Kn5LOTz7j8mWkTkqxe5IGgB9y+URphlTZcROZ3x9/kR6038ZVaOrCBTYL69JguZTvZOpRn/5popSYRKI26oplTUqHZq9KCKcMCKwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998158; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8dd1qpIg5EosZRg1/iERllcRBSzXOoLMPBthcseLXCU=; b=C4X5ZqSG96bOOzCuEMEyEjRXYCO4Dnq8itun2jdEHSugmrN9VkODs2Nag+FIcdSs66W8SoBgmVvy9tReTrniuFmBXR1WxQgTR+QWBAw94f/OsRgSo0SOpWc8GUzNq29oXlWCkC6ami8lAz/zkbVnKIAKcsAWLShgrovT4rympEk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998158026424.7413366254682; Thu, 20 Apr 2023 06:42:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXG-0005QB-L9; Thu, 20 Apr 2023 09:41:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXC-0005Lt-N8 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXB-00063H-6T for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-414-Vhv7msquOOqcuzz8yjo-LA-1; Thu, 20 Apr 2023 09:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05CB9811E7E; Thu, 20 Apr 2023 13:41:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AAC64020BED; Thu, 20 Apr 2023 13:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8dd1qpIg5EosZRg1/iERllcRBSzXOoLMPBthcseLXCU=; b=B+A2BhJo8Z1IvdIgh27r0jW/TNH6RyoqNvubZgTcpSCSC3OYs2SKleeg40kyPUgzvMnccd lalNpgggTrtrcBPnW2gepXK2/XzgboCJxf0PD97W1Fo5MCdmFJxu6Ojvwbe4qd+FFxH75g nfkPy8/kzthPuxc1BOmlnceghz10XYs= X-MC-Unique: Vhv7msquOOqcuzz8yjo-LA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 21/43] migration: Create migrate_throttle_trigger_threshold() Date: Thu, 20 Apr 2023 15:39:40 +0200 Message-Id: <20230420134002.29531-22-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998158398100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 2b6d88b4b9..b9f3815f7e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -554,6 +554,15 @@ int migrate_multifd_zstd_level(void) return s->parameters.multifd_zstd_level; } =20 +uint8_t migrate_throttle_trigger_threshold(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.throttle_trigger_threshold; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 96d5a8e6e4..aa54443353 100644 --- a/migration/options.h +++ b/migration/options.h @@ -55,6 +55,7 @@ int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); +uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 #endif diff --git a/migration/ram.c b/migration/ram.c index 7f28588dde..68801012ba 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1179,8 +1179,7 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) =20 static void migration_trigger_throttle(RAMState *rs) { - MigrationState *s =3D migrate_get_current(); - uint64_t threshold =3D s->parameters.throttle_trigger_threshold; + uint64_t threshold =3D migrate_throttle_trigger_threshold(); uint64_t bytes_xfer_period =3D stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998223; cv=none; d=zohomail.com; s=zohoarc; b=BRH6USq9dlVn8GwqyA43PelpN1uOKib8+Ob15BEf8wN0YzD/sQnAd0cE3ECZLSDuLT8a8b0uoP5uh7wS1i50WrWJv4QjFmo+Kor7z8PnE2dF/EtPcuOynnVo6hC9GsbKrjZZ0g1yVbNLpDkUjdEIaek7/Sn5Ii8kn+pdOxBF06M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998223; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8CRmQtQdAt0C22iXk/xI6we/pRFK1kPjGUP3BZyJzXs=; b=W4OR8sAa2pgTYEGSnv8DigZkAHWKLiu6xYQ4A5EtPXqac321auJVI2E0EIVv5pOCfqxRdiCfV/dQQN0I6EqiWI/1FXpdkdzeOrwH85l9WfP2RtBUYyIkueSDZvKt8PPjvYzGgefS6QgrjA+9+aBYs8mPvR3+FPcMGy3ehpuqEKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998223157881.5003250568801; Thu, 20 Apr 2023 06:43:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXI-0005c3-TT; Thu, 20 Apr 2023 09:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXE-0005Mt-Ek for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXD-000643-2N for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-0C8KYDEpN-aw5Sh9krN2uA-1; Thu, 20 Apr 2023 09:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D96331C0897A; Thu, 20 Apr 2023 13:41:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C1B34020BF1; Thu, 20 Apr 2023 13:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8CRmQtQdAt0C22iXk/xI6we/pRFK1kPjGUP3BZyJzXs=; b=UKWHZqqEthFQClS/uZ/xrZ+dHzhwo4mFa8cEzy0Kmpqpn+24pvC+HFS63I/fXa2BShcMX1 apUQbfqvXSFMvqAEQdl/AjDW+3Owvfn9MzLF1P5AgDcblll4osOrCtcZzyKJrevEZrgTOg YvFkaNIBEMn9gmsf995iWPjjBWGuf9s= X-MC-Unique: 0C8KYDEpN-aw5Sh9krN2uA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 22/43] migration: Create migrate_checkpoint_delay() Date: Thu, 20 Apr 2023 15:39:41 +0200 Message-Id: <20230420134002.29531-23-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998224646100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/colo.c | 5 ++--- migration/options.c | 9 +++++++++ migration/options.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 93b78c9270..07bfa21fea 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -576,7 +576,7 @@ static void colo_process_checkpoint(MigrationState *s) trace_colo_vm_state_change("stop", "run"); =20 timer_mod(s->colo_delay_timer, qemu_clock_get_ms(QEMU_CLOCK_HOST) + - s->parameters.x_checkpoint_delay); + migrate_checkpoint_delay()); =20 while (s->state =3D=3D MIGRATION_STATUS_COLO) { if (failover_get_state() !=3D FAILOVER_STATUS_NONE) { @@ -651,8 +651,7 @@ void colo_checkpoint_notify(void *opaque) =20 qemu_event_set(&s->colo_checkpoint_event); s->colo_checkpoint_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); - next_notify_time =3D s->colo_checkpoint_time + - s->parameters.x_checkpoint_delay; + next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); timer_mod(s->colo_delay_timer, next_notify_time); } =20 diff --git a/migration/options.c b/migration/options.c index b9f3815f7e..0e102e5700 100644 --- a/migration/options.c +++ b/migration/options.c @@ -472,6 +472,15 @@ bool migrate_block_incremental(void) return s->parameters.block_incremental; } =20 +uint32_t migrate_checkpoint_delay(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.x_checkpoint_delay; +} + int migrate_compress_level(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index aa54443353..adc2879bbb 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,6 +46,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); /* parameters */ =20 bool migrate_block_incremental(void); +uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998138; cv=none; d=zohomail.com; s=zohoarc; b=Vs2Iry7sZ/L5oqsxjIh52OylHF0+HxFf4OWDOP3NE8LVn7FH8C0xESpv6Ow3AFn8h+AIsMhuofigt+ztTZ2ZsNML+V4QQDyNychZMlcSLtR9SP3xFsOYGk09MygHLET4G7TaDZbNyZH5jgbrWe1PqSXvSd4cONmh+f4eZ70wcVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998138; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vhpFrw/MA9nliITLVARe4P2rJwAbLQ6NAkK/cKfneY0=; b=cTQpDPAEKYgM531b56GjtvZaLrONFkuO/KaIpAN64eB8Ztyds/rI6Ebbm6AgPj8perF/Cp5VUEzOHmUIqITmwOfCqtTmvxD4KIaQAZ1rYc+1/3Y7ANdrQ8erKpcKSD/TAs0qJPHwtIAsxtucU2+tFJdHshtA/+x7D4Zt01C7bt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998138381904.1092894560292; Thu, 20 Apr 2023 06:42:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXg-0006I4-7F; Thu, 20 Apr 2023 09:41:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXV-00063Z-8m for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXK-00065c-2l for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:24 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-259-cCOEwktQMhy5bm0AjDe_Gg-1; Thu, 20 Apr 2023 09:41:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4030381D4C3; Thu, 20 Apr 2023 13:41:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29B7F4020BED; Thu, 20 Apr 2023 13:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vhpFrw/MA9nliITLVARe4P2rJwAbLQ6NAkK/cKfneY0=; b=iETL9VtlCx80YiYEduQvBV9uJBtVqFgb7MaTuJuCCn+8ejsBgdUNESLbJHhd+c6Ky8OLCH eH6Al2XRra7DvPEsZ1xXviGEhi87NPCepDcXycK1+hVDMkWbefkDHum0CDqCGklGnRgn2n o3ebdAmrUZEKpB7HI1DnKl0KMzv8YYI= X-MC-Unique: cCOEwktQMhy5bm0AjDe_Gg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 23/43] migration: Create migrate_max_cpu_throttle() Date: Thu, 20 Apr 2023 15:39:42 +0200 Message-Id: <20230420134002.29531-24-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998139858100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.h | 2 -- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index 86051af132..3ae938b19c 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -451,8 +451,6 @@ bool migrate_postcopy(void); =20 int migrate_use_tls(void); =20 -int migrate_max_cpu_throttle(void); - uint64_t ram_get_total_transferred_pages(void); =20 /* Sending on the return path - generic and then for each message type */ diff --git a/migration/options.c b/migration/options.c index 0e102e5700..2cb04fbbd1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -517,6 +517,15 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 +uint8_t migrate_max_cpu_throttle(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_cpu_throttle; +} + int64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index adc2879bbb..72b1a320b7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -51,6 +51,7 @@ int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); int migrate_decompress_threads(void); +uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); diff --git a/migration/ram.c b/migration/ram.c index 68801012ba..2ab678bb45 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -715,7 +715,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, uint64_t pct_initial =3D s->parameters.cpu_throttle_initial; uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; - int pct_max =3D s->parameters.max_cpu_throttle; + int pct_max =3D migrate_max_cpu_throttle(); =20 uint64_t throttle_now =3D cpu_throttle_get_percentage(); uint64_t cpu_now, cpu_ideal, throttle_inc; --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998142; cv=none; d=zohomail.com; s=zohoarc; b=EuNPRdDwNjYQOWDsxFjPBZ6zfBzGS4VfnWLb+OuHfR91Rvs4r6Krm6LF3+v+sfkUqB3tpR3xmsnyfIqLl3dK//jhO5hHSXTa5Wcx5vhF6/S44Zz1UUEYbPJQGin9bbtEyl5nKFXyuGDguKuBRXPIAP4g9pWyJ44FAr5ThUabMrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998142; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9azH+M8impGZXeualRkRQS2DjUArd/2vTFLjxBFkkUw=; b=UhUoqVXGeXZLHVHJUdtf5t11f2fEkQJzRj6ZoV7WdClTy0RGXr4aG54r6moxn51cKZH+6Y9TZfyul3G9HpXlomL6+qCeag0Q3S/8WsfIundWR2g2vpzP7/PZPO5apAyjM8b+F8G2neLPVRId1t1ivF6EUyvsCDNqOsyMaDKCK1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998142869163.63782244870515; Thu, 20 Apr 2023 06:42:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXT-0005vU-8Z; Thu, 20 Apr 2023 09:41:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXL-0005jj-1G for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXJ-00065N-GY for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:22 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-Iz8B_8LvM_-N7XkNscy0ow-1; Thu, 20 Apr 2023 09:41:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C854D858F0E; Thu, 20 Apr 2023 13:41:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 040804020BEE; Thu, 20 Apr 2023 13:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9azH+M8impGZXeualRkRQS2DjUArd/2vTFLjxBFkkUw=; b=PnmLeKMxyfGT9tplOeBI6srtiVnJwYiiTTC/VcurqWpLr0vWzGsdMoH4CdmfLuFC3QqnrA EnyONen+52CNjOMH8655FHXRc7sP1VzAJIBsVNnpNwRYnrlARqd5LvFBVfqlsqcO4uJNQh 2YmTR/+/IKbM5yfkV1p38ZC0zmtLBZs= X-MC-Unique: Iz8B_8LvM_-N7XkNscy0ow-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 24/43] migration: Move migrate_announce_params() to option.c Date: Thu, 20 Apr 2023 15:39:43 +0200 Message-Id: <20230420134002.29531-25-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998144446100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 14 -------------- migration/options.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index dbb89c2e7b..2191437b15 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -954,20 +954,6 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) return params; } =20 -AnnounceParameters *migrate_announce_params(void) -{ - static AnnounceParameters ap; - - MigrationState *s =3D migrate_get_current(); - - ap.initial =3D s->parameters.announce_initial; - ap.max =3D s->parameters.announce_max; - ap.rounds =3D s->parameters.announce_rounds; - ap.step =3D s->parameters.announce_step; - - return ≈ -} - /* * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) diff --git a/migration/options.c b/migration/options.c index 2cb04fbbd1..ed9d2a226f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -16,6 +16,7 @@ #include "qapi/qapi-commands-migration.h" #include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" +#include "migration/misc.h" #include "migration.h" #include "ram.h" #include "options.h" @@ -589,3 +590,21 @@ uint64_t migrate_xbzrle_cache_size(void) =20 return s->parameters.xbzrle_cache_size; } + +/* parameters helpers */ + +AnnounceParameters *migrate_announce_params(void) +{ + static AnnounceParameters ap; + + MigrationState *s =3D migrate_get_current(); + + ap.initial =3D s->parameters.announce_initial; + ap.max =3D s->parameters.announce_max; + ap.rounds =3D s->parameters.announce_rounds; + ap.step =3D s->parameters.announce_step; + + return ≈ +} + + --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998223; cv=none; d=zohomail.com; s=zohoarc; b=JiBq6QMwlMTIwjfxT5b6nDmG3g6SEyBnQvih4uJBQ2nLvpMUsN5eWxcZj6utzLDK59edy5R8NSpdzSaFbhEHVLyYcxvzBMYm5slHdsxvvA/8JmsTobENoqDpq/jBwnOWStejiVqGvZhvG7jVta5bUZl2yRAAF/dZNF4eomJT7bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998223; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ADDyZgWBh+DJN310L7TzUV4laLdNB0+j/NXQ57hoVdk=; b=VBZpFiVDUtRm5/SBhxkCfCwQ8ayUYzsDDh+e0S3VE0ljOHuORpeHvFNtPDN5BeTG9q0d8HZAZhwhRVvbsPfbrAjjWgk3tjQfCijIGseL0oisGvRJaPoD+nMNeNPGRxIB8S8tv1WVVB95+N4OAianBIICF2FFeJN+swFYUtF7VU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998223049185.40117230418093; Thu, 20 Apr 2023 06:43:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUY3-00070k-GL; Thu, 20 Apr 2023 09:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXX-0006AB-TG for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXV-00066j-0V for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-370-OL5MM2tANAqufN36k-5MjA-1; Thu, 20 Apr 2023 09:41:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4E89886C60; Thu, 20 Apr 2023 13:41:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 190454020BED; Thu, 20 Apr 2023 13:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ADDyZgWBh+DJN310L7TzUV4laLdNB0+j/NXQ57hoVdk=; b=TkDDnXxueHttbRAGOPfymujBvZ7XjlJZq4UkFf3HthC6myaZBci6LxJeksC4nDIMv20Apf GIGOJbjdi5jIPKdYrpeGlG7OhyiT9TaqPCv4ZJX8+4aZEw3uRa903mZXcGvbs89r7o0tdV R9lzXAyNYRQ+SPHWpZ7+PHz1ovcV/TM= X-MC-Unique: OL5MM2tANAqufN36k-5MjA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 25/43] migration: Create migrate_cpu_throttle_initial() to option.c Date: Thu, 20 Apr 2023 15:39:44 +0200 Message-Id: <20230420134002.29531-26-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998224904100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index ed9d2a226f..34a1f58f96 100644 --- a/migration/options.c +++ b/migration/options.c @@ -509,6 +509,15 @@ int migrate_compress_wait_thread(void) return s->parameters.compress_wait_thread; } =20 +uint8_t migrate_cpu_throttle_initial(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_initial; +} + int migrate_decompress_threads(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 72b1a320b7..fd8b91d767 100644 --- a/migration/options.h +++ b/migration/options.h @@ -50,6 +50,7 @@ uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); +uint8_t migrate_cpu_throttle_initial(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); diff --git a/migration/ram.c b/migration/ram.c index 2ab678bb45..70576b1f52 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -712,7 +712,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, uint64_t bytes_dirty_threshold) { MigrationState *s =3D migrate_get_current(); - uint64_t pct_initial =3D s->parameters.cpu_throttle_initial; + uint64_t pct_initial =3D migrate_cpu_throttle_initial(); uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; int pct_max =3D migrate_max_cpu_throttle(); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998253; cv=none; d=zohomail.com; s=zohoarc; b=BIkzLhlZ37siv3qPZb7e6jcdQLvkZo7i/QJTPmdgQgtRb9NzzUigLmT59ASru65RIYZTJlfuL32b71/S2enm5tK6RbvP3dqOnTBMZsQOba8ShPt0m11rhNfauTdI/XQRpstQTWaEitsPMhuB/4T4ehzbYlP6yUGJAlEJSk8y7mA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998253; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2NC2U22V7AJz+nbmiLndU2R2KHFuYwTzJx/+4xNKJhE=; b=jW2Kj+huM/9Oay/RcHLzkA3YcfLaxMzNPe4ix59GmUXX9lWjcAoNYWPnkGu8rwRPgrhDXOWOrggfU5/FhkYhgm1610CBHceIBEuwbIUxjsO6WvjfpMvqpLmVNJm4N8S4aTavE6FeSwhvF+BxmPycSBluAJzydW/3IlotR/geIgI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168199825348485.78236091419649; Thu, 20 Apr 2023 06:44:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUY3-0006yt-Cu; Thu, 20 Apr 2023 09:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXX-0006A9-Nw for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXS-00066d-FY for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:34 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-rpPGmWyoPtGE34QUgEm_vA-1; Thu, 20 Apr 2023 09:41:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DFE8800047; Thu, 20 Apr 2023 13:41:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id E82BC4020BED; Thu, 20 Apr 2023 13:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2NC2U22V7AJz+nbmiLndU2R2KHFuYwTzJx/+4xNKJhE=; b=fETAT6c2u1suThsFWULDiotKgJwEQs7Mb6iRM6VVzZ7f8JiGwXz0tCKiJoIASQ80HgzTUc kOv4YYwVfgTeJ9mgr1cvZkX0otjYmDJy+fCOY6tD4R3a6MioYPD1F7k64ZdCHhOCs6soe+ u2xZldUTyNXwkeG5bNhDCfpEPgvuXM8= X-MC-Unique: rpPGmWyoPtGE34QUgEm_vA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 26/43] migration: Create migrate_cpu_throttle_increment() function Date: Thu, 20 Apr 2023 15:39:45 +0200 Message-Id: <20230420134002.29531-27-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998254782100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/options.c b/migration/options.c index 34a1f58f96..e31d907d3d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -509,6 +509,15 @@ int migrate_compress_wait_thread(void) return s->parameters.compress_wait_thread; } =20 +uint8_t migrate_cpu_throttle_increment(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_increment; +} + uint8_t migrate_cpu_throttle_initial(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index fd8b91d767..49b29bdafd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -50,6 +50,7 @@ uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); int migrate_compress_threads(void); int migrate_compress_wait_thread(void); +uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); diff --git a/migration/ram.c b/migration/ram.c index 70576b1f52..c29c47f94d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -713,7 +713,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirt= y_period, { MigrationState *s =3D migrate_get_current(); uint64_t pct_initial =3D migrate_cpu_throttle_initial(); - uint64_t pct_increment =3D s->parameters.cpu_throttle_increment; + uint64_t pct_increment =3D migrate_cpu_throttle_increment(); bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; int pct_max =3D migrate_max_cpu_throttle(); =20 --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998590; cv=none; d=zohomail.com; s=zohoarc; b=lbhfGXAKrkhy+YAuhVSiGmrgYP+tbOEOMAffoMIfnS+4alFba5mIzsPCBppL/kHZb6LjVws95uyyqSjbaEpxyFWwQ2RpFP8e8+NJ7DsgqU+ItMYxQU/5wYW9iNb/FxQuSuDhFeCwIMlAggvrrAU8CDTEDWPaOh2w+6H0YhGF0yk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998590; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OdMgciJEsSJpPUiCd7sIA+b04BtnzB7EKKPkEXASq3E=; b=L4ym846TpX1eXwKaCPTVd7HqKFRMJFeuuJGy+fEaWPO+oeZWjUXaViwL2CnjShQBIB2hpDkI0YsSFWJpvh8G/F+153oFHaUHwomEgGL9vx2ndT5n4jgpJfQ8f20cHWvFpks/qEKVJvA0lJrvJAbgm0scmkkoGKtCfqVXezayY4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998590329667.0280937998217; Thu, 20 Apr 2023 06:49:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXz-0006oF-Dg; Thu, 20 Apr 2023 09:42:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXZ-0006DH-7D for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXV-00069P-Mq for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:36 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-19-dJXP0Ii0NLupfgozmxkJbQ-1; Thu, 20 Apr 2023 09:41:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 596B5381D4CC; Thu, 20 Apr 2023 13:41:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0DAF4020BF1; Thu, 20 Apr 2023 13:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OdMgciJEsSJpPUiCd7sIA+b04BtnzB7EKKPkEXASq3E=; b=Z9C6QYgmf4lpXl4ZvNke7GoIYn4NAZAKHydD14qbysKL/2RYVtbDBhCxNStkMjsBavl2F8 LE7mP0JCDPT1ZM30wY5A+lrRwKT/YKjXAKzvHjIbdkEfl7EZvkqbbPBbKvGf3PMfLa0jeB Jxwi/+OzGYbfqd9dCTCltLPBm7id2ac= X-MC-Unique: dJXP0Ii0NLupfgozmxkJbQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 27/43] migration: Create migrate_cpu_throttle_tailslow() function Date: Thu, 20 Apr 2023 15:39:46 +0200 Message-Id: <20230420134002.29531-28-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998591038100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/options.c | 9 +++++++++ migration/options.h | 1 + migration/ram.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index e31d907d3d..a111d0d43f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -527,6 +527,15 @@ uint8_t migrate_cpu_throttle_initial(void) return s->parameters.cpu_throttle_initial; } =20 +bool migrate_cpu_throttle_tailslow(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.cpu_throttle_tailslow; +} + int migrate_decompress_threads(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index 49b29bdafd..99f6bbd7a1 100644 --- a/migration/options.h +++ b/migration/options.h @@ -52,6 +52,7 @@ int migrate_compress_threads(void); int migrate_compress_wait_thread(void); uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); +bool migrate_cpu_throttle_tailslow(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); int64_t migrate_max_postcopy_bandwidth(void); diff --git a/migration/ram.c b/migration/ram.c index c29c47f94d..3862ec0853 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -711,10 +711,9 @@ static size_t save_page_header(PageSearchStatus *pss, = QEMUFile *f, static void mig_throttle_guest_down(uint64_t bytes_dirty_period, uint64_t bytes_dirty_threshold) { - MigrationState *s =3D migrate_get_current(); uint64_t pct_initial =3D migrate_cpu_throttle_initial(); uint64_t pct_increment =3D migrate_cpu_throttle_increment(); - bool pct_tailslow =3D s->parameters.cpu_throttle_tailslow; + bool pct_tailslow =3D migrate_cpu_throttle_tailslow(); int pct_max =3D migrate_max_cpu_throttle(); =20 uint64_t throttle_now =3D cpu_throttle_get_percentage(); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998278; cv=none; d=zohomail.com; s=zohoarc; b=GoP+XReaBcmQ6bO8qoG47Bgeq3uqQm8jglvJsp+GjzLVVORGKdn/2u6XcEHumA1ykhblywgg+/gZjLRsheUguiDWhvAK9tQ+rMi2Ed3/I0QxPmeOwsTAlcevp15xYmQ2PcISP4vWFEkIuKU4uKtAxnsbVgZl1VW4+OAnk3KpJ7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998278; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IZQsgTAQm4hPqvs3WBnDUVTdB3h90fnIDlKd/MLTT7Y=; b=PA/xou7Z6L34OfDkP7hj5s1/Ckr1PpSXtljhwxutv9rclARAOTo2T6kPsOGcOMZKm0GxJiySkvdWSYFkBNBB7wulsT8+EvtZk4gtUcJb4q9jd4jQtFhgQijCvhtCDoGszmNYpj0yMp6zKLWsOIet/ncYDrJd67WdSyCQnJoLNN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16819982784291009.6614621376528; Thu, 20 Apr 2023 06:44:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUY6-0007Q5-HG; Thu, 20 Apr 2023 09:42:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXc-0006Jx-Q5 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXV-00069e-NZ for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:40 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-299-r5N3SvavN1e7CsJ8YhqdTg-1; Thu, 20 Apr 2023 09:41:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 344DF29AA39B; Thu, 20 Apr 2023 13:41:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DDEF4020BED; Thu, 20 Apr 2023 13:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IZQsgTAQm4hPqvs3WBnDUVTdB3h90fnIDlKd/MLTT7Y=; b=ZkaCOoQ5Y2tP7ccsLokJVHo2+gMqlc/7uGfu4HNCoMGHS7sHvNpOQl4CgkAdjp4pOp2vso d0FQUFajWTNcGUw+XXXCJQxpvVOX9Sc7AlQbcLI0uI8Z4HPAHSAelKNEZ1qvpKUaItagLY RB47F0qXYK2eOy8g+TyRcjGHjNzvSO0= X-MC-Unique: r5N3SvavN1e7CsJ8YhqdTg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 28/43] migration: Move migrate_use_tls() to options.c Date: Thu, 20 Apr 2023 15:39:47 +0200 Message-Id: <20230420134002.29531-29-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998278948100001 Content-Type: text/plain; charset="utf-8" Once there, rename it to migrate_tls() and make it return bool for consistency. Signed-off-by: Juan Quintela --- migration/migration.c | 9 --------- migration/migration.h | 2 -- migration/options.c | 16 +++++++++++++++- migration/options.h | 9 +++++++++ migration/tls.c | 3 ++- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2191437b15..bbc9a07fd7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2251,15 +2251,6 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 -int migrate_use_tls(void) -{ - MigrationState *s; - - s =3D migrate_get_current(); - - return s->parameters.tls_creds && *s->parameters.tls_creds; -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 3ae938b19c..2099470e8e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -449,8 +449,6 @@ MigrationState *migrate_get_current(void); =20 bool migrate_postcopy(void); =20 -int migrate_use_tls(void); - uint64_t ram_get_total_transferred_pages(void); =20 /* Sending on the return path - generic and then for each message type */ diff --git a/migration/options.c b/migration/options.c index a111d0d43f..6db221157f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -204,6 +204,20 @@ bool migrate_zero_copy_send(void) =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } + +/* pseudo capabilities */ + +bool migrate_tls(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.tls_creds && *s->parameters.tls_creds; +} + + + typedef enum WriteTrackingSupport { WT_SUPPORT_UNKNOWN =3D 0, WT_SUPPORT_ABSENT, @@ -353,7 +367,7 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,= Error **errp) new_caps[MIGRATION_CAPABILITY_COMPRESS] || new_caps[MIGRATION_CAPABILITY_XBZRLE] || migrate_multifd_compression() || - migrate_use_tls())) { + migrate_tls())) { error_setg(errp, "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); return false; diff --git a/migration/options.h b/migration/options.h index 99f6bbd7a1..c91d5cbef0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -38,6 +38,15 @@ bool migrate_xbzrle(void); bool migrate_zero_blocks(void); bool migrate_zero_copy_send(void); =20 +/* + * pseudo capabilities + * + * This are functions that are used in a similar way that capabilities + * check, but they are not a capability. + */ + +bool migrate_tls(void); + /* capabilities helpers */ =20 bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); diff --git a/migration/tls.c b/migration/tls.c index 4d2166a209..acd38e0b62 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -22,6 +22,7 @@ #include "channel.h" #include "migration.h" #include "tls.h" +#include "options.h" #include "crypto/tlscreds.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -165,7 +166,7 @@ void migration_tls_channel_connect(MigrationState *s, =20 bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc) { - if (!migrate_use_tls()) { + if (!migrate_tls()) { return false; } =20 --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998434; cv=none; d=zohomail.com; s=zohoarc; b=ntExaZvNM5e0yM6FGcGDuh2Ht3n+RnQgeULexjErRmO3sIgRIXtFe5syh8omCLMfZmHw/FVPxU/bYHFq10lfPci2jLdlLxC890Cr+MASBLCBqV18U01Qr3fM03FNJy8h0q+I/DLVfTbS84bqPnplTE/TZXk3KajUCZleqIMNtY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998434; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SyL4vAcNv17VUf0wp7LdNqqpYGygmAQsbmUGwHW6U90=; b=QB9YINkYsZ9+VsMq5rq2wEWOdCa11q8mCxIJYY5vPFQCkU9wvD2R0H3CpbnzbcCm3rRRNVbaX9+mtK+IWbM5RiuRIiJAJgvac5dthk2dPqCYAi16F7513bWmnfzLzE9fql2V4By9yx6KN3K7XehXS5tICBqpzJ9WTBkV8mHZTm0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168199843468845.92713102724008; Thu, 20 Apr 2023 06:47:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUXl-0006La-Dc; Thu, 20 Apr 2023 09:41:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXY-0006AD-0m for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXV-00069q-M4 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:35 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-363-ZK9qHBXINoaFvKnsqZPo2Q-1; Thu, 20 Apr 2023 09:41:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0DCBE3C10252; Thu, 20 Apr 2023 13:41:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 780604020BED; Thu, 20 Apr 2023 13:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SyL4vAcNv17VUf0wp7LdNqqpYGygmAQsbmUGwHW6U90=; b=Xdh7fahLTuoH3YBAJcOWKghm+gsoSl5HDscUldlnGZ1pkIl2vXNIpb8BWSooOlZo4oZhii 99YSsJV8ARKn9rG8GVCeVQUKNaCtr/3Zl+/VgzFeit/COvJRNTceTV7K9SW1RZWQDkRk5h Uk0i0XgzJ+HM6w/4T5ZnyF8JZM8TzuE= X-MC-Unique: ZK9qHBXINoaFvKnsqZPo2Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 29/43] migration: Move migrate_postcopy() to options.c Date: Thu, 20 Apr 2023 15:39:48 +0200 Message-Id: <20230420134002.29531-30-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998435519100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 5 ----- migration/migration.h | 2 -- migration/options.c | 5 +++++ migration/options.h | 1 + 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index bbc9a07fd7..efb098c4e4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2246,11 +2246,6 @@ void qmp_migrate_continue(MigrationStatus state, Err= or **errp) qemu_sem_post(&s->pause_sem); } =20 -bool migrate_postcopy(void) -{ - return migrate_postcopy_ram() || migrate_dirty_bitmaps(); -} - /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/migration/migration.h b/migration/migration.h index 2099470e8e..2b71df8617 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -447,8 +447,6 @@ bool migration_is_blocked(Error **errp); bool migration_in_postcopy(void); MigrationState *migrate_get_current(void); =20 -bool migrate_postcopy(void); - uint64_t ram_get_total_transferred_pages(void); =20 /* Sending on the return path - generic and then for each message type */ diff --git a/migration/options.c b/migration/options.c index 6db221157f..360faf53ca 100644 --- a/migration/options.c +++ b/migration/options.c @@ -207,6 +207,11 @@ bool migrate_zero_copy_send(void) =20 /* pseudo capabilities */ =20 +bool migrate_postcopy(void) +{ + return migrate_postcopy_ram() || migrate_dirty_bitmaps(); +} + bool migrate_tls(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index c91d5cbef0..c1413c0e85 100644 --- a/migration/options.h +++ b/migration/options.h @@ -45,6 +45,7 @@ bool migrate_zero_copy_send(void); * check, but they are not a capability. */ =20 +bool migrate_postcopy(void); bool migrate_tls(void); =20 /* capabilities helpers */ --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998225; cv=none; d=zohomail.com; s=zohoarc; b=WTiRFi9+kyLweVZGaQi1bdrwm9bvRVRTyJY5ZlYSEnc6vZl0oNDevtQd8cuidyhheM60SEr9QB8eCC1N3U6XPQqjWBkQlR9ZNLjhcoJGVUr4Ea1jwD61Ru+iynRYURXewbDR+IhXFCXhhmVj4USC6EYC4ncjADKWv4fkijAKEcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998225; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JqTo9T60Fl3Am0B1FUKFeGUo4JJzZmYdLOt4yNT5HTU=; b=ALipmP3/PBLA1cxcKhbglUuOcZX2wte6s0rQqUjUPAsLB7QmBFarLWFgU2D29JNaeA0kmwW51vXbyUIKP1prQYEUYjEoE8VMBTG/+XQNQ0OeEqBHfKaLbH2Emv44gmlQjMzJ/kGDD8MiJRrF84WYGOuPcmyrrP5NZY6DZu/e0HQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998225829469.0980309712288; Thu, 20 Apr 2023 06:43:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUY6-0007PS-3L; Thu, 20 Apr 2023 09:42:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXd-0006KT-Q0 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXb-0006CU-E2 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:41 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-74-6qrGD3wuMky_NnhCyi47cg-1; Thu, 20 Apr 2023 09:41:35 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 061EE1C0514B; Thu, 20 Apr 2023 13:41:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 638954020BED; Thu, 20 Apr 2023 13:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JqTo9T60Fl3Am0B1FUKFeGUo4JJzZmYdLOt4yNT5HTU=; b=MALJTs9OmlMmKzkxU+Mf7G7ZB9WAoOM003wUiGc2bIqUKCbp3FKhFivvzgpLpS7g5EqyvR TLDaCQiFzKr5F4VgeeN3zQR4FdJPW2xZaUsyYnnpChiOFuRYkMbrV2JGRZAQDv+DMJzt1V hrUX2aI3ccgpTFLLMR8YQdHx8ySACQo= X-MC-Unique: 6qrGD3wuMky_NnhCyi47cg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 30/43] migration: Create migrate_max_bandwidth() function Date: Thu, 20 Apr 2023 15:39:49 +0200 Message-Id: <20230420134002.29531-31-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998226744100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/migration.c | 2 +- migration/options.c | 9 +++++++++ migration/options.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index efb098c4e4..2bbb4e888b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3767,7 +3767,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) XFER_LIMIT_RATIO; } else { /* This is a fresh new migration */ - rate_limit =3D s->parameters.max_bandwidth / XFER_LIMIT_RATIO; + rate_limit =3D migrate_max_bandwidth() / XFER_LIMIT_RATIO; =20 /* Notify before starting migration thread */ notifier_list_notify(&migration_state_notifiers, s); diff --git a/migration/options.c b/migration/options.c index 360faf53ca..0f4862b822 100644 --- a/migration/options.c +++ b/migration/options.c @@ -573,6 +573,15 @@ uint8_t migrate_max_cpu_throttle(void) return s->parameters.max_cpu_throttle; } =20 +uint64_t migrate_max_bandwidth(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->parameters.max_bandwidth; +} + int64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s; diff --git a/migration/options.h b/migration/options.h index c1413c0e85..41d7c75662 100644 --- a/migration/options.h +++ b/migration/options.h @@ -65,6 +65,7 @@ uint8_t migrate_cpu_throttle_initial(void); bool migrate_cpu_throttle_tailslow(void); int migrate_decompress_threads(void); uint8_t migrate_max_cpu_throttle(void); +uint64_t migrate_max_bandwidth(void); int64_t migrate_max_postcopy_bandwidth(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998197; cv=none; d=zohomail.com; s=zohoarc; b=YG9h2GFbMexw/bKkOh6rce6y09bR73pPmMoKhcA+Gj43vEsBZZ+MkTe6zDXCACJZfx0Y+jZbrtnhHZrUKvSM85AVcBQGfUzzUabffVOV4YNGwt8Wv8ZYIiYYMlU1hkViAigl4FWhOYR0nqnLZGXiF9tiEPKSAnyRPwbtbjEObPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998197; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+9iAd8VAUMpdk2NCuI6+HnJ0eKBd8J00rd2S2pxIVwg=; b=Hq6F/Pzxq5lwp4dvEj/wXdpGdF20/BgImlDXtovz7IhXp4SvsZPO6ezI+nbOW9W8DVP91uPsqaxWnnFGdDDion2XbbcA96mur9Ak1pncOq+iBp9vv3/1A8i/mSrg9NXfLi95WLz4ifusdnxxz50MT1a6FTbbIMg2E1An6QOGHqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16819981975153.2083551575717593; Thu, 20 Apr 2023 06:43:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYG-0007jU-Ir; Thu, 20 Apr 2023 09:42:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXo-0006X5-J0 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXe-0006DF-0s for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-HeEpigltO1uftHmXmjckrg-1; Thu, 20 Apr 2023 09:41:37 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC101858297; Thu, 20 Apr 2023 13:41:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E9DB4020BF1; Thu, 20 Apr 2023 13:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+9iAd8VAUMpdk2NCuI6+HnJ0eKBd8J00rd2S2pxIVwg=; b=WRddyYzDV0shPuIa7Y1MUK4b7kyt7i4J/fGsMxgd0D6gbkeMnmIdlDUD/iHlsF2POe27vI K0XThP7wqRo/KY6HmdEjLrKqZ8bkKmxnp3VSbhSyXYdDUN+fQUmuj71/gtswkUf2beAk/b svlmP75hU0/FoQ1/I8wSMmFc0N/O0Tc= X-MC-Unique: HeEpigltO1uftHmXmjckrg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 31/43] migration: Move qmp_query_migrate_parameters() to options.c Date: Thu, 20 Apr 2023 15:39:50 +0200 Message-Id: <20230420134002.29531-32-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998198498100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 68 ------------------------------------------- migration/options.c | 68 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2bbb4e888b..dee6d836bf 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -886,74 +886,6 @@ void migrate_send_rp_resume_ack(MigrationIncomingState= *mis, uint32_t value) migrate_send_rp_message(mis, MIG_RP_MSG_RESUME_ACK, sizeof(buf), &buf); } =20 -MigrationParameters *qmp_query_migrate_parameters(Error **errp) -{ - MigrationParameters *params; - MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - params =3D g_malloc0(sizeof(*params)); - params->has_compress_level =3D true; - params->compress_level =3D s->parameters.compress_level; - params->has_compress_threads =3D true; - params->compress_threads =3D s->parameters.compress_threads; - params->has_compress_wait_thread =3D true; - params->compress_wait_thread =3D s->parameters.compress_wait_thread; - params->has_decompress_threads =3D true; - params->decompress_threads =3D s->parameters.decompress_threads; - params->has_throttle_trigger_threshold =3D true; - params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; - params->has_cpu_throttle_initial =3D true; - params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; - params->has_cpu_throttle_increment =3D true; - params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; - params->has_cpu_throttle_tailslow =3D true; - params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; - params->tls_creds =3D g_strdup(s->parameters.tls_creds); - params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); - params->tls_authz =3D g_strdup(s->parameters.tls_authz ? - s->parameters.tls_authz : ""); - params->has_max_bandwidth =3D true; - params->max_bandwidth =3D s->parameters.max_bandwidth; - params->has_downtime_limit =3D true; - params->downtime_limit =3D s->parameters.downtime_limit; - params->has_x_checkpoint_delay =3D true; - params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; - params->has_block_incremental =3D true; - params->block_incremental =3D s->parameters.block_incremental; - params->has_multifd_channels =3D true; - params->multifd_channels =3D s->parameters.multifd_channels; - params->has_multifd_compression =3D true; - params->multifd_compression =3D s->parameters.multifd_compression; - params->has_multifd_zlib_level =3D true; - params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; - params->has_multifd_zstd_level =3D true; - params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; - params->has_xbzrle_cache_size =3D true; - params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; - params->has_max_postcopy_bandwidth =3D true; - params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; - params->has_max_cpu_throttle =3D true; - params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; - params->has_announce_initial =3D true; - params->announce_initial =3D s->parameters.announce_initial; - params->has_announce_max =3D true; - params->announce_max =3D s->parameters.announce_max; - params->has_announce_rounds =3D true; - params->announce_rounds =3D s->parameters.announce_rounds; - params->has_announce_step =3D true; - params->announce_step =3D s->parameters.announce_step; - - if (s->parameters.has_block_bitmap_mapping) { - params->has_block_bitmap_mapping =3D true; - params->block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - s->parameters.block_bitmap_mapping); - } - - return params; -} - /* * Return true if we're already in the middle of a migration * (i.e. any of the active or setup states) diff --git a/migration/options.c b/migration/options.c index 0f4862b822..ccbfb9bd90 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,8 +12,10 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/clone-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" +#include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" #include "sysemu/runstate.h" #include "migration/misc.h" @@ -662,4 +664,70 @@ AnnounceParameters *migrate_announce_params(void) return ≈ } =20 +MigrationParameters *qmp_query_migrate_parameters(Error **errp) +{ + MigrationParameters *params; + MigrationState *s =3D migrate_get_current(); =20 + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + params =3D g_malloc0(sizeof(*params)); + params->has_compress_level =3D true; + params->compress_level =3D s->parameters.compress_level; + params->has_compress_threads =3D true; + params->compress_threads =3D s->parameters.compress_threads; + params->has_compress_wait_thread =3D true; + params->compress_wait_thread =3D s->parameters.compress_wait_thread; + params->has_decompress_threads =3D true; + params->decompress_threads =3D s->parameters.decompress_threads; + params->has_throttle_trigger_threshold =3D true; + params->throttle_trigger_threshold =3D s->parameters.throttle_trigger_= threshold; + params->has_cpu_throttle_initial =3D true; + params->cpu_throttle_initial =3D s->parameters.cpu_throttle_initial; + params->has_cpu_throttle_increment =3D true; + params->cpu_throttle_increment =3D s->parameters.cpu_throttle_incremen= t; + params->has_cpu_throttle_tailslow =3D true; + params->cpu_throttle_tailslow =3D s->parameters.cpu_throttle_tailslow; + params->tls_creds =3D g_strdup(s->parameters.tls_creds); + params->tls_hostname =3D g_strdup(s->parameters.tls_hostname); + params->tls_authz =3D g_strdup(s->parameters.tls_authz ? + s->parameters.tls_authz : ""); + params->has_max_bandwidth =3D true; + params->max_bandwidth =3D s->parameters.max_bandwidth; + params->has_downtime_limit =3D true; + params->downtime_limit =3D s->parameters.downtime_limit; + params->has_x_checkpoint_delay =3D true; + params->x_checkpoint_delay =3D s->parameters.x_checkpoint_delay; + params->has_block_incremental =3D true; + params->block_incremental =3D s->parameters.block_incremental; + params->has_multifd_channels =3D true; + params->multifd_channels =3D s->parameters.multifd_channels; + params->has_multifd_compression =3D true; + params->multifd_compression =3D s->parameters.multifd_compression; + params->has_multifd_zlib_level =3D true; + params->multifd_zlib_level =3D s->parameters.multifd_zlib_level; + params->has_multifd_zstd_level =3D true; + params->multifd_zstd_level =3D s->parameters.multifd_zstd_level; + params->has_xbzrle_cache_size =3D true; + params->xbzrle_cache_size =3D s->parameters.xbzrle_cache_size; + params->has_max_postcopy_bandwidth =3D true; + params->max_postcopy_bandwidth =3D s->parameters.max_postcopy_bandwidt= h; + params->has_max_cpu_throttle =3D true; + params->max_cpu_throttle =3D s->parameters.max_cpu_throttle; + params->has_announce_initial =3D true; + params->announce_initial =3D s->parameters.announce_initial; + params->has_announce_max =3D true; + params->announce_max =3D s->parameters.announce_max; + params->has_announce_rounds =3D true; + params->announce_rounds =3D s->parameters.announce_rounds; + params->has_announce_step =3D true; + params->announce_step =3D s->parameters.announce_step; + + if (s->parameters.has_block_bitmap_mapping) { + params->has_block_bitmap_mapping =3D true; + params->block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + s->parameters.block_bitmap_mapping); + } + + return params; +} --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998448; cv=none; d=zohomail.com; s=zohoarc; b=RV+Q8O+8V6zv8WyDYmE8+N6aSJ4CjBKYaNPpV9X9EH7q9yIpqMVPrsarUnW2f2qA43rovvYPDKQxeDN5zz0ufHHwUkAOgu4Mk0XMGTY1/msO+XBnXeHUk/nwjDNdaIDjTkim4F2e9RT/P032m1m5R6qVYABjTKuKHOA+eXq0vgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998448; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GCCQhxxJzS/fnv4ikL+XnKYyDUWHycPFzx0n2UTYanY=; b=Z/Y0ZOxkD+Y5NOELJHzoI0uo8w/VccprH46EDRxULWGNwc24xf7Vkv6FTgXscplQokPzGFTtDfLej8MLdnmO5/ZuSgN/wkoxIr5Bcnra+4QlpG8st/ErQXCBo7nsLGbfi0gF5CzbH3H6iBRc9yNUWM2HyWkCW3ldYAij4MKkRq4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998448351499.41885597666374; Thu, 20 Apr 2023 06:47:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYj-0008WR-6S; Thu, 20 Apr 2023 09:42:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXp-0006Yl-BV for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXl-0006EV-CK for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-1TkJV-6AM4-ay_rjqUBU8w-1; Thu, 20 Apr 2023 09:41:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF16D811E7D; Thu, 20 Apr 2023 13:41:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 419D94020BF2; Thu, 20 Apr 2023 13:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GCCQhxxJzS/fnv4ikL+XnKYyDUWHycPFzx0n2UTYanY=; b=XNaJDD7Ds23QQ0esxio8G0e/kYFniGOp+luSdDy6qmqVkuANZfutxUkL3IJgmKBbB2c6Ir xxsuJN4SMSSe948LkZaxjNiIu4ZTq0f+1WgoQH5e4ZKpxCXt0w0O2Pv7kBqG6npzYuPICn NB3b1rR4MJD67DsJwg8XZgnwYIpKYME= X-MC-Unique: 1TkJV-6AM4-ay_rjqUBU8w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 32/43] migration: Move qmp_migrate_set_parameters() to options.c Date: Thu, 20 Apr 2023 15:39:51 +0200 Message-Id: <20230420134002.29531-33-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998450278100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 420 ------------------------------------------ migration/options.c | 418 +++++++++++++++++++++++++++++++++++++++++ migration/options.h | 11 ++ 3 files changed, 429 insertions(+), 420 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index dee6d836bf..5599b8ac5b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -67,19 +67,10 @@ =20 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ =20 -/* Amount of time to allocate to each "chunk" of bandwidth-throttled - * data. */ -#define BUFFER_DELAY 100 -#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) - /* Time in milliseconds we are allowed to stop the source, * for sending the last part */ #define DEFAULT_MIGRATE_SET_DOWNTIME 300 =20 -/* Maximum migrate downtime set to 2000 seconds */ -#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 -#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) - /* Default compression thread count */ #define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 /* Default decompression thread count, usually decompression is at @@ -1141,417 +1132,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -/* - * Check whether the parameters are valid. Error will be put into errp - * (if provided). Return true if valid, otherwise false. - */ -static bool migrate_params_check(MigrationParameters *params, Error **errp) -{ - if (params->has_compress_level && - (params->compress_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", - "a value between 0 and 9"); - return false; - } - - if (params->has_compress_threads && (params->compress_threads < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "compress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "decompress_threads", - "a value between 1 and 255"); - return false; - } - - if (params->has_throttle_trigger_threshold && - (params->throttle_trigger_threshold < 1 || - params->throttle_trigger_threshold > 100)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "throttle_trigger_threshold", - "an integer in the range of 1 to 100"); - return false; - } - - if (params->has_cpu_throttle_initial && - (params->cpu_throttle_initial < 1 || - params->cpu_throttle_initial > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_initial", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_cpu_throttle_increment && - (params->cpu_throttle_increment < 1 || - params->cpu_throttle_increment > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "cpu_throttle_increment", - "an integer in the range of 1 to 99"); - return false; - } - - if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_bandwidth", - "an integer in the range of 0 to "stringify(SIZE_MAX) - " bytes/second"); - return false; - } - - if (params->has_downtime_limit && - (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "downtime_limit", - "an integer in the range of 0 to " - stringify(MAX_MIGRATE_DOWNTIME)" ms"); - return false; - } - - /* x_checkpoint_delay is now always positive */ - - if (params->has_multifd_channels && (params->multifd_channels < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "multifd_channels", - "a value between 1 and 255"); - return false; - } - - if (params->has_multifd_zlib_level && - (params->multifd_zlib_level > 9)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", - "a value between 0 and 9"); - return false; - } - - if (params->has_multifd_zstd_level && - (params->multifd_zstd_level > 20)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", - "a value between 0 and 20"); - return false; - } - - if (params->has_xbzrle_cache_size && - (params->xbzrle_cache_size < qemu_target_page_size() || - !is_power_of_2(params->xbzrle_cache_size))) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "xbzrle_cache_size", - "a power of two no less than the target page size"); - return false; - } - - if (params->has_max_cpu_throttle && - (params->max_cpu_throttle < params->cpu_throttle_initial || - params->max_cpu_throttle > 99)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "max_cpu_throttle", - "an integer in the range of cpu_throttle_initial to 99"= ); - return false; - } - - if (params->has_announce_initial && - params->announce_initial > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_initial", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_max && - params->announce_max > 100000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_max", - "a value between 0 and 100000"); - return false; - } - if (params->has_announce_rounds && - params->announce_rounds > 1000) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_rounds", - "a value between 0 and 1000"); - return false; - } - if (params->has_announce_step && - (params->announce_step < 1 || - params->announce_step > 10000)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "announce_step", - "a value between 0 and 10000"); - return false; - } - - if (params->has_block_bitmap_mapping && - !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { - error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); - return false; - } - -#ifdef CONFIG_LINUX - if (migrate_zero_copy_send() && - ((params->has_multifd_compression && params->multifd_compression) = || - (params->tls_creds && *params->tls_creds))) { - error_setg(errp, - "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); - return false; - } -#endif - - return true; -} - -static void migrate_params_test_apply(MigrateSetParameters *params, - MigrationParameters *dest) -{ - *dest =3D migrate_get_current()->parameters; - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - dest->compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - dest->compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - dest->compress_wait_thread =3D params->compress_wait_thread; - } - - if (params->has_decompress_threads) { - dest->decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; - } - - if (params->has_cpu_throttle_initial) { - dest->cpu_throttle_initial =3D params->cpu_throttle_initial; - } - - if (params->has_cpu_throttle_increment) { - dest->cpu_throttle_increment =3D params->cpu_throttle_increment; - } - - if (params->has_cpu_throttle_tailslow) { - dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; - } - - if (params->tls_creds) { - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D params->tls_creds->u.s; - } - - if (params->tls_hostname) { - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D params->tls_hostname->u.s; - } - - if (params->has_max_bandwidth) { - dest->max_bandwidth =3D params->max_bandwidth; - } - - if (params->has_downtime_limit) { - dest->downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - dest->x_checkpoint_delay =3D params->x_checkpoint_delay; - } - - if (params->has_block_incremental) { - dest->block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - dest->multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - dest->multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - dest->xbzrle_cache_size =3D params->xbzrle_cache_size; - } - if (params->has_max_postcopy_bandwidth) { - dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; - } - if (params->has_max_cpu_throttle) { - dest->max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - dest->announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - dest->announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - dest->announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - dest->announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - dest->has_block_bitmap_mapping =3D true; - dest->block_bitmap_mapping =3D params->block_bitmap_mapping; - } -} - -static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) -{ - MigrationState *s =3D migrate_get_current(); - - /* TODO use QAPI_CLONE() instead of duplicating it inline */ - - if (params->has_compress_level) { - s->parameters.compress_level =3D params->compress_level; - } - - if (params->has_compress_threads) { - s->parameters.compress_threads =3D params->compress_threads; - } - - if (params->has_compress_wait_thread) { - s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; - } - - if (params->has_decompress_threads) { - s->parameters.decompress_threads =3D params->decompress_threads; - } - - if (params->has_throttle_trigger_threshold) { - s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; - } - - if (params->has_cpu_throttle_initial) { - s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; - } - - if (params->has_cpu_throttle_increment) { - s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; - } - - if (params->has_cpu_throttle_tailslow) { - s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; - } - - if (params->tls_creds) { - g_free(s->parameters.tls_creds); - assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); - } - - if (params->tls_hostname) { - g_free(s->parameters.tls_hostname); - assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); - } - - if (params->tls_authz) { - g_free(s->parameters.tls_authz); - assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); - s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); - } - - if (params->has_max_bandwidth) { - s->parameters.max_bandwidth =3D params->max_bandwidth; - if (s->to_dst_file && !migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); - } - } - - if (params->has_downtime_limit) { - s->parameters.downtime_limit =3D params->downtime_limit; - } - - if (params->has_x_checkpoint_delay) { - s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - if (migration_in_colo_state()) { - colo_checkpoint_notify(s); - } - } - - if (params->has_block_incremental) { - s->parameters.block_incremental =3D params->block_incremental; - } - if (params->has_multifd_channels) { - s->parameters.multifd_channels =3D params->multifd_channels; - } - if (params->has_multifd_compression) { - s->parameters.multifd_compression =3D params->multifd_compression; - } - if (params->has_xbzrle_cache_size) { - s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; - xbzrle_cache_resize(params->xbzrle_cache_size, errp); - } - if (params->has_max_postcopy_bandwidth) { - s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; - if (s->to_dst_file && migration_in_postcopy()) { - qemu_file_set_rate_limit(s->to_dst_file, - s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); - } - } - if (params->has_max_cpu_throttle) { - s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; - } - if (params->has_announce_initial) { - s->parameters.announce_initial =3D params->announce_initial; - } - if (params->has_announce_max) { - s->parameters.announce_max =3D params->announce_max; - } - if (params->has_announce_rounds) { - s->parameters.announce_rounds =3D params->announce_rounds; - } - if (params->has_announce_step) { - s->parameters.announce_step =3D params->announce_step; - } - - if (params->has_block_bitmap_mapping) { - qapi_free_BitmapMigrationNodeAliasList( - s->parameters.block_bitmap_mapping); - - s->parameters.has_block_bitmap_mapping =3D true; - s->parameters.block_bitmap_mapping =3D - QAPI_CLONE(BitmapMigrationNodeAliasList, - params->block_bitmap_mapping); - } -} - -void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) -{ - MigrationParameters tmp; - - /* TODO Rewrite "" to null instead */ - if (params->tls_creds - && params->tls_creds->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_creds->u.n); - params->tls_creds->type =3D QTYPE_QSTRING; - params->tls_creds->u.s =3D strdup(""); - } - /* TODO Rewrite "" to null instead */ - if (params->tls_hostname - && params->tls_hostname->type =3D=3D QTYPE_QNULL) { - qobject_unref(params->tls_hostname->u.n); - params->tls_hostname->type =3D QTYPE_QSTRING; - params->tls_hostname->u.s =3D strdup(""); - } - - migrate_params_test_apply(params, &tmp); - - if (!migrate_params_check(&tmp, errp)) { - /* Invalid parameter */ - return; - } - - migrate_params_apply(params, errp); -} - - void qmp_migrate_start_postcopy(Error **errp) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.c b/migration/options.c index ccbfb9bd90..255a5433b4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -12,17 +12,25 @@ */ =20 #include "qemu/osdep.h" +#include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" #include "qapi/qapi-visit-migration.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qnull.h" #include "sysemu/runstate.h" +#include "migration/colo.h" #include "migration/misc.h" #include "migration.h" +#include "qemu-file.h" #include "ram.h" #include "options.h" =20 +/* Maximum migrate downtime set to 2000 seconds */ +#define MAX_MIGRATE_DOWNTIME_SECONDS 2000 +#define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) + bool migrate_auto_converge(void) { MigrationState *s; @@ -731,3 +739,413 @@ MigrationParameters *qmp_query_migrate_parameters(Err= or **errp) =20 return params; } + +/* + * Check whether the parameters are valid. Error will be put into errp + * (if provided). Return true if valid, otherwise false. + */ +bool migrate_params_check(MigrationParameters *params, Error **errp) +{ + if (params->has_compress_level && + (params->compress_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", + "a value between 0 and 9"); + return false; + } + + if (params->has_compress_threads && (params->compress_threads < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "compress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_decompress_threads && (params->decompress_threads < 1)= ) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "decompress_threads", + "a value between 1 and 255"); + return false; + } + + if (params->has_throttle_trigger_threshold && + (params->throttle_trigger_threshold < 1 || + params->throttle_trigger_threshold > 100)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "throttle_trigger_threshold", + "an integer in the range of 1 to 100"); + return false; + } + + if (params->has_cpu_throttle_initial && + (params->cpu_throttle_initial < 1 || + params->cpu_throttle_initial > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_initial", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_cpu_throttle_increment && + (params->cpu_throttle_increment < 1 || + params->cpu_throttle_increment > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "cpu_throttle_increment", + "an integer in the range of 1 to 99"); + return false; + } + + if (params->has_max_bandwidth && (params->max_bandwidth > SIZE_MAX)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_bandwidth", + "an integer in the range of 0 to "stringify(SIZE_MAX) + " bytes/second"); + return false; + } + + if (params->has_downtime_limit && + (params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "downtime_limit", + "an integer in the range of 0 to " + stringify(MAX_MIGRATE_DOWNTIME)" ms"); + return false; + } + + /* x_checkpoint_delay is now always positive */ + + if (params->has_multifd_channels && (params->multifd_channels < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "multifd_channels", + "a value between 1 and 255"); + return false; + } + + if (params->has_multifd_zlib_level && + (params->multifd_zlib_level > 9)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zlib_level= ", + "a value between 0 and 9"); + return false; + } + + if (params->has_multifd_zstd_level && + (params->multifd_zstd_level > 20)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_zstd_level= ", + "a value between 0 and 20"); + return false; + } + + if (params->has_xbzrle_cache_size && + (params->xbzrle_cache_size < qemu_target_page_size() || + !is_power_of_2(params->xbzrle_cache_size))) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "xbzrle_cache_size", + "a power of two no less than the target page size"); + return false; + } + + if (params->has_max_cpu_throttle && + (params->max_cpu_throttle < params->cpu_throttle_initial || + params->max_cpu_throttle > 99)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "max_cpu_throttle", + "an integer in the range of cpu_throttle_initial to 99"= ); + return false; + } + + if (params->has_announce_initial && + params->announce_initial > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_initial", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_max && + params->announce_max > 100000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_max", + "a value between 0 and 100000"); + return false; + } + if (params->has_announce_rounds && + params->announce_rounds > 1000) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_rounds", + "a value between 0 and 1000"); + return false; + } + if (params->has_announce_step && + (params->announce_step < 1 || + params->announce_step > 10000)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "announce_step", + "a value between 0 and 10000"); + return false; + } + + if (params->has_block_bitmap_mapping && + !check_dirty_bitmap_mig_alias_map(params->block_bitmap_mapping, er= rp)) { + error_prepend(errp, "Invalid mapping given for block-bitmap-mappin= g: "); + return false; + } + +#ifdef CONFIG_LINUX + if (migrate_zero_copy_send() && + ((params->has_multifd_compression && params->multifd_compression) = || + (params->tls_creds && *params->tls_creds))) { + error_setg(errp, + "Zero copy only available for non-compressed non-TLS mu= ltifd migration"); + return false; + } +#endif + + return true; +} + +static void migrate_params_test_apply(MigrateSetParameters *params, + MigrationParameters *dest) +{ + *dest =3D migrate_get_current()->parameters; + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + dest->compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + dest->compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + dest->compress_wait_thread =3D params->compress_wait_thread; + } + + if (params->has_decompress_threads) { + dest->decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + dest->throttle_trigger_threshold =3D params->throttle_trigger_thre= shold; + } + + if (params->has_cpu_throttle_initial) { + dest->cpu_throttle_initial =3D params->cpu_throttle_initial; + } + + if (params->has_cpu_throttle_increment) { + dest->cpu_throttle_increment =3D params->cpu_throttle_increment; + } + + if (params->has_cpu_throttle_tailslow) { + dest->cpu_throttle_tailslow =3D params->cpu_throttle_tailslow; + } + + if (params->tls_creds) { + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + dest->tls_creds =3D params->tls_creds->u.s; + } + + if (params->tls_hostname) { + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + dest->tls_hostname =3D params->tls_hostname->u.s; + } + + if (params->has_max_bandwidth) { + dest->max_bandwidth =3D params->max_bandwidth; + } + + if (params->has_downtime_limit) { + dest->downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + dest->x_checkpoint_delay =3D params->x_checkpoint_delay; + } + + if (params->has_block_incremental) { + dest->block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + dest->multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + dest->multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + dest->xbzrle_cache_size =3D params->xbzrle_cache_size; + } + if (params->has_max_postcopy_bandwidth) { + dest->max_postcopy_bandwidth =3D params->max_postcopy_bandwidth; + } + if (params->has_max_cpu_throttle) { + dest->max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + dest->announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + dest->announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + dest->announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + dest->announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + dest->has_block_bitmap_mapping =3D true; + dest->block_bitmap_mapping =3D params->block_bitmap_mapping; + } +} + +static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) +{ + MigrationState *s =3D migrate_get_current(); + + /* TODO use QAPI_CLONE() instead of duplicating it inline */ + + if (params->has_compress_level) { + s->parameters.compress_level =3D params->compress_level; + } + + if (params->has_compress_threads) { + s->parameters.compress_threads =3D params->compress_threads; + } + + if (params->has_compress_wait_thread) { + s->parameters.compress_wait_thread =3D params->compress_wait_threa= d; + } + + if (params->has_decompress_threads) { + s->parameters.decompress_threads =3D params->decompress_threads; + } + + if (params->has_throttle_trigger_threshold) { + s->parameters.throttle_trigger_threshold =3D params->throttle_trig= ger_threshold; + } + + if (params->has_cpu_throttle_initial) { + s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; + } + + if (params->has_cpu_throttle_increment) { + s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; + } + + if (params->has_cpu_throttle_tailslow) { + s->parameters.cpu_throttle_tailslow =3D params->cpu_throttle_tails= low; + } + + if (params->tls_creds) { + g_free(s->parameters.tls_creds); + assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_creds =3D g_strdup(params->tls_creds->u.s); + } + + if (params->tls_hostname) { + g_free(s->parameters.tls_hostname); + assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_hostname =3D g_strdup(params->tls_hostname->u.s); + } + + if (params->tls_authz) { + g_free(s->parameters.tls_authz); + assert(params->tls_authz->type =3D=3D QTYPE_QSTRING); + s->parameters.tls_authz =3D g_strdup(params->tls_authz->u.s); + } + + if (params->has_max_bandwidth) { + s->parameters.max_bandwidth =3D params->max_bandwidth; + if (s->to_dst_file && !migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); + } + } + + if (params->has_downtime_limit) { + s->parameters.downtime_limit =3D params->downtime_limit; + } + + if (params->has_x_checkpoint_delay) { + s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; + if (migration_in_colo_state()) { + colo_checkpoint_notify(s); + } + } + + if (params->has_block_incremental) { + s->parameters.block_incremental =3D params->block_incremental; + } + if (params->has_multifd_channels) { + s->parameters.multifd_channels =3D params->multifd_channels; + } + if (params->has_multifd_compression) { + s->parameters.multifd_compression =3D params->multifd_compression; + } + if (params->has_xbzrle_cache_size) { + s->parameters.xbzrle_cache_size =3D params->xbzrle_cache_size; + xbzrle_cache_resize(params->xbzrle_cache_size, errp); + } + if (params->has_max_postcopy_bandwidth) { + s->parameters.max_postcopy_bandwidth =3D params->max_postcopy_band= width; + if (s->to_dst_file && migration_in_postcopy()) { + qemu_file_set_rate_limit(s->to_dst_file, + s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATI= O); + } + } + if (params->has_max_cpu_throttle) { + s->parameters.max_cpu_throttle =3D params->max_cpu_throttle; + } + if (params->has_announce_initial) { + s->parameters.announce_initial =3D params->announce_initial; + } + if (params->has_announce_max) { + s->parameters.announce_max =3D params->announce_max; + } + if (params->has_announce_rounds) { + s->parameters.announce_rounds =3D params->announce_rounds; + } + if (params->has_announce_step) { + s->parameters.announce_step =3D params->announce_step; + } + + if (params->has_block_bitmap_mapping) { + qapi_free_BitmapMigrationNodeAliasList( + s->parameters.block_bitmap_mapping); + + s->parameters.has_block_bitmap_mapping =3D true; + s->parameters.block_bitmap_mapping =3D + QAPI_CLONE(BitmapMigrationNodeAliasList, + params->block_bitmap_mapping); + } +} + +void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) +{ + MigrationParameters tmp; + + /* TODO Rewrite "" to null instead */ + if (params->tls_creds + && params->tls_creds->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_creds->u.n); + params->tls_creds->type =3D QTYPE_QSTRING; + params->tls_creds->u.s =3D strdup(""); + } + /* TODO Rewrite "" to null instead */ + if (params->tls_hostname + && params->tls_hostname->type =3D=3D QTYPE_QNULL) { + qobject_unref(params->tls_hostname->u.n); + params->tls_hostname->type =3D QTYPE_QSTRING; + params->tls_hostname->u.s =3D strdup(""); + } + + migrate_params_test_apply(params, &tmp); + + if (!migrate_params_check(&tmp, errp)) { + /* Invalid parameter */ + return; + } + + migrate_params_apply(params, errp); +} diff --git a/migration/options.h b/migration/options.h index 41d7c75662..86b0d7fd88 100644 --- a/migration/options.h +++ b/migration/options.h @@ -14,6 +14,13 @@ #ifndef QEMU_MIGRATION_OPTIONS_H #define QEMU_MIGRATION_OPTIONS_H =20 +/* constants */ + +/* Amount of time to allocate to each "chunk" of bandwidth-throttled + * data. */ +#define BUFFER_DELAY 100 +#define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) + /* capabilities */ =20 bool migrate_auto_converge(void); @@ -74,4 +81,8 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 +/* parameters helpers */ + +bool migrate_params_check(MigrationParameters *params, Error **errp); + #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998158; cv=none; d=zohomail.com; s=zohoarc; b=fD3+bCIrZvS7gw4neDSEilsQ2mznMPJErVvndz8KF9e4M3SKjtn+FIQO7oHMOcucRezf+xY38cN8GI1YlZIzIqsgGu9ulf7Or4p/tp4pQ34K3TzLXSUVurf8HxFSugjM/M9Xs3L42ku8AB7lq1KmyhEDyV6cyvbH1ayCx4yU144= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998158; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mIV/Fz7XAAN3WcFFaclllRh+5gvZPqKD/SmMIjOQLJQ=; b=KtFABt9Me1T2hxs3KAJSEfN15XIlcN1zs2dFdiOJdJTO9f/DfMW0Z4JEEjlZnfDel3RMO/DdJOwTPJ0LjZXdRyScHs24dvFX80nr39c1He64uLyBnO2ZigDLmIPpvcIT0zwJAV5UJn3ztw1e9F5vkS7erx7Vcc4sxSvE0RVAzvE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998157979314.31135728082677; Thu, 20 Apr 2023 06:42:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYR-00085n-Ar; Thu, 20 Apr 2023 09:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXs-0006jA-PR for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXl-0006Ew-Iz for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-577-7naC4zd3Ne22VdmDCte6cA-1; Thu, 20 Apr 2023 09:41:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA40D3C10253; Thu, 20 Apr 2023 13:41:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43C7D4020BF1; Thu, 20 Apr 2023 13:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mIV/Fz7XAAN3WcFFaclllRh+5gvZPqKD/SmMIjOQLJQ=; b=UqbCZuaHU19W1+B+yK/qXOZ1UILjh6Zmq0U1/36p5nXoaOz7D8g9H+HPBgEa63OZYit8ee wu68SUMLzjWe46bJegLT7uBE/IIPw/MaUtfmHBRtU/M/RnN3IFgf42scloHQBcoEuQ+TFU VL1Gna2acNIgMrZABJJTeiEKhb1/mT0= X-MC-Unique: 7naC4zd3Ne22VdmDCte6cA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 33/43] migration: Create migrate_params_init() function Date: Thu, 20 Apr 2023 15:39:52 +0200 Message-Id: <20230420134002.29531-34-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998158412100006 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 29 +---------------------------- migration/options.c | 31 +++++++++++++++++++++++++++++++ migration/options.h | 1 + 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5599b8ac5b..b87aebee9b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3475,7 +3475,6 @@ static void migration_instance_finalize(Object *obj) static void migration_instance_init(Object *obj) { MigrationState *ms =3D MIGRATION_OBJ(obj); - MigrationParameters *params =3D &ms->parameters; =20 ms->state =3D MIGRATION_STATUS_NONE; ms->mbps =3D -1; @@ -3483,33 +3482,7 @@ static void migration_instance_init(Object *obj) qemu_sem_init(&ms->pause_sem, 0); qemu_mutex_init(&ms->error_mutex); =20 - params->tls_hostname =3D g_strdup(""); - params->tls_creds =3D g_strdup(""); - - /* Set has_* up only for parameter checks */ - params->has_compress_level =3D true; - params->has_compress_threads =3D true; - params->has_compress_wait_thread =3D true; - params->has_decompress_threads =3D true; - params->has_throttle_trigger_threshold =3D true; - params->has_cpu_throttle_initial =3D true; - params->has_cpu_throttle_increment =3D true; - params->has_cpu_throttle_tailslow =3D true; - params->has_max_bandwidth =3D true; - params->has_downtime_limit =3D true; - params->has_x_checkpoint_delay =3D true; - params->has_block_incremental =3D true; - params->has_multifd_channels =3D true; - params->has_multifd_compression =3D true; - params->has_multifd_zlib_level =3D true; - params->has_multifd_zstd_level =3D true; - params->has_xbzrle_cache_size =3D true; - params->has_max_postcopy_bandwidth =3D true; - params->has_max_cpu_throttle =3D true; - params->has_announce_initial =3D true; - params->has_announce_max =3D true; - params->has_announce_rounds =3D true; - params->has_announce_step =3D true; + migrate_params_init(&ms->parameters); =20 qemu_sem_init(&ms->postcopy_pause_sem, 0); qemu_sem_init(&ms->postcopy_pause_rp_sem, 0); diff --git a/migration/options.c b/migration/options.c index 255a5433b4..6fa6666308 100644 --- a/migration/options.c +++ b/migration/options.c @@ -740,6 +740,37 @@ MigrationParameters *qmp_query_migrate_parameters(Erro= r **errp) return params; } =20 +void migrate_params_init(MigrationParameters *params) +{ + params->tls_hostname =3D g_strdup(""); + params->tls_creds =3D g_strdup(""); + + /* Set has_* up only for parameter checks */ + params->has_compress_level =3D true; + params->has_compress_threads =3D true; + params->has_compress_wait_thread =3D true; + params->has_decompress_threads =3D true; + params->has_throttle_trigger_threshold =3D true; + params->has_cpu_throttle_initial =3D true; + params->has_cpu_throttle_increment =3D true; + params->has_cpu_throttle_tailslow =3D true; + params->has_max_bandwidth =3D true; + params->has_downtime_limit =3D true; + params->has_x_checkpoint_delay =3D true; + params->has_block_incremental =3D true; + params->has_multifd_channels =3D true; + params->has_multifd_compression =3D true; + params->has_multifd_zlib_level =3D true; + params->has_multifd_zstd_level =3D true; + params->has_xbzrle_cache_size =3D true; + params->has_max_postcopy_bandwidth =3D true; + params->has_max_cpu_throttle =3D true; + params->has_announce_initial =3D true; + params->has_announce_max =3D true; + params->has_announce_rounds =3D true; + params->has_announce_step =3D true; +} + /* * Check whether the parameters are valid. Error will be put into errp * (if provided). Return true if valid, otherwise false. diff --git a/migration/options.h b/migration/options.h index 86b0d7fd88..9f50348d3c 100644 --- a/migration/options.h +++ b/migration/options.h @@ -84,5 +84,6 @@ uint64_t migrate_xbzrle_cache_size(void); /* parameters helpers */ =20 bool migrate_params_check(MigrationParameters *params, Error **errp); +void migrate_params_init(MigrationParameters *params); =20 #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998210; cv=none; d=zohomail.com; s=zohoarc; b=OspcQSXjciDTpEyp3ZhoiK9BHzbkUi1nxKPqEtVSDCjQChP15xEVSidy+SSIXdpvBLL1EQHbf7FJe+/nml4WcP8eQq9EbPdsrEIi3fHe1JeK5tctoccDcLcw8lIbfQby333VyHHh+cJB815BJK9CHz6A0mxcTPbxGHO9OBCgluQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998210; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4eV7+EHuN4H42iHZQoDrrTjwfNGiE2P0rRmQKUOSs6M=; b=NueX1wuS3jnwX7ZPTRKtiHlEzj2Av0YeleKprzs8P8LNncpFqKB+xkXB0WauLNhm4eLzBbxFz7utqWlDsCGRvD3RXHokY8YZPW5tdfuf1WAybfO5bZnuW4aHt8+cQw/EedmfRtM/BStjoogf44JSmKTUogJh4u+9iIDuTDnsJ0A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998210237889.0126926035678; Thu, 20 Apr 2023 06:43:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYo-0000UY-KZ; Thu, 20 Apr 2023 09:42:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXr-0006eN-F5 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXo-0006FX-DP for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-VJF-CJ5tOfWEKyAH1nFaVw-1; Thu, 20 Apr 2023 09:41:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA4A9886C61; Thu, 20 Apr 2023 13:41:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A54A4020BED; Thu, 20 Apr 2023 13:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4eV7+EHuN4H42iHZQoDrrTjwfNGiE2P0rRmQKUOSs6M=; b=U2uyIIoKc4uw8BuNvtfy40NtFMtGAk0zym7tj4AjYURnEtmSGF+N3uWgzQ9pXEROQYcfG8 /1LSknPxnHTyc16SGmzUV5zJeqaWaIK/AdWnCBTa2Bn2KxcsbJvQHxZqBhX8p1edM93Pgq jpgEFIDqKxt/sanPPol/nInlaIlFpjY= X-MC-Unique: VJF-CJ5tOfWEKyAH1nFaVw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 34/43] migration: Make all functions check have the same format Date: Thu, 20 Apr 2023 15:39:53 +0200 Message-Id: <20230420134002.29531-35-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998212272100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 153 +++++++++++--------------------------------- 1 file changed, 39 insertions(+), 114 deletions(-) diff --git a/migration/options.c b/migration/options.c index 6fa6666308..fa99e397d0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -33,27 +33,21 @@ =20 bool migrate_auto_converge(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; } =20 bool migrate_background_snapshot(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 bool migrate_block(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; } @@ -61,95 +55,76 @@ bool migrate_block(void) bool migrate_colo(void) { MigrationState *s =3D migrate_get_current(); + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 bool migrate_compress(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; } =20 bool migrate_dirty_bitmaps(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 bool migrate_events(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; } =20 bool migrate_ignore_shared(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; } =20 bool migrate_late_block_activate(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 bool migrate_multifd(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 bool migrate_pause_before_switchover(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; } =20 bool migrate_postcopy_blocktime(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; } =20 bool migrate_postcopy_preempt(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; } =20 bool migrate_postcopy_ram(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } @@ -163,54 +138,42 @@ bool migrate_rdma_pin_all(void) =20 bool migrate_release_ram(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 bool migrate_return_path(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; } =20 bool migrate_validate_uuid(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 bool migrate_xbzrle(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } =20 bool migrate_zero_blocks(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 bool migrate_zero_copy_send(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } @@ -224,9 +187,7 @@ bool migrate_postcopy(void) =20 bool migrate_tls(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.tls_creds && *s->parameters.tls_creds; } @@ -495,126 +456,98 @@ void qmp_migrate_set_capabilities(MigrationCapabilit= yStatusList *params, =20 bool migrate_block_incremental(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.block_incremental; } =20 uint32_t migrate_checkpoint_delay(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.x_checkpoint_delay; } =20 int migrate_compress_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_level; } =20 int migrate_compress_threads(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_threads; } =20 int migrate_compress_wait_thread(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.compress_wait_thread; } =20 uint8_t migrate_cpu_throttle_increment(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_increment; } =20 uint8_t migrate_cpu_throttle_initial(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_initial; } =20 bool migrate_cpu_throttle_tailslow(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.cpu_throttle_tailslow; } =20 int migrate_decompress_threads(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.decompress_threads; } =20 uint8_t migrate_max_cpu_throttle(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_cpu_throttle; } =20 uint64_t migrate_max_bandwidth(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_bandwidth; } =20 int64_t migrate_max_postcopy_bandwidth(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.max_postcopy_bandwidth; } =20 int migrate_multifd_channels(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_channels; } =20 MultiFDCompression migrate_multifd_compression(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 assert(s->parameters.multifd_compression < MULTIFD_COMPRESSION__MAX); return s->parameters.multifd_compression; @@ -622,36 +555,28 @@ MultiFDCompression migrate_multifd_compression(void) =20 int migrate_multifd_zlib_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_zlib_level; } =20 int migrate_multifd_zstd_level(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.multifd_zstd_level; } =20 uint8_t migrate_throttle_trigger_threshold(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.throttle_trigger_threshold; } =20 uint64_t migrate_xbzrle_cache_size(void) { - MigrationState *s; - - s =3D migrate_get_current(); + MigrationState *s =3D migrate_get_current(); =20 return s->parameters.xbzrle_cache_size; } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998253; cv=none; d=zohomail.com; s=zohoarc; b=j0JbK2YzVlnEvzk8kMAmhyjxmkzsMEromwoI1ZEEqsn1x7JdpuReTy0S7VoAVa1+e08ON5cmfszt0RIcQMYkaJTZCTlagPq4xi1OoWskwgj1ESjDMQIohTOOHSYFwR4FwhH5OyKHsErOlO77NjI14BMfcn5n9jsSTptGfIi3Dwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998253; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DO5R4xhLv1+Gf5TaJH4kMoqRzkW8dvUf0kl0sYpt580=; b=KsllJVcwkGZQnVGHZ5ytKYwXryxEDjSFZfnkwLYb7r1I+bAGaDYYWBA30D1DeBGH+RfLgvIGJnF8BSMZZmoJNraCUj6wojbnQ+n6DKC1J55HGcHRTAlGvOKlRHPq6EF5gzO8Y5qD8JxxemjU7wAuh8BX7xENX327QbCwTg9Sm7I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998253483156.49515207132845; Thu, 20 Apr 2023 06:44:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYp-0000jB-Qm; Thu, 20 Apr 2023 09:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXt-0006jB-Be for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXo-0006Fw-UN for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:57 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-644-pjN3h71SPlmd9N5txk-VoQ-1; Thu, 20 Apr 2023 09:41:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F9B7280AA28; Thu, 20 Apr 2023 13:41:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E9E24020BED; Thu, 20 Apr 2023 13:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DO5R4xhLv1+Gf5TaJH4kMoqRzkW8dvUf0kl0sYpt580=; b=Ixn50oHw8+EhZMe/Wf+Kc+KMGcQ6qur1OxWNr5puW4ELlPeK8wIDb7abl5MQuJq9h4daGo Pqt+EsNZ6A6ZVxvqzPYhQWzrgYuKHLdQTcJbltydJBahq++zKPtybKyagT8EU2Szn7NMPl 8yPMLVjv0ZhSdaxJ66QyFo3ObU4A9C0= X-MC-Unique: pjN3h71SPlmd9N5txk-VoQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 35/43] migration: Create migrate_downtime_limit() function Date: Thu, 20 Apr 2023 15:39:54 +0200 Message-Id: <20230420134002.29531-36-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998254508100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 4 ++-- migration/options.c | 7 +++++++ migration/options.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index b87aebee9b..3054874743 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2739,7 +2739,7 @@ static void migration_update_counters(MigrationState = *s, transferred =3D current_bytes - s->iteration_initial_bytes; time_spent =3D current_time - s->iteration_start_time; bandwidth =3D (double)transferred / time_spent; - s->threshold_size =3D bandwidth * s->parameters.downtime_limit; + s->threshold_size =3D bandwidth * migrate_downtime_limit(); =20 s->mbps =3D (((double) transferred * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0; @@ -3249,7 +3249,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) */ migrate_error_free(s); =20 - s->expected_downtime =3D s->parameters.downtime_limit; + s->expected_downtime =3D migrate_downtime_limit(); if (resume) { assert(s->cleanup_bh); } else { diff --git a/migration/options.c b/migration/options.c index fa99e397d0..6c7c85ef2f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -517,6 +517,13 @@ int migrate_decompress_threads(void) return s->parameters.decompress_threads; } =20 +uint64_t migrate_downtime_limit(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.downtime_limit; +} + uint8_t migrate_max_cpu_throttle(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 9f50348d3c..6dc9cea195 100644 --- a/migration/options.h +++ b/migration/options.h @@ -71,6 +71,7 @@ uint8_t migrate_cpu_throttle_increment(void); uint8_t migrate_cpu_throttle_initial(void); bool migrate_cpu_throttle_tailslow(void); int migrate_decompress_threads(void); +uint64_t migrate_downtime_limit(void); uint8_t migrate_max_cpu_throttle(void); uint64_t migrate_max_bandwidth(void); int64_t migrate_max_postcopy_bandwidth(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998448; cv=none; d=zohomail.com; s=zohoarc; b=AzpbZye8nVlnciFG8Xx7WS0Kqj38X+nEZ5kfZ2IqLEXrbbKX1Haw7qGwcJkH96/ZEgbIZiz3bLFzV2WNrRu0qOks8e9I8tTmcBYryf61QsATxy1jv+CMtp09D+rr6cvnBYeCp4Aug/Uz/15dYU+wZZ46JSXnPVCEwnIajsfGhj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998448; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Aq4s9Xs/Xg89Uwz3e6sUuOv6yjWjazRx1cUCRByivvo=; b=I8BduULFwFJaBgckuZ8cx6l4H2lHw0NX8SLMQAY7tJdTQHnn0rEfYhfo1szBJWNf+uwjt2XzV8zLh30Go2kFiKFvZqL+C4wG/lcfwS9Aacyn9jcag6N/R4dd5MtQTGxJFcjdhyn7l7hCfssO0EmAiddE4bP6SdvrfFaB1GLv6Vg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998448308731.1683900197112; Thu, 20 Apr 2023 06:47:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYs-0001Eq-O4; Thu, 20 Apr 2023 09:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXu-0006jh-Gh for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXr-0006Gm-T0 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:41:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-388-FvcgbWJeOu2mg4WILM1KRQ-1; Thu, 20 Apr 2023 09:41:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71AD5101A54F; Thu, 20 Apr 2023 13:41:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id D396B4020BF1; Thu, 20 Apr 2023 13:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Aq4s9Xs/Xg89Uwz3e6sUuOv6yjWjazRx1cUCRByivvo=; b=Lks+rlIGum+AKnJTEsTCHzhFKja14tv2yvvi97Z4DaqjXrlXa/pQOv+iR92jB6bd7FntU9 ibFgrm6HtrXBZHMKHxzAlCxs0Yzeyr0tnUg4z/UPBu896q8kDTn+0SAUFjDHnhIBt8NMua 2v+gY4ZX5xSmqNVliOcpgmj+Gbu9+as= X-MC-Unique: FvcgbWJeOu2mg4WILM1KRQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 36/43] migration: Move migrate_set_block_incremental() to options.c Date: Thu, 20 Apr 2023 15:39:55 +0200 Message-Id: <20230420134002.29531-37-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998449555100001 Content-Type: text/plain; charset="utf-8" Once there, make it more regular and remove th eneed for MigrationState parameter. Signed-off-by: Juan Quintela --- migration/migration.c | 9 ++------- migration/options.c | 9 +++++++++ migration/options.h | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3054874743..d31e987d1a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1165,17 +1165,12 @@ void migrate_set_state(int *state, int old_state, i= nt new_state) } } =20 -static void migrate_set_block_incremental(MigrationState *s, bool value) -{ - s->parameters.block_incremental =3D value; -} - static void block_cleanup_parameters(MigrationState *s) { if (s->must_remove_block_options) { /* setting to false can never fail */ migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); - migrate_set_block_incremental(s, false); + migrate_set_block_incremental(false); s->must_remove_block_options =3D false; } } @@ -1669,7 +1664,7 @@ static bool migrate_prepare(MigrationState *s, bool b= lk, bool blk_inc, } =20 if (blk_inc) { - migrate_set_block_incremental(s, true); + migrate_set_block_incremental(true); } =20 migrate_init(s); diff --git a/migration/options.c b/migration/options.c index 6c7c85ef2f..0ca2ad4fab 100644 --- a/migration/options.c +++ b/migration/options.c @@ -588,6 +588,15 @@ uint64_t migrate_xbzrle_cache_size(void) return s->parameters.xbzrle_cache_size; } =20 +/* parameter setters */ + +void migrate_set_block_incremental(bool value) +{ + MigrationState *s =3D migrate_get_current(); + + s->parameters.block_incremental =3D value; +} + /* parameters helpers */ =20 AnnounceParameters *migrate_announce_params(void) diff --git a/migration/options.h b/migration/options.h index 6dc9cea195..61b559ff3f 100644 --- a/migration/options.h +++ b/migration/options.h @@ -82,6 +82,10 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); uint64_t migrate_xbzrle_cache_size(void); =20 +/* parameters setters */ + +void migrate_set_block_incremental(bool value); + /* parameters helpers */ =20 bool migrate_params_check(MigrationParameters *params, Error **errp); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998709; cv=none; d=zohomail.com; s=zohoarc; b=f94D0TBMxfTkjWx9iEorp9lMBDd4RgACRIEXLXsBkRZwI0xmnFsfnwdlEBuW0ZhXw4diGBE/4Uf+F14DHNx99B33/UUYn8s7EQC3++wn19lR3Ho7XwMCVK6PxMDPDkARPFsbhVp2h21GnS3jV/xm/zp5jXbigKFG8FJXJka+WEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998709; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TkVECC+q0xpvQKSEknRAnpj+dGeec35NbQ06BMiGQYo=; b=QykqhD3KgeoLDrTd8mS41j8cmiHiJKPzWKVrjsTsAtPdihCM62emsrpEoS0ZNAxONuBiqiaFEb+CFZCQjIYN5HN11CBgKbXYyNP9HSmEZG0l6SFwq9go+2wWTR/6pIHQfhYX3wPQ5llkbJ2lLRPE+v35yUSsogKCFQ376oyc1Z0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998709076498.6643180657086; Thu, 20 Apr 2023 06:51:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYx-0001pJ-Hf; Thu, 20 Apr 2023 09:43:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXy-0006q7-6c for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXw-0006Iz-RA for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-166-gKu9W329OiSWOws9QMUOjQ-1; Thu, 20 Apr 2023 09:41:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52AFC3C10696; Thu, 20 Apr 2023 13:41:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAA034020BED; Thu, 20 Apr 2023 13:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TkVECC+q0xpvQKSEknRAnpj+dGeec35NbQ06BMiGQYo=; b=hcDGVczRhtKu3cNZ3FuDxBOLjEPVg0rPPSb+a+3T9mucQqOu3fUfqtZzTX4Njkzwbjrq9c 7vyjt+/kP51tRw3PULBi3qnUaP68ktqgG39IsZlGBM6r0T5IQCtwDXAdx2rabevaKbbgQz ZvDl4uBwk6NSuIF0Y3NGoCB4kHAjqUk= X-MC-Unique: gKu9W329OiSWOws9QMUOjQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 37/43] migration: Move block_cleanup_parameters() to options.c Date: Thu, 20 Apr 2023 15:39:56 +0200 Message-Id: <20230420134002.29531-38-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998709867100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 10 ---------- migration/options.c | 10 ++++++++++ migration/options.h | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d31e987d1a..f12ab54ae0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1165,16 +1165,6 @@ void migrate_set_state(int *state, int old_state, in= t new_state) } } =20 -static void block_cleanup_parameters(MigrationState *s) -{ - if (s->must_remove_block_options) { - /* setting to false can never fail */ - migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); - migrate_set_block_incremental(false); - s->must_remove_block_options =3D false; - } -} - static void migrate_fd_cleanup(MigrationState *s) { qemu_bh_delete(s->cleanup_bh); diff --git a/migration/options.c b/migration/options.c index 0ca2ad4fab..8fae79c2c9 100644 --- a/migration/options.c +++ b/migration/options.c @@ -599,6 +599,16 @@ void migrate_set_block_incremental(bool value) =20 /* parameters helpers */ =20 +void block_cleanup_parameters(MigrationState *s) +{ + if (s->must_remove_block_options) { + /* setting to false can never fail */ + migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); + migrate_set_block_incremental(false); + s->must_remove_block_options =3D false; + } +} + AnnounceParameters *migrate_announce_params(void) { static AnnounceParameters ap; diff --git a/migration/options.h b/migration/options.h index 61b559ff3f..7476f814c9 100644 --- a/migration/options.h +++ b/migration/options.h @@ -90,5 +90,6 @@ void migrate_set_block_incremental(bool value); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); +void block_cleanup_parameters(MigrationState *s); =20 #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998231; cv=none; d=zohomail.com; s=zohoarc; b=Y5B8NDCgwV59fRdNcFeaQgbeqeBztFcb+HX1/yfE5/q3LPuBm0X44YPVNrHHRWvlFhts4VNmqItV40tHt0tPp0+h1vlEklJR1GbOwIY7TU9UHYyhFQx0F9BT2OoyK8hZhV1oeLol+uFY5tLQc79rG/qmIj4ULXwVDLv+wyrA9aE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998231; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XGVcssVvqDc2fvTwxtHb7N8QYD5pbI4VkMhjgQibx88=; b=NZFl3GJOBkQXOEaY8kRVr/yvR4PgrHsxKbRX7iTOwnEfEGuz1hTNyp9O4TGtOedx/fWB9QdNt0Nni2NK3fCq8A9ncDgHcxquJtWvfie0EOTt+n8PqI64ruq110W1tPQ30sYaHuRtFc7k/a3nttB2FTrtdkjQzl8s1J681R7X1aU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998231325971.610840691265; Thu, 20 Apr 2023 06:43:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYA-0007iT-RI; Thu, 20 Apr 2023 09:42:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUY1-0006yu-Cx for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUXy-0006Jp-BB for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:04 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-4KuBdxmHNRGo5-hapPiing-1; Thu, 20 Apr 2023 09:41:58 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32C82185A78F; Thu, 20 Apr 2023 13:41:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96D684020BED; Thu, 20 Apr 2023 13:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XGVcssVvqDc2fvTwxtHb7N8QYD5pbI4VkMhjgQibx88=; b=AB+J0NGjyYKaZC2RM9oqwc0Eb6lCALaEWFf7vq/Ri5djURmE27JWyzsE+Z8gLr7PHiqkyu FansKVdQFL6ji4qiEYqm62xZL9WlJ0L0aekHeLdfdmG/YoEHGq8TsFb08BbxQMScTQf0F0 WUZkU6gZz+M81QJtcOBUHIGtt676LJs= X-MC-Unique: 4KuBdxmHNRGo5-hapPiing-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 38/43] migration: Remove MigrationState from block_cleanup_parameters() Date: Thu, 20 Apr 2023 15:39:57 +0200 Message-Id: <20230420134002.29531-39-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998232852100001 Content-Type: text/plain; charset="utf-8" This makes the function more regular with everything else. Signed-off-by: Juan Quintela --- migration/migration.c | 4 ++-- migration/options.c | 4 +++- migration/options.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f12ab54ae0..4742f14686 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1219,7 +1219,7 @@ static void migrate_fd_cleanup(MigrationState *s) error_report_err(error_copy(s->error)); } notifier_list_notify(&migration_state_notifiers, s); - block_cleanup_parameters(s); + block_cleanup_parameters(); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 @@ -1713,7 +1713,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); - block_cleanup_parameters(s); + block_cleanup_parameters(); return; } =20 diff --git a/migration/options.c b/migration/options.c index 8fae79c2c9..da70f62693 100644 --- a/migration/options.c +++ b/migration/options.c @@ -599,8 +599,10 @@ void migrate_set_block_incremental(bool value) =20 /* parameters helpers */ =20 -void block_cleanup_parameters(MigrationState *s) +void block_cleanup_parameters(void) { + MigrationState *s =3D migrate_get_current(); + if (s->must_remove_block_options) { /* setting to false can never fail */ migrate_cap_set(MIGRATION_CAPABILITY_BLOCK, false, &error_abort); diff --git a/migration/options.h b/migration/options.h index 7476f814c9..2981da21f0 100644 --- a/migration/options.h +++ b/migration/options.h @@ -90,6 +90,6 @@ void migrate_set_block_incremental(bool value); =20 bool migrate_params_check(MigrationParameters *params, Error **errp); void migrate_params_init(MigrationParameters *params); -void block_cleanup_parameters(MigrationState *s); +void block_cleanup_parameters(void); =20 #endif --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998601; cv=none; d=zohomail.com; s=zohoarc; b=UIoojE27YvZWJI9TEm6QvwwjzhFzOl7vYV//VGV9AJAHw6HAJOw9/D1vIINCozrz/gmPGwIXpFV0Le669z6+BPJpyq/QgnBdiwgI1grqeD8vE1Z2KZB3l73Z9CsVnHNNuChCBN6UkPwqOUa/5HfcshOFgoS4N1OBWIsY6o8aw9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998601; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H/rFKQpistzwaoMtNaS8tJa1+IOsgJiLvMnf4GL1m6E=; b=cjutuIFNJsyg7hQDB2P6tdfRFBK+yJnntRU5DJauLHwKsodqKe/N4SSnAtq6pAoPKFTCzr66fJZqQzVw91hOHRj1V3CC4nS9P+TNwl+0mNhDLIQunODAKdZzfWsAqquFQtIbeCdqdq0o175//paN+9kRnFM35JkaQG4whG0f8M4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998601109368.01657077144057; Thu, 20 Apr 2023 06:50:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYg-0008Ig-Fv; Thu, 20 Apr 2023 09:42:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUY3-00074Y-Lx for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUY2-0006L4-4Q for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:07 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-386-BwByKKAxNNG_qHUuSbxmjg-1; Thu, 20 Apr 2023 09:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E1323C106A0; Thu, 20 Apr 2023 13:42:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 757264020BF1; Thu, 20 Apr 2023 13:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H/rFKQpistzwaoMtNaS8tJa1+IOsgJiLvMnf4GL1m6E=; b=IBlRLdZvG3uuf5+68KdYbpAZd06mzeFV1Vr5dxq999Vuy2kOicXwCw+2JhwR2bfFsjIBD+ bcPSZek4ojDrHkrzgkdGLbeGZq/ftBwZLSYsqDIhhSa6AKJ/TWQDdUVuVzZa5/XXLRAq8G P62JoY37yvsWjvVtncYaKX6yqcN2+1Q= X-MC-Unique: BwByKKAxNNG_qHUuSbxmjg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 39/43] migration: Create migrate_tls_creds() function Date: Thu, 20 Apr 2023 15:39:58 +0200 Message-Id: <20230420134002.29531-40-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998603440100008 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/tls.c | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/migration/options.c b/migration/options.c index da70f62693..bb5e055004 100644 --- a/migration/options.c +++ b/migration/options.c @@ -581,6 +581,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +char *migrate_tls_creds(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_creds; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 2981da21f0..acd48feabb 100644 --- a/migration/options.h +++ b/migration/options.h @@ -80,6 +80,7 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); +char *migrate_tls_creds(void); uint64_t migrate_xbzrle_cache_size(void); =20 /* parameters setters */ diff --git a/migration/tls.c b/migration/tls.c index acd38e0b62..0d318516de 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -34,20 +34,19 @@ migration_tls_get_creds(MigrationState *s, Error **errp) { Object *creds; + char *tls_creds =3D migrate_tls_creds(); QCryptoTLSCreds *ret; =20 - creds =3D object_resolve_path_component( - object_get_objects_root(), s->parameters.tls_creds); + creds =3D object_resolve_path_component(object_get_objects_root(), tls= _creds); if (!creds) { - error_setg(errp, "No TLS credentials with id '%s'", - s->parameters.tls_creds); + error_setg(errp, "No TLS credentials with id '%s'", tls_creds); return NULL; } ret =3D (QCryptoTLSCreds *)object_dynamic_cast( creds, TYPE_QCRYPTO_TLS_CREDS); if (!ret) { error_setg(errp, "Object with id '%s' is not TLS credentials", - s->parameters.tls_creds); + tls_creds); return NULL; } if (!qcrypto_tls_creds_check_endpoint(ret, endpoint, errp)) { --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998421; cv=none; d=zohomail.com; s=zohoarc; b=fPwSyBeTzu3/wOVxl79Xa/a/DeuhymNMFdB0g7Hk6dyJuflouFp32rufulvriOue/I+Y3yvarZVcDKFZEwyHBs8JuWyUP/9mdEM5fahhSSZKvso6EtY+7u/PFkRTJnwZvnp6xrTToRdD8fDw+7XhC4vCSe9C4Yz9vOQIuspvXCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998421; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XwXicgA+WCPVmWgL49bV8ttqeRykD2CW+tSCOk0AB7A=; b=AJNUy3/NJD47HdOeRqnMD4fNMsBDRLIYst0KP3zuqna9Viy3IWxgdGScdMMOkcbzzZ6R2UT1LEwbxPE6wCn1zIyRRIYNZxZm8WqNXv14DmdQ1SeHKqO7dxZSr3neNynuHkAf7TQHKFQ8FU7AxDuAurYS/KH23mCAlDH06UswrnQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998421233881.7118342120704; Thu, 20 Apr 2023 06:47:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYs-0001F3-T6; Thu, 20 Apr 2023 09:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYF-0007pa-Px for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYC-0006Oy-L7 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:19 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-647-Lu-ENAkZNaWRuMT5eN04bg-1; Thu, 20 Apr 2023 09:42:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E99DC1C0512E; Thu, 20 Apr 2023 13:42:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51EEB4020BED; Thu, 20 Apr 2023 13:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XwXicgA+WCPVmWgL49bV8ttqeRykD2CW+tSCOk0AB7A=; b=KJ5anws7FSvk4qUKD1W4pzrq+x8oxu7ADAZ6Qtmcc9txv9J2SY4dzlC8I8ScfeyhugpauK n9vqYAkqSpVnrQKv2Rm6IglE3qoHAhDPeW2JwXl3K5QKAhiaK3fPiT+SP+37CHFxZj8HXn JAZSfLeaT2LIhH5uccf0OQSKwHTXdS0= X-MC-Unique: Lu-ENAkZNaWRuMT5eN04bg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 40/43] migration: Create migrate_tls_authz() function Date: Thu, 20 Apr 2023 15:39:59 +0200 Message-Id: <20230420134002.29531-41-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998421466100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/tls.c | 5 +---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/options.c b/migration/options.c index bb5e055004..303a493388 100644 --- a/migration/options.c +++ b/migration/options.c @@ -581,6 +581,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +char *migrate_tls_authz(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_authz; +} + char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index acd48feabb..72b0f3cf62 100644 --- a/migration/options.h +++ b/migration/options.h @@ -80,6 +80,7 @@ MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); +char *migrate_tls_authz(void); char *migrate_tls_creds(void); uint64_t migrate_xbzrle_cache_size(void); =20 diff --git a/migration/tls.c b/migration/tls.c index 0d318516de..4c229326fd 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -86,10 +86,7 @@ void migration_tls_channel_process_incoming(MigrationSta= te *s, return; } =20 - tioc =3D qio_channel_tls_new_server( - ioc, creds, - s->parameters.tls_authz, - errp); + tioc =3D qio_channel_tls_new_server(ioc, creds, migrate_tls_authz(), e= rrp); if (!tioc) { return; } --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998291; cv=none; d=zohomail.com; s=zohoarc; b=S/7WiR+3U8X3LXhrpFMiixjtkY6o+ZkYsqNVKHdd3lEJpWsj+1f6Kknit827V2uA+WJc8F5lc9OZlXkRR6G56OByQIFQVU3mhJEuB8oAQVH+9A2I1/mqOgDQV6w5eEf4WNJQtHrnXGc5zS16Q9hfdBe5GpjYRyUO+h2fPFA+Hpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998291; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FnBemTGpJBwq3+eccXAvoL56joreF+/xlYaUeKbvlkc=; b=Ju/41lLEPyRODn23GNUQZm9lirnMrnMaKdddezsmKsw4V91oi8n6QqP/NjcKG26lE+jj5g/bqAn0a0jHpIeCd1Tfibo1/c3sTN6D9z7FgkuQKABGM+XtUhGlV1v4LvC7qeWvipG8+BcKtQ/Td1Ob0nvNdTF0QooHYfMmFL7t9eI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998291549260.6492959305872; Thu, 20 Apr 2023 06:44:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYp-0000fK-Gu; Thu, 20 Apr 2023 09:42:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYA-0007j0-Gb for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUY8-0006NY-Fq for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-FWetV6zXOySjjABgLOFhtA-1; Thu, 20 Apr 2023 09:42:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09EC4811E7B; Thu, 20 Apr 2023 13:42:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 384F04020BED; Thu, 20 Apr 2023 13:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FnBemTGpJBwq3+eccXAvoL56joreF+/xlYaUeKbvlkc=; b=i4FtdKB6HhxUS7lXRC1+bqyqUrrgPFmZ/Qz6/cKz4izv1MEZc9fZHO4D9KnudGmhKhbmC4 /Su1MdP8G2WxlG/VG4EYunDC+YEefseAPw6lCmw3nFYCzxtmrSp0EAptCABKzEMqS3VEwu p78K94OD3S//aZgL7M+/7P654UZ+2eo= X-MC-Unique: FWetV6zXOySjjABgLOFhtA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 41/43] migration: Create migrate_tls_hostname() function Date: Thu, 20 Apr 2023 15:40:00 +0200 Message-Id: <20230420134002.29531-42-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998293344100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/tls.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 303a493388..8f0bf1ece6 100644 --- a/migration/options.c +++ b/migration/options.c @@ -595,6 +595,13 @@ char *migrate_tls_creds(void) return s->parameters.tls_creds; } =20 +char *migrate_tls_hostname(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_hostname; +} + uint64_t migrate_xbzrle_cache_size(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 72b0f3cf62..2f21837094 100644 --- a/migration/options.h +++ b/migration/options.h @@ -82,6 +82,7 @@ int migrate_multifd_zstd_level(void); uint8_t migrate_throttle_trigger_threshold(void); char *migrate_tls_authz(void); char *migrate_tls_creds(void); +char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); =20 /* parameters setters */ diff --git a/migration/tls.c b/migration/tls.c index 4c229326fd..3cae1a06e7 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -123,6 +123,7 @@ QIOChannelTLS *migration_tls_client_create(MigrationSta= te *s, Error **errp) { QCryptoTLSCreds *creds; + char *tls_hostname; =20 creds =3D migration_tls_get_creds( s, QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, errp); @@ -130,8 +131,9 @@ QIOChannelTLS *migration_tls_client_create(MigrationSta= te *s, return NULL; } =20 - if (s->parameters.tls_hostname && *s->parameters.tls_hostname) { - hostname =3D s->parameters.tls_hostname; + tls_hostname =3D migrate_tls_hostname(); + if (tls_hostname && *tls_hostname) { + hostname =3D tls_hostname; } =20 return qio_channel_tls_new_client(ioc, creds, hostname, errp); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998653; cv=none; d=zohomail.com; s=zohoarc; b=iyTnwMtNqYXrXk2KkHSkisb1LLM63PIBrgZnvguNda92+JgXUBQHoSosTV+Z+6rrMDEDsLAXZ+DSLZSJQ1EF2Kk2pi+g+PBerXKgI/0f17PlmfKVaNjFf3kANE9E7SSnAGbT+Utt+Yi92IOncibsvk4fe78FjTS0QgMs6K+CMSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998653; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7iuAp3CAA3aqL7BmtPkAn+nv94zFgdW4bZXzhU61HbE=; b=AGq5gxEK8PoVERnsoxnOSzUPy8l9DcYmyP0r3I7sB3NPv77CNxUketh19Y3F3YbFA65Y8+isu6J8YFNPP5owsIm/x560aTJzJVXFmVJxGXqiyZdYEAD+SPaFfbOO0I0tqyFfipAJTqstT+84feASUhcNFP3pk5G5ZBVMsakUgYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998653273745.6539970590396; Thu, 20 Apr 2023 06:50:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUYu-0001Od-8W; Thu, 20 Apr 2023 09:43:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYF-0007pb-S4 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYB-0006On-6P for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:18 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-ZDqoWtwiOz2zq0oN6sZDMw-1; Thu, 20 Apr 2023 09:42:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2BB6185A78B; Thu, 20 Apr 2023 13:42:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E2094020BF1; Thu, 20 Apr 2023 13:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7iuAp3CAA3aqL7BmtPkAn+nv94zFgdW4bZXzhU61HbE=; b=V1TUwSEEYiM8GelNoXuKD+WhUrjngqQRBX7+wU1+8/C9HTGuns11Ljcm8I7f/XhEWqhgLU C45Mj7cfNiC7eEzCN4o2yzv32ilq1TnP9k3QY1a0MJX+6pL+S0xkDLu3IWLJ5jQRC59jhv dfEPCstS41IFuV3Qy7+E6wLQUZ1R35Y= X-MC-Unique: ZDqoWtwiOz2zq0oN6sZDMw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 42/43] migration: Create migrate_block_bitmap_mapping() function Date: Thu, 20 Apr 2023 15:40:01 +0200 Message-Id: <20230420134002.29531-43-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998653906100005 Content-Type: text/plain; charset="utf-8" Notice that we changed the test of ->has_block_bitmap_mapping for the test that block_bitmap_mapping is not NULL. Signed-off-by: Juan Quintela --- migration/block-dirty-bitmap.c | 14 ++++++++------ migration/options.c | 7 +++++++ migration/options.h | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index a6ffae0002..62b2352bbb 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -605,11 +605,12 @@ static int init_dirty_bitmap_migration(DBMSaveState *= s) SaveBitmapState *dbms; GHashTable *handled_by_blk =3D g_hash_table_new(NULL, NULL); BlockBackend *blk; - const MigrationParameters *mig_params =3D &migrate_get_current()->para= meters; GHashTable *alias_map =3D NULL; + BitmapMigrationNodeAliasList *block_bitmap_mapping =3D + migrate_block_bitmap_mapping(); =20 - if (mig_params->has_block_bitmap_mapping) { - alias_map =3D construct_alias_map(mig_params->block_bitmap_mapping= , true, + if (block_bitmap_mapping) { + alias_map =3D construct_alias_map(block_bitmap_mapping, true, &error_abort); } =20 @@ -1158,7 +1159,8 @@ static int dirty_bitmap_load_header(QEMUFile *f, DBML= oadState *s, static int dirty_bitmap_load(QEMUFile *f, void *opaque, int version_id) { GHashTable *alias_map =3D NULL; - const MigrationParameters *mig_params =3D &migrate_get_current()->para= meters; + BitmapMigrationNodeAliasList *block_bitmap_mapping =3D + migrate_block_bitmap_mapping(); DBMLoadState *s =3D &((DBMState *)opaque)->load; int ret =3D 0; =20 @@ -1170,8 +1172,8 @@ static int dirty_bitmap_load(QEMUFile *f, void *opaqu= e, int version_id) return -EINVAL; } =20 - if (mig_params->has_block_bitmap_mapping) { - alias_map =3D construct_alias_map(mig_params->block_bitmap_mapping, + if (block_bitmap_mapping) { + alias_map =3D construct_alias_map(block_bitmap_mapping, false, &error_abort); } =20 diff --git a/migration/options.c b/migration/options.c index 8f0bf1ece6..7a8fb4578a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -454,6 +454,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, =20 /* parameters */ =20 +BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.block_bitmap_mapping; +} + bool migrate_block_incremental(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 2f21837094..6b9ad7bae4 100644 --- a/migration/options.h +++ b/migration/options.h @@ -62,6 +62,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp); =20 /* parameters */ =20 +BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_block_incremental(void); uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); --=20 2.39.2 From nobody Sat May 11 17:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1681998265; cv=none; d=zohomail.com; s=zohoarc; b=nlGGfzTVRBhOZSxF2sX76pNqaduBok6FyCZzXHJ64PAopp+/K/FSxo4v79wr643UfAkpVM6tOTHzoFwUDEm5uAzy37+Q/O8kvuuyg9W0xT8qxHAcIN7lSVrowG9sRuRCig702IoyslM1WwkExLpzXrbFPJvMEY75sdmS0FDf0HQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681998265; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1nrxJ+SNMJG+o1wNbBqZC4jEyoS+h0IGx/EZZrxyrp8=; b=DwTte0Beqn8jo18/eqQAW0/k/aa+1JCKd+wHhA/E91VbDk0qEXGF6fl9oDhIgbmla4QF+bpVvbcZ3f/fVOmKzvDM+KrfmdG4W+AweH2UH0cYJfVrN4LBZ/W/cOhClgcBTYCNP/vYu49wcNOaed+1VUbuwH1+/ZSKOsMRX2cvGLg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681998265002488.949587946003; Thu, 20 Apr 2023 06:44:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUZ2-0002ly-3u; Thu, 20 Apr 2023 09:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYF-0007pc-Sa for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppUYB-0006Oj-32 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:42:18 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-376-LGr5q34QNEK96vysUaKWUg-1; Thu, 20 Apr 2023 09:42:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E62E81C0897D; Thu, 20 Apr 2023 13:42:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 378514020BEE; Thu, 20 Apr 2023 13:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681998134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nrxJ+SNMJG+o1wNbBqZC4jEyoS+h0IGx/EZZrxyrp8=; b=HO3C1KKmianWYPJlE1qbHnCDCI2EkgUY8w7WeQO4/Q+VVV4MmfWgu9g5D8gqSFly/a4Bw7 frKMhsXRxkPUFw4aaS9u22GpVtv4Xn1CHugbVv4Yz4DuVUmGne9PQzHyB8NQZD/Xz5iEa4 P+rv84IxpPIj2ZkMGgziiUj6puwNGUE= X-MC-Unique: LGr5q34QNEK96vysUaKWUg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , David Hildenbrand , John Snow , Fam Zheng , Hailiang Zhang , "Michael S. Tsirkin" , qemu-block@nongnu.org, Gerd Hoffmann , Vladimir Sementsov-Ogievskiy , Leonardo Bras , Markus Armbruster , Stefan Hajnoczi , Juan Quintela , Eric Blake Subject: [PATCH v2 43/43] migration: Move migration_properties to options.c Date: Thu, 20 Apr 2023 15:40:02 +0200 Message-Id: <20230420134002.29531-44-quintela@redhat.com> In-Reply-To: <20230420134002.29531-1-quintela@redhat.com> References: <20230420134002.29531-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681998266577100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/migration.c | 157 ------------------------------------------ migration/options.c | 155 +++++++++++++++++++++++++++++++++++++++++ migration/options.h | 7 ++ 3 files changed, 162 insertions(+), 157 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4742f14686..23414fc901 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -52,8 +52,6 @@ #include "io/channel-tls.h" #include "migration/colo.h" #include "hw/boards.h" -#include "hw/qdev-properties.h" -#include "hw/qdev-properties-system.h" #include "monitor/monitor.h" #include "net/announce.h" #include "qemu/queue.h" @@ -65,51 +63,6 @@ #include "sysemu/qtest.h" #include "options.h" =20 -#define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ - -/* Time in milliseconds we are allowed to stop the source, - * for sending the last part */ -#define DEFAULT_MIGRATE_SET_DOWNTIME 300 - -/* Default compression thread count */ -#define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 -/* Default decompression thread count, usually decompression is at - * least 4 times as fast as compression.*/ -#define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2 -/*0: means nocompress, 1: best speed, ... 9: best compress ratio */ -#define DEFAULT_MIGRATE_COMPRESS_LEVEL 1 -/* Define default autoconverge cpu throttle migration parameters */ -#define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 -#define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 -#define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 -#define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99 - -/* Migration XBZRLE default cache size */ -#define DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE (64 * 1024 * 1024) - -/* The delay time (in ms) between two COLO checkpoints */ -#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) -#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 -#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE -/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ -#define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1 -/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */ -#define DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL 1 - -/* Background transfer rate for postcopy, 0 means unlimited, note - * that page requests can still exceed this limit. - */ -#define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0 - -/* - * Parameters for self_announce_delay giving a stream of RARP/ARP - * packets after migration. - */ -#define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50 -#define DEFAULT_MIGRATE_ANNOUNCE_MAX 550 -#define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 -#define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 - static NotifierList migration_state_notifiers =3D NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); =20 @@ -3322,116 +3275,6 @@ void migrate_fd_connect(MigrationState *s, Error *e= rror_in) s->migration_thread_running =3D true; } =20 -#define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) - -static Property migration_properties[] =3D { - DEFINE_PROP_BOOL("store-global-state", MigrationState, - store_global_state, true), - DEFINE_PROP_BOOL("send-configuration", MigrationState, - send_configuration, true), - DEFINE_PROP_BOOL("send-section-footer", MigrationState, - send_section_footer, true), - DEFINE_PROP_BOOL("decompress-error-check", MigrationState, - decompress_error_check, true), - DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState, - clear_bitmap_shift, CLEAR_BITMAP_SHIFT_DEFAULT), - DEFINE_PROP_BOOL("x-preempt-pre-7-2", MigrationState, - preempt_pre_7_2, false), - - /* Migration parameters */ - DEFINE_PROP_UINT8("x-compress-level", MigrationState, - parameters.compress_level, - DEFAULT_MIGRATE_COMPRESS_LEVEL), - DEFINE_PROP_UINT8("x-compress-threads", MigrationState, - parameters.compress_threads, - DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT), - DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState, - parameters.compress_wait_thread, true), - DEFINE_PROP_UINT8("x-decompress-threads", MigrationState, - parameters.decompress_threads, - DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), - DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, - parameters.throttle_trigger_threshold, - DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), - DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, - parameters.cpu_throttle_initial, - DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), - DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState, - parameters.cpu_throttle_increment, - DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), - DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState, - parameters.cpu_throttle_tailslow, false), - DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState, - parameters.max_bandwidth, MAX_THROTTLE), - DEFINE_PROP_UINT64("x-downtime-limit", MigrationState, - parameters.downtime_limit, - DEFAULT_MIGRATE_SET_DOWNTIME), - DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, - parameters.x_checkpoint_delay, - DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), - DEFINE_PROP_UINT8("multifd-channels", MigrationState, - parameters.multifd_channels, - DEFAULT_MIGRATE_MULTIFD_CHANNELS), - DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState, - parameters.multifd_compression, - DEFAULT_MIGRATE_MULTIFD_COMPRESSION), - DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState, - parameters.multifd_zlib_level, - DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL), - DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState, - parameters.multifd_zstd_level, - DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL), - DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, - parameters.xbzrle_cache_size, - DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), - DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState, - parameters.max_postcopy_bandwidth, - DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH), - DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState, - parameters.max_cpu_throttle, - DEFAULT_MIGRATE_MAX_CPU_THROTTLE), - DEFINE_PROP_SIZE("announce-initial", MigrationState, - parameters.announce_initial, - DEFAULT_MIGRATE_ANNOUNCE_INITIAL), - DEFINE_PROP_SIZE("announce-max", MigrationState, - parameters.announce_max, - DEFAULT_MIGRATE_ANNOUNCE_MAX), - DEFINE_PROP_SIZE("announce-rounds", MigrationState, - parameters.announce_rounds, - DEFAULT_MIGRATE_ANNOUNCE_ROUNDS), - DEFINE_PROP_SIZE("announce-step", MigrationState, - parameters.announce_step, - DEFAULT_MIGRATE_ANNOUNCE_STEP), - DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), - DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), - DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), - - /* Migration capabilities */ - DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), - DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), - DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), - DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), - DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS), - DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), - DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), - DEFINE_PROP_MIG_CAP("x-postcopy-preempt", - MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), - DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), - DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), - DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), - DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), - DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), - DEFINE_PROP_MIG_CAP("x-background-snapshot", - MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), -#ifdef CONFIG_LINUX - DEFINE_PROP_MIG_CAP("x-zero-copy-send", - MIGRATION_CAPABILITY_ZERO_COPY_SEND), -#endif - - DEFINE_PROP_END_OF_LIST(), -}; - static void migration_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); diff --git a/migration/options.c b/migration/options.c index 7a8fb4578a..fada60a00e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -31,6 +31,161 @@ #define MAX_MIGRATE_DOWNTIME_SECONDS 2000 #define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000) =20 +#define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttl= ing */ + +/* Time in milliseconds we are allowed to stop the source, + * for sending the last part */ +#define DEFAULT_MIGRATE_SET_DOWNTIME 300 + +/* Default compression thread count */ +#define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8 +/* Default decompression thread count, usually decompression is at + * least 4 times as fast as compression.*/ +#define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2 +/*0: means nocompress, 1: best speed, ... 9: best compress ratio */ +#define DEFAULT_MIGRATE_COMPRESS_LEVEL 1 +/* Define default autoconverge cpu throttle migration parameters */ +#define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50 +#define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20 +#define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10 +#define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99 + +/* Migration XBZRLE default cache size */ +#define DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE (64 * 1024 * 1024) + +/* The delay time (in ms) between two COLO checkpoints */ +#define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100) +#define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2 +#define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE +/* 0: means nocompress, 1: best speed, ... 9: best compress ratio */ +#define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1 +/* 0: means nocompress, 1: best speed, ... 20: best compress ratio */ +#define DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL 1 + +/* Background transfer rate for postcopy, 0 means unlimited, note + * that page requests can still exceed this limit. + */ +#define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0 + +/* + * Parameters for self_announce_delay giving a stream of RARP/ARP + * packets after migration. + */ +#define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50 +#define DEFAULT_MIGRATE_ANNOUNCE_MAX 550 +#define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5 +#define DEFAULT_MIGRATE_ANNOUNCE_STEP 100 + +#define DEFINE_PROP_MIG_CAP(name, x) \ + DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) + +Property migration_properties[] =3D { + DEFINE_PROP_BOOL("store-global-state", MigrationState, + store_global_state, true), + DEFINE_PROP_BOOL("send-configuration", MigrationState, + send_configuration, true), + DEFINE_PROP_BOOL("send-section-footer", MigrationState, + send_section_footer, true), + DEFINE_PROP_BOOL("decompress-error-check", MigrationState, + decompress_error_check, true), + DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState, + clear_bitmap_shift, CLEAR_BITMAP_SHIFT_DEFAULT), + DEFINE_PROP_BOOL("x-preempt-pre-7-2", MigrationState, + preempt_pre_7_2, false), + + /* Migration parameters */ + DEFINE_PROP_UINT8("x-compress-level", MigrationState, + parameters.compress_level, + DEFAULT_MIGRATE_COMPRESS_LEVEL), + DEFINE_PROP_UINT8("x-compress-threads", MigrationState, + parameters.compress_threads, + DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT), + DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState, + parameters.compress_wait_thread, true), + DEFINE_PROP_UINT8("x-decompress-threads", MigrationState, + parameters.decompress_threads, + DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), + DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState, + parameters.throttle_trigger_threshold, + DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD), + DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState, + parameters.cpu_throttle_initial, + DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), + DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState, + parameters.cpu_throttle_increment, + DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), + DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState, + parameters.cpu_throttle_tailslow, false), + DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState, + parameters.max_bandwidth, MAX_THROTTLE), + DEFINE_PROP_UINT64("x-downtime-limit", MigrationState, + parameters.downtime_limit, + DEFAULT_MIGRATE_SET_DOWNTIME), + DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState, + parameters.x_checkpoint_delay, + DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), + DEFINE_PROP_UINT8("multifd-channels", MigrationState, + parameters.multifd_channels, + DEFAULT_MIGRATE_MULTIFD_CHANNELS), + DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState, + parameters.multifd_compression, + DEFAULT_MIGRATE_MULTIFD_COMPRESSION), + DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState, + parameters.multifd_zlib_level, + DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL), + DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState, + parameters.multifd_zstd_level, + DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL), + DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState, + parameters.xbzrle_cache_size, + DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE), + DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState, + parameters.max_postcopy_bandwidth, + DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH), + DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState, + parameters.max_cpu_throttle, + DEFAULT_MIGRATE_MAX_CPU_THROTTLE), + DEFINE_PROP_SIZE("announce-initial", MigrationState, + parameters.announce_initial, + DEFAULT_MIGRATE_ANNOUNCE_INITIAL), + DEFINE_PROP_SIZE("announce-max", MigrationState, + parameters.announce_max, + DEFAULT_MIGRATE_ANNOUNCE_MAX), + DEFINE_PROP_SIZE("announce-rounds", MigrationState, + parameters.announce_rounds, + DEFAULT_MIGRATE_ANNOUNCE_ROUNDS), + DEFINE_PROP_SIZE("announce-step", MigrationState, + parameters.announce_step, + DEFAULT_MIGRATE_ANNOUNCE_STEP), + DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), + DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), + DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + + /* Migration capabilities */ + DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), + DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), + DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), + DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), + DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS), + DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), + DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), + DEFINE_PROP_MIG_CAP("x-postcopy-preempt", + MIGRATION_CAPABILITY_POSTCOPY_PREEMPT), + DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), + DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), + DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), + DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), + DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD), + DEFINE_PROP_MIG_CAP("x-background-snapshot", + MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT), +#ifdef CONFIG_LINUX + DEFINE_PROP_MIG_CAP("x-zero-copy-send", + MIGRATION_CAPABILITY_ZERO_COPY_SEND), +#endif + + DEFINE_PROP_END_OF_LIST(), +}; + bool migrate_auto_converge(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 6b9ad7bae4..c58cd46495 100644 --- a/migration/options.h +++ b/migration/options.h @@ -14,6 +14,9 @@ #ifndef QEMU_MIGRATION_OPTIONS_H #define QEMU_MIGRATION_OPTIONS_H =20 +#include "hw/qdev-properties.h" +#include "hw/qdev-properties-system.h" + /* constants */ =20 /* Amount of time to allocate to each "chunk" of bandwidth-throttled @@ -21,6 +24,10 @@ #define BUFFER_DELAY 100 #define XFER_LIMIT_RATIO (1000 / BUFFER_DELAY) =20 +/* migration properties */ + +extern Property migration_properties[]; + /* capabilities */ =20 bool migrate_auto_converge(void); --=20 2.39.2