From nobody Thu May 9 23:35:30 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=1682361582; cv=none; d=zohomail.com; s=zohoarc; b=D4maFXo8kWaC0MYuCVrKDvcwEPsLQR2Y3NCAc4cVhQSiRm3kwNj9RZvyBXiufHNykQRU6VjsHuxWcgT60FnwNq4AE5zK3uTp7QS0unvL9JXLWkqCdEf2Eq8dg/ta2eFAbMgfWqRYLeFF9dzmsJdvXgtNgEVsXB0ScVvdDL28c68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361582; 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=TxDkeUHSGNMcym50CfNNw6rvxOmrU5WklH4PwJqv/ko=; b=D/wmSInk7wnj0ZyoMhless4H21cLh+6tC7JXoxUI4IK/BcVxazbVQPxw5xCp4Ip2l3ep3Z8TKmwaIB2oCTywkt/aj1u6IeC6KL6TkRvcwNJjnG/0AJ/uIPTanJfjqlsAoNOmMDDaagShEEEeQn3VDlj6EgaX26lOfyufCQgx4lI= 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 1682361582665197.60012272758354; Mon, 24 Apr 2023 11:39:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zx-0000KP-03; Mon, 24 Apr 2023 14:33:13 -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 1pr0zb-00008q-Hx for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:51 -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 1pr0zY-0005cA-L3 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:51 -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-531-NZ8mCjAZMEGvPL0ZMcGpRw-1; Mon, 24 Apr 2023 14:32:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 30A768828C0; Mon, 24 Apr 2023 18:32:41 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FE33C15BA0; Mon, 24 Apr 2023 18:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361165; 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=TxDkeUHSGNMcym50CfNNw6rvxOmrU5WklH4PwJqv/ko=; b=FTLjJf1klKYT0dzi0+nJV2Rcc1xuKlIze7syUxsfH9KEEUye4lxE+OT3dRIstKU3RaP45R 8wpQUaJeAbjlQI7Ubngr8ogXJw8TXI/dz130rjjsM8Pu5rCwnrzk0FIR3L0apDvIf+nua1 ZBk8+se5uYaRu7r+HFsNefapZERIcFs= X-MC-Unique: NZ8mCjAZMEGvPL0ZMcGpRw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 01/13] migration: Move migrate_use_tls() to options.c Date: Mon, 24 Apr 2023 20:32:24 +0200 Message-Id: <20230424183236.74561-2-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361584021100011 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- Fix typos found by fabiano --- migration/migration.c | 9 --------- migration/migration.h | 2 -- migration/options.c | 11 ++++++++++- migration/options.h | 1 + migration/tls.c | 3 ++- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 53dd59f6f6..02c2355d0d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2177,15 +2177,6 @@ void qmp_migrate_continue(MigrationStatus state, Err= or **errp) qemu_sem_post(&s->pause_sem); } =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 dcf906868d..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 -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 8e8753d9be..d4c0714683 100644 --- a/migration/options.c +++ b/migration/options.c @@ -214,6 +214,15 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 +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, @@ -363,7 +372,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 1b78fa9f3d..13318a16c7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -46,6 +46,7 @@ bool migrate_zero_copy_send(void); */ =20 bool migrate_postcopy(void); +bool migrate_tls(void); =20 /* capabilities helpers */ =20 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 Thu May 9 23:35:30 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=1682361587; cv=none; d=zohomail.com; s=zohoarc; b=C278BuV1AC+iRkHcWmhPXFv8lSXlhregeu2msxnQBL03VkPubRCX37Bm8ACsGD9hdMi0AHAZroajiFgp+P+h0K5Ug8brzcrC+XALdVwdyayTe+k72xZYr/Dfx+bEBGOKhITVoWdo2fRGsfFVF80tLkLFHhojhdfQZxfyNO7elqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361587; 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=+Bb/2AhOvOxSP5n/viUtAlBTqRn+9m4gq4+Y3Qxi5Uw=; b=OwPWQOGdSW7DRSO/FOhduEy35DH0/p8Uhe2iTw1ofZCRg19gFw42uG/MGqmZB0+Gs1MmGdoRUbDnaOemMMRTW94m6ZN858y/CjfmyYUfQavQdCbzaqtNF0+LG3MYrwiYwBOmc9rQOKy6aPPK6O9AGeWyJiDhiWP4zoKpd+Jt168= 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 1682361587798327.73060323932543; Mon, 24 Apr 2023 11:39:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zx-0000KQ-4H; Mon, 24 Apr 2023 14:33:13 -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 1pr0zc-00009K-Vh for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:55 -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 1pr0zY-0005cR-LE for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:52 -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-601-_e1A1BrRO5a-jw0nQX7neA-1; Mon, 24 Apr 2023 14:32:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52457800B35; Mon, 24 Apr 2023 18:32:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72077C15BA0; Mon, 24 Apr 2023 18:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361167; 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=+Bb/2AhOvOxSP5n/viUtAlBTqRn+9m4gq4+Y3Qxi5Uw=; b=KR99EMLe53PK50o5hHKuw4Ng2Luz3BC1fMVMCl1KD0XD3YPmrBkAxsGlXqW874xS3jUct3 0YGOy3rIkRxBrxXcje62HsEUtd0V/eH/IAMG86OkSkuLWxgRPkm9EMEQeo3iKX3wR8kOyZ PxThd7o9pGNUMS7fXoFFPn8cpXd+BAE= X-MC-Unique: _e1A1BrRO5a-jw0nQX7neA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 02/13] migration: Move qmp_migrate_set_parameters() to options.c Date: Mon, 24 Apr 2023 20:32:25 +0200 Message-Id: <20230424183236.74561-3-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361589398100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 02c2355d0d..22e8586623 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 @@ -1140,417 +1131,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 d4c0714683..4701c75a4d 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; @@ -729,3 +737,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 13318a16c7..89067e59a0 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 Thu May 9 23:35:30 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=1682361581; cv=none; d=zohomail.com; s=zohoarc; b=n+xTZRPVndGrFnjmLoqXC/SX/97N5OR9uZhDjabXi/M29vVm71cDn5bXJSDkJINZZDWChFDPlHrrvIBRU403ZrgDQYfe/EpzMchiL3ekETrblzdfgp8DE1JpGpwuRy2AVnYk1QdmNhI0auq0MVg72DCdaUMBA6kLVSbfUGi9hTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361581; 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=7FAG5lEnKmhX3X6MtJ5l+U9Gom+maCuGqZid8oB6rFY=; b=iakGZHqztYnJE0EzCJJkes53AaaECaaxQEqzOIRLVv3BJNTU1GACWWhr7ARGZGfEuslEOyv4Y+EybbLp97qBHdv6nB46n9P0ec6h/O9+HsokPWOv98bIbHwP3qNK2MHQsHxfMWmy4IAhUNwKaoD7bwsoh0hBq7hXV0x0N7ZRpYc= 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 168236158174068.77923793143896; Mon, 24 Apr 2023 11:39:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zy-0000Lp-ME; Mon, 24 Apr 2023 14:33:14 -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 1pr0zc-00008s-01 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32: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 1pr0zY-0005cP-LF for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:51 -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-439-NyQHCYu2OKejBK2Kl2GJcA-1; Mon, 24 Apr 2023 14:32:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 315A08828C0; Mon, 24 Apr 2023 18:32:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93981C15BAD; Mon, 24 Apr 2023 18:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361167; 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=7FAG5lEnKmhX3X6MtJ5l+U9Gom+maCuGqZid8oB6rFY=; b=RgKOV4EdnNOC3vMfBWLUdxjiv7ctapih3qymSUnMXSuQpPD1RhjROcarmP9UIuLMq+qn0p XsRKvt6sMpShAWeBxQB75XrifQ+0xWeaNa4F2Y0xL/IyZ+yoJcOq+F6ckUk+R8iTGcTQcR KHr41K0i+j65RsyugZ1rbf67QXNeVHc= X-MC-Unique: NyQHCYu2OKejBK2Kl2GJcA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 03/13] migration: Create migrate_params_init() function Date: Mon, 24 Apr 2023 20:32:26 +0200 Message-Id: <20230424183236.74561-4-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361583218100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 22e8586623..45fc5be93a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3470,7 +3470,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; @@ -3478,33 +3477,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 4701c75a4d..201f9ff58f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -738,6 +738,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 89067e59a0..86bcbb738c 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 Thu May 9 23:35:30 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=1682361470; cv=none; d=zohomail.com; s=zohoarc; b=Gc7g2+Uy/sX16B109HLWgapJdE3ypBo2hGJNgd52wGJSmeSnvbPGze3wuBY/YETpKNQLA5WQfxwqUhML5BSDVpA8nqEC0kEKNxA4amMh+psxEZyPK/yyIMqnnrJrzNuGkP7TJCo3ECbBM2b/x+AtHiGvKr76kOlPdoFMjgWHhdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361470; 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=V0HktEOK4+ACGxTKTYJjRV6Ouadjppo4s+JxmAv/pJU=; b=RGN38jvyD+QyNQqg/RmsUVH/8sgx6gIzCKlxQd+stgR76/Z/QlPAEz+/WvqNNtgeORCyS7l7LQcy3+LfPN0QkxefWyv5gEIL3iGRVmycoG0z9HukzxJrJ8mLoWYpVrgzbiSjvhji2Gos2XVrguj7Sh8GZQyzSkM+7aqlKdQUpVo= 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 1682361470635818.9526112437288; Mon, 24 Apr 2023 11:37:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr100-0000QD-R7; Mon, 24 Apr 2023 14:33:16 -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 1pr0zj-0000D6-Su for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:03 -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 1pr0zc-0005e2-Hb for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:32:54 -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-423-McmNHrWtM3GCL8v9bBTh6A-1; Mon, 24 Apr 2023 14:32:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3421C3C0E452; Mon, 24 Apr 2023 18:32:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 736EBC15BA0; Mon, 24 Apr 2023 18:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361171; 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=V0HktEOK4+ACGxTKTYJjRV6Ouadjppo4s+JxmAv/pJU=; b=OvRHQL1V7I16h8ejcyphyGPCDr/rqSXypdDtnGaCSKXqH46rblUQQ0XIyBjzF+/xnlYN58 g6DA3Qj6Y7td+1K+YvIZVoIEXa4XYrbAbxaVvrerqRn+PrCxjljYHQxZtKutNgKbGSfmxd LWnCCoZMj4Em2AbEsw0KjoQaOd+jC/0= X-MC-Unique: McmNHrWtM3GCL8v9bBTh6A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 04/13] migration: Make all functions check have the same format Date: Mon, 24 Apr 2023 20:32:27 +0200 Message-Id: <20230424183236.74561-5-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361471456100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/options.c | 153 +++++++++++--------------------------------- 1 file changed, 39 insertions(+), 114 deletions(-) diff --git a/migration/options.c b/migration/options.c index 201f9ff58f..bf4efd6ad4 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; } @@ -493,126 +454,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; @@ -620,36 +553,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 Thu May 9 23:35:30 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=1682361581; cv=none; d=zohomail.com; s=zohoarc; b=UIyjeRKvVic+s1njKNmquQHtjUYMDSJ5RG74lYsdHEkmYRSwmvGejCqnU/BY833uTySpGZCJP1LrIau+PfRCMZiXG/weye8C6gAjVLD0Kjt9H26/zfQMVYOA9+IjWzrk4CNKfH1pbA2ejCDtWFWozko/gSCtMzHLDevQvntf0hE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361581; 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=6bzvrHL2lSkXlgGLZ3P+hwNCeRaERrJG0E6SXlHzB1w=; b=ha8R5Eh9wQQGzVDkLXFEF7WdOWHbiggOSXDFj4WxnIFp1DHVBqXMFmha2jVxtK7e0FXrb/8riH4gqet2TrnLwjIa/omCkmOdcacrQw9BDsLfGED7mZdYrQg/JaA59FWGgg6H8RqC+c/q9ClEnqrCmPQG1AM27vi0ZIWDiXI3j7s= 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 1682361581560292.61808615548114; Mon, 24 Apr 2023 11:39:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zy-0000LN-BB; Mon, 24 Apr 2023 14:33:14 -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 1pr0zq-0000Hd-Fg for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33: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 1pr0zd-0005eH-CR for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:06 -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-253-QaANzqdrNj6PNzO3n9SHhQ-1; Mon, 24 Apr 2023 14:32:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1689F299E747; Mon, 24 Apr 2023 18:32:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75DE3C15BA0; Mon, 24 Apr 2023 18:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361172; 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=6bzvrHL2lSkXlgGLZ3P+hwNCeRaERrJG0E6SXlHzB1w=; b=BDm4qC8H1t8v83ME42vix/PRZR5nrdkLZIRXjyarmGVTj5y1GX6bBuK0zyGxMiQQl5qyRn uH/yltVHYjYbaYlsmdaLiibm1+gYTcpCqj6EWiEY64YUYSvhInTkcNkr2SvuzEz8s4yhku nlrUboG6Md8PO5hvT+sEL/2isVb9ipE= X-MC-Unique: QaANzqdrNj6PNzO3n9SHhQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 05/13] migration: Create migrate_downtime_limit() function Date: Mon, 24 Apr 2023 20:32:28 +0200 Message-Id: <20230424183236.74561-6-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1682361582936100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 45fc5be93a..ee8e9416ce 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2737,7 +2737,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; @@ -3244,7 +3244,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 bf4efd6ad4..ba854f613f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -515,6 +515,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 86bcbb738c..e982103c0d 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 Thu May 9 23:35:30 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=1682361276; cv=none; d=zohomail.com; s=zohoarc; b=S/xcj5ayiRRWisLmhqY5HTZTZypBQjPsd0s99GBE1t3q1Av4MwlMsxhtncwqq33GVsPPnQnsPj/aBsKXb7Wi45AgqETy4I71XSe1GErCpX4x4um0AomBwIE9agko61xoYJtj66Q/K5CUzu1exBNpL82ULmKYquf4ic2XgeZlexE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361276; 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=tPBJogRHOixp3KZKB1TK9lokwpKUyot/J9v/7Ob/qWk=; b=GG9DNWz+1GxsU1QPzv1m1fJcDljVIddtnnFLy0mCHcZ2WYk/Kz4acENwIBr7fyOQG5dCxCAoQoG9q4/tyKaW2/710pFKBvBo9qjzCmiTqfERKL9U57jLBIzjj3holtKC9Wkr7KJXI48n8KsMBlHga0f4XNKpUmO2XVa6+t7XGa4= 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 1682361276546215.30460564729515; Mon, 24 Apr 2023 11:34:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr100-0000QI-Qm; Mon, 24 Apr 2023 14:33:16 -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 1pr0zw-0000JK-AS for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:12 -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 1pr0zj-0005ez-QV for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:09 -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-191-b__nUaQoNAyFHSO5M7tqIg-1; Mon, 24 Apr 2023 14:32:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E908C299E74A; Mon, 24 Apr 2023 18:32:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 578B2C15BA0; Mon, 24 Apr 2023 18:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361175; 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=tPBJogRHOixp3KZKB1TK9lokwpKUyot/J9v/7Ob/qWk=; b=cFTzc9Qkc0ST3+FTj7/q6Q6tw+4LwzHFw2s8IdBi2yy6GK5gZHUqr1Mqg4qm833to8AgHd /PVenABkcXNBltRc8YJOkcY7XOAuwmYcfohQLnsI8ymx+G2hIieEZ062Pk7Bn9qFN+NQut /TxM14OieTmbO6XXe7fb4Ybb4dgXtyY= X-MC-Unique: b__nUaQoNAyFHSO5M7tqIg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 06/13] migration: Move migrate_set_block_incremental() to options.c Date: Mon, 24 Apr 2023 20:32:29 +0200 Message-Id: <20230424183236.74561-7-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361279022100003 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 ee8e9416ce..9a42f73aeb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1164,17 +1164,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; } } @@ -1668,7 +1663,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 ba854f613f..37f7051d9d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -586,6 +586,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 e982103c0d..d261a25441 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 Thu May 9 23:35:30 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=1682361564; cv=none; d=zohomail.com; s=zohoarc; b=EvfP10CRjAp2ExMpvAsGdxY7Wtveqqcvj9DxXqFYQaphlvoHs+SnC475PSVEeLt29+wSQ8SrOKaQ6d7Milg2DgYHRvUqURvm8j6wDxt4RfUbkrDXSrXYaLAsMRc18SrZZommQ2zi3wEepHCdS05AObThVsQZ0QiB4zVtlKy9pdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361564; 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=E64Tn40zeWovsq6afcHVPSfGlPhrtCj7a7by9LoPZNg=; b=lOM2yua5MFyOB2pCCxMihyA6NJDJhoKu7Qnf59p2oE8dyGZKBqPqipaEYI8JJ7+DI4NW8MEsnGkSDBNGZrHWs/W8Tuix7jUe6ZBHaARXD7JP368Cj1eqRMIwIXnsiOwpSZ4+GeEIEZ921T84s9hoSEw+VdL/sozb5Y/2E79Ga84= 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 1682361564054136.69765469292827; Mon, 24 Apr 2023 11:39:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zz-0000N4-FU; Mon, 24 Apr 2023 14:33: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 1pr0zr-0000IZ-RA for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:08 -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 1pr0zj-0005fP-Pt for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:07 -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-Y6MK6emwN2yXrscCbccmMQ-1; Mon, 24 Apr 2023 14:32:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D1034858F09; Mon, 24 Apr 2023 18:32:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 404DAC15BA0; Mon, 24 Apr 2023 18:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361176; 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=E64Tn40zeWovsq6afcHVPSfGlPhrtCj7a7by9LoPZNg=; b=cDn1qqBvaxXTcp6CS9389GlPYqqqa/CH3M+5AAl/D/UY+rjBURDxoYRFz66OHWdiqz8ThE fnu3VPHswXVoNjC16n27A/84ko6GTg4YVIHWHHMV7qfPetaVIR4NSy/LaY40o1Q2YEAybf VU9kzBG4DHfsjUcSg0zLDji26cq621w= X-MC-Unique: Y6MK6emwN2yXrscCbccmMQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 07/13] migration: Move block_cleanup_parameters() to options.c Date: Mon, 24 Apr 2023 20:32:30 +0200 Message-Id: <20230424183236.74561-8-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361566050100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 9a42f73aeb..cefe6da2b8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1164,16 +1164,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 37f7051d9d..26fe00799b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -597,6 +597,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 d261a25441..1fc8d341dd 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 Thu May 9 23:35:30 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=1682361484; cv=none; d=zohomail.com; s=zohoarc; b=WUVZyTqSxnaCilB0djFADUO3zrg+Rht/6DF1UMexgP5+SWVzud/O1P38N+cTCWgwpYn91LMv2Mwk2xuHPW1wdaVntl5Ud+pA/8gmJsHAhGD88trLKe/O0gJrderjJhy/k1AL45Qjtz7JvxCOoGK+Pcgt+t062DTcNkNJNpkBcKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361484; 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=ti9GtCsfNnJl8MnKUt7pMHX10Yyq9XB/R1uh1N2/h9k=; b=GSZ/DHc9oYPU68mqi+fg9Q4oeJ4I03/Gqt9BHJCFqhyqzY/31SGQO/Rk1UeSChvnd7BB1Of9NlPr2kb/oToSEzRVSH++TA6dNWHP3Er9kvrPaq0hJbCtJDBk9If4oJaKNJfzc+tQI3Gyy7yer2VbvoqLywGUOU1hUu/6YmbQvsI= 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 1682361484269216.54057836678055; Mon, 24 Apr 2023 11:38:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr10C-0000XJ-1S; Mon, 24 Apr 2023 14:33:28 -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 1pr100-0000PT-GZ for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33: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 1pr0zj-0005fV-MC for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:16 -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-212-QrQpv8vBOdeVGDelV-xm0g-1; Mon, 24 Apr 2023 14:32:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B08B9A0F386; Mon, 24 Apr 2023 18:32:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D967C15BA0; Mon, 24 Apr 2023 18:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361177; 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=ti9GtCsfNnJl8MnKUt7pMHX10Yyq9XB/R1uh1N2/h9k=; b=h2yoJW7tXDYCY3JtLWGO19+DDlWUuQZy20vEesSsTf2W4803orZConhZFDo+AZYcl52gp2 lJGoM4hOKfpvPRIETXDV2fBPY/Pi6F2nsVcsHzU5T+KOn94RtYIl3UVbiRZeq6njOKt20N +7h9OozVRT+AsuzL0BKc7WGzqFyKUZQ= X-MC-Unique: QrQpv8vBOdeVGDelV-xm0g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 08/13] migration: Remove MigrationState from block_cleanup_parameters() Date: Mon, 24 Apr 2023 20:32:31 +0200 Message-Id: <20230424183236.74561-9-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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: 1682361484542100001 Content-Type: text/plain; charset="utf-8" This makes the function more regular with everything else. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 cefe6da2b8..ef8caa79b9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1218,7 +1218,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 @@ -1712,7 +1712,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 26fe00799b..f65b7babef 100644 --- a/migration/options.c +++ b/migration/options.c @@ -597,8 +597,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 1fc8d341dd..3948218dbe 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 Thu May 9 23:35:30 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=1682361471; cv=none; d=zohomail.com; s=zohoarc; b=CmllJcC4lfBHDpNMVesYsD7oG+O1Yb7JUis1rc7X5fDjxm/lGh7d8So/CzMZ8oMoLGn9hDfpNM0CT9DgKdewMCUSQKEDwDtSWo/fwXxjpRHBn5o2iWJXFzlkItvNcQe3uvodIwJKfE4ix/8mp8Hl4KmnVxqAGMmysjZpyy2WyMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361471; 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=aFsWXkWYvKDo1RKG/5krwiJ3aRMUZbsS04i6nPJw1v8=; b=calCa4i/PTA5a9wudokREVfT4E4H32shI9KMLsPN4FZh3x9/HOEjFzDUpKuAAAYVRci5fxrfghGw7uGIrhh48NhNe6RRmbiGZUMfppVUFF0dqlJxnF+SaLaOoCjvge7ePCzhPgFsT4Ms/Y0/yfz1XI9CAWAGVmfjlFY7uvTRbho= 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 1682361471278171.77511021859766; Mon, 24 Apr 2023 11:37:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0zz-0000NO-Sm; Mon, 24 Apr 2023 14:33: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 1pr0zw-0000JO-BU for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:12 -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 1pr0zm-0005gM-2T for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:10 -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-13-s1oRXhEsMg-BwV18Pw7i2Q-1; Mon, 24 Apr 2023 14:32:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E842101A54F; Mon, 24 Apr 2023 18:32:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1DE4C15BA0; Mon, 24 Apr 2023 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361180; 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=aFsWXkWYvKDo1RKG/5krwiJ3aRMUZbsS04i6nPJw1v8=; b=P78FlnfpwsDhx8qrMDHJK5oWHnE7LDoqavdTCkuEr76IBYTEgffLkjiYyIeNS9Wqo2+Irp gpySnbU2FpTpwcFfHJSdeYYnvS9ob1S3r8A08AhfnrRYpfSqxr92GrQL7FIUHuB8fjE+Vf ywAML2oxpX/IBnALqbdI38WFeeMbttk= X-MC-Unique: s1oRXhEsMg-BwV18Pw7i2Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 09/13] migration: Create migrate_tls_creds() function Date: Mon, 24 Apr 2023 20:32:32 +0200 Message-Id: <20230424183236.74561-10-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361472579100004 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/tls.c | 9 ++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/migration/options.c b/migration/options.c index f65b7babef..9eabb4c25d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -579,6 +579,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 3948218dbe..47cc24585b 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 Thu May 9 23:35:30 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=1682361234; cv=none; d=zohomail.com; s=zohoarc; b=ZMtGYdsXYBEcwUPkulq5MtM81AF4SmJnIxQ5rVaoXnkkV3HaA472G1s7oErO/pHPOupF3VdA9t+GXRqT1EtpgwYsQDkWSF1QfIW4RiN/IQCGfU4IkR+trAfxZ8g5V5E1Wbgk+niAScn6UbCx5RvugaDnA0I/+UuWmvDb4dzsiXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361234; 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=Ba1pQ3UpK61JHzob3pgcqrrXeYlz6aOVT8m4TonLUV0=; b=GnLfMWx5puF6AxNerk+CbZjmY+c+whNaOMEMJirbTW1Nfuh20gvJ2bPjRS5T5wHX94zQt/Wc/bophJAhStXLAW7yHlG/tSf97lcbtsA3dSGkC4zNj6NfB5X4t9fEFhT0LD6Zib1Nif+ibdyjmtGaUtMghqcB3dqa3HZhny03DwQ= 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 1682361234125307.6640878589201; Mon, 24 Apr 2023 11:33:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr109-0000Vu-Tx; Mon, 24 Apr 2023 14:33:27 -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 1pr0zx-0000KT-D6 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:13 -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 1pr0zo-0005iE-KG for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:13 -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-OOmKRERiOSK7MzVSiF2OoA-1; Mon, 24 Apr 2023 14:32:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D807800B35; Mon, 24 Apr 2023 18:32:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id D01F7C15BA0; Mon, 24 Apr 2023 18:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361183; 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=Ba1pQ3UpK61JHzob3pgcqrrXeYlz6aOVT8m4TonLUV0=; b=EquzkGJLg4bUwypasF+MVDlV0SGjdh6wBmnYuY3bHf877+IVn26n3bUaZbHBgDlj5NfETh KU43u1rzFWmlQ3R5fvBbV1Gym6e/8/5IG+96fcPYCCx7uFlZ8SwTOA4esd+j5vxXipR06t 8/6C1ps8mFJadA5BQNXF3sgxdeUvgOY= X-MC-Unique: OOmKRERiOSK7MzVSiF2OoA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 10/13] migration: Create migrate_tls_authz() function Date: Mon, 24 Apr 2023 20:32:33 +0200 Message-Id: <20230424183236.74561-11-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361234698100001 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/tls.c | 5 +---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/migration/options.c b/migration/options.c index 9eabb4c25d..9e19e4ade1 100644 --- a/migration/options.c +++ b/migration/options.c @@ -579,6 +579,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 47cc24585b..0438c6e36e 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 Thu May 9 23:35:30 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=1682361573; cv=none; d=zohomail.com; s=zohoarc; b=asme9Cf//BM+VAhXbU55Bid2SInSs9+pvKwudvOqQYT0YswZXS6ItL+1LPiupY/P5kL0oqXGBVR1HtIpt8JICnfDrWZTQV0rbjLzapnm8tdGe+IvBFTEi+fzpSbNpykXFug7Ch4tP7yzP3T68LZ8K828WO7+CRCGGDcO9Z8Nm/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361573; 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=96+8aW/1YdYP1tAgTftqvfRHbLPBaKtQPI3Z761iPLY=; b=W1aH7eg2EiVzkDl7Ct8bm0nXvvgtv+uw1H1Vm7cTNcPLNevrPnq/paV91Xcf/PmHqBI223NZ6oJ1PlJFTdgoWZp9L4EXXPQDWJ7PJ3oLwjuhnXmURW05g9VJUhGP7OCGTIhpOMjF2tb2xY+ZicsUODvcjC9zx9oGSUuMEzNjvt0= 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 1682361573897425.65686123031185; Mon, 24 Apr 2023 11:39:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr101-0000Sj-W5; Mon, 24 Apr 2023 14:33: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 1pr0zx-0000KS-87 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:13 -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 1pr0zo-0005iN-K6 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:12 -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-538-Pmhx3A_GP--uflaCEyAsmA-1; Mon, 24 Apr 2023 14:33:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4BE5D185A790; Mon, 24 Apr 2023 18:33:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE092C15BA0; Mon, 24 Apr 2023 18:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361184; 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=96+8aW/1YdYP1tAgTftqvfRHbLPBaKtQPI3Z761iPLY=; b=TX5BsELmygc1kaMM8VAYRUuw+1SIHBi2O8gKSrZmBAewEIojRjR2KAIOgo8MOEICQFQPbB LDPy84UYpuiLQokRESG91ZGg2TKzjB1OVMyro63ZB4ggX8CPN3AgGH/cMGV2Gl3+484TO7 dcX1ZtpQRj8p6dZ0PEnSsk4+ee6MzZM= X-MC-Unique: Pmhx3A_GP--uflaCEyAsmA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 11/13] migration: Create migrate_tls_hostname() function Date: Mon, 24 Apr 2023 20:32:34 +0200 Message-Id: <20230424183236.74561-12-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361575000100001 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/tls.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 9e19e4ade1..9fbba84b9a 100644 --- a/migration/options.c +++ b/migration/options.c @@ -593,6 +593,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 0438c6e36e..9123fdb5f4 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 Thu May 9 23:35:30 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=1682361567; cv=none; d=zohomail.com; s=zohoarc; b=Vf7/ygYaxqv1cm4sL1cU0qofHczbI5qPEukBv41+CZiiN7OYPVCiiFaY5HIIw0bl5+/ujYCq+cUgvcoJ7+aFwY0e5vLp3VwOPSEpvzuq+ZZI+O5c6zsUfovZghRXint5iwIa5y+BZc8n9Hem3klQSL+z1FSLKw35eFTe3s8Bfj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361567; 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=PCOZmeLg085koFak2iLl5O8W3REZyHURw3hrRF/OXzQ=; b=hbX2mkqMn4S50XEpdxrhkqYzG0ButUvdtPi1pHLqDepm4eqfy1gBJT9uiFfysKpVueqrpT4fULw4TmzD7kd5Q49JjAly1Cowf9zEdQ5TcVbC6RZGhl9Pk2CrYKkgZCVi/GLMqfWwHl764JILhHqqSJ9IIzYqgpVkAMb55QcjYwo= 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 1682361567935878.9541365358737; Mon, 24 Apr 2023 11:39:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr108-0000VQ-4q; Mon, 24 Apr 2023 14:33:24 -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 1pr0zy-0000Lx-O0 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:14 -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 1pr0zp-0005iW-0V for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:14 -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-621-lolCXKiOOm6bCPgiPC5Ivg-1; Mon, 24 Apr 2023 14:33:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C2C01C05AED; Mon, 24 Apr 2023 18:33:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CAA8C15BA0; Mon, 24 Apr 2023 18:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361184; 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=PCOZmeLg085koFak2iLl5O8W3REZyHURw3hrRF/OXzQ=; b=KSWM8DQa+4jcFUl2xx92aGSiMwVCuaMrk9UTXMBkMGyuHsD6KijLrZsgVvpPeF1o0w3aBF wHF8/XL83c8/y794pf/eaj8w6bJT+puqYLBpiup3hJs+i6nL2uovITV3UveGWKupNZ4slJ WN8A6Vwk9zUIX1PgsngxOd0dz3ILVrU= X-MC-Unique: lolCXKiOOm6bCPgiPC5Ivg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 12/13] migration: Create migrate_block_bitmap_mapping() function Date: Mon, 24 Apr 2023 20:32:35 +0200 Message-Id: <20230424183236.74561-13-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361569079100001 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 9fbba84b9a..ec234bf3ff 100644 --- a/migration/options.c +++ b/migration/options.c @@ -452,6 +452,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 9123fdb5f4..43e8e9cd8f 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 Thu May 9 23:35:30 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=1682361372; cv=none; d=zohomail.com; s=zohoarc; b=IoDQi+6eD4LIm5sVA74m/v0iAFqSYHhPostwsiX2F18owC12u2+JzAOWqE1Mn4Fl5zGuWSwX8hhKkpzTLGWXwmIYuBWzjJqaWf3yqPDxAP7MDJMhrxosixoU0qi6s0AL1IyCXsqa3pMUAMZvX1cFqSRWCSqvrw0gmpEwl/msn+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682361372; 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=xFO+fsMV504a1TAHI7pLu6aUX2FkQ/+HnPrH5FbsJys=; b=E4YlJcpmTttBC2E8AUDScIiQ9c8S5JZ5UCkngy8uW9eVdaL2JbOAq8Yxz7Zpfgb3O77HJkYSb+ZbKahESA2sQU6UX1YQH+c2/pOezPT97ikr2dJbyeOn8uMKk6gV8p20lQ4Mxwad2tnOyzNk9vbs0QBOwSarXJ6HFeAfQcDZ6zs= 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 1682361372441752.2884675885718; Mon, 24 Apr 2023 11:36:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr10D-0000Xb-LM; Mon, 24 Apr 2023 14:33:29 -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 1pr100-0000PW-Ib for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33:16 -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 1pr0zq-0005iv-FP for qemu-devel@nongnu.org; Mon, 24 Apr 2023 14:33: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-131-aReU_uB6POyRrLpwhe_TTQ-1; Mon, 24 Apr 2023 14:33:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D3521C05AE4; Mon, 24 Apr 2023 18:33:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D5F2C15BAD; Mon, 24 Apr 2023 18:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682361185; 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=xFO+fsMV504a1TAHI7pLu6aUX2FkQ/+HnPrH5FbsJys=; b=dnaOBLK/eOxNEfKfxw1IJQlAM67hX+jDj4DXE2Vx1XMigNJFFp8ZXfeeknbgqD4/BQU1js pqkWaRayRENkHWv1CtI9kj/Q0nqM11WzIcFnDnz27Rx7M2nO5Hc+gAVRqbDp6rG0UX5TCd 3wi/PuK7PpiMyxVXKGsU3s/6uHHs7y8= X-MC-Unique: aReU_uB6POyRrLpwhe_TTQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Vladimir Sementsov-Ogievskiy , Leonardo Bras , Stefan Hajnoczi , Fam Zheng , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Eric Blake , John Snow Subject: [PATCH v3 13/13] migration: Move migration_properties to options.c Date: Mon, 24 Apr 2023 20:32:36 +0200 Message-Id: <20230424183236.74561-14-quintela@redhat.com> In-Reply-To: <20230424183236.74561-1-quintela@redhat.com> References: <20230424183236.74561-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, 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: 1682361373771100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 ef8caa79b9..3adcdfe286 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 @@ -3317,116 +3270,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 ec234bf3ff..70067d11f4 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 43e8e9cd8f..5e47d975e2 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