From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609110; cv=none; d=zohomail.com; s=zohoarc; b=OSPQUHx1sDgwBXIubEmdm7na5ncc1jpNcHwhB/pMogRTlToXkmOSxlPp6gfBc1QFPqccesV07X7fnkDdOhdnskz76EmWCgAlsE5Z5sQ2g5id7YX4y+8n0XtS+nonswjlxeSjB4rc9Jrr3Q4cy/fMphNXkgkANfmFj6/qPrBP+Wo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609110; 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=PQpgk7lNqT3xVM6FKBaQC1Fxp7Zpv/+jZrQHV2ROIbc=; b=dqa3I0BcIrpGr2JesM2yTV2/pky7PlCLXGXqIx5LCMgUKBbkmoS8vLBibK789k28CAZ/3g/7P3u1yYk5NpcmEiYw2PNUE8fQ9ZrqtZLmNtBZRsqNT97AFfjH9SEHY3H1Db++fCg1dMhhyWr6uakTBXnWJPzRpkVq6zFMpVWcDJg= 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 1682609110027794.8264749762737; Thu, 27 Apr 2023 08:25:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3UJ-0002S3-G4; Thu, 27 Apr 2023 11:24:52 -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 1ps3UI-0002RO-06 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:50 -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 1ps3UD-0000Wd-FH for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:48 -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-606-8sK5Gs-AMnm3E2Y3QNShFQ-1; Thu, 27 Apr 2023 11:24:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F88A88FBC3; Thu, 27 Apr 2023 15:22:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E3AC40C2064; Thu, 27 Apr 2023 15:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609083; 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=PQpgk7lNqT3xVM6FKBaQC1Fxp7Zpv/+jZrQHV2ROIbc=; b=Ksin7jvi2Z05RKqzaWRMQub/E6qx6xM3Ytg1MxHKAWkFtNbToM/ljLxmOpNUh9g1nhvHMQ 2n+l28QjiOUdG+hAhtIiSD8oWFQ01R7a9KufbZZ1RD4uSQZgTh50BnREv05aDA2qLaUgs/ geTs1MDtW9YSydUt6UTz+po4VLyRrpo= X-MC-Unique: 8sK5Gs-AMnm3E2Y3QNShFQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Fabiano Rosas Subject: [PULL 01/18] multifd: Fix the number of channels ready Date: Thu, 27 Apr 2023 17:22:17 +0200 Message-Id: <20230427152234.25400-2-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609111645100001 Content-Type: text/plain; charset="utf-8" We don't wait in the sem when we are doing a sync_main. Make it wait there. To make things clearer, we mark the channel ready at the begining of the thread loop. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/multifd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/multifd.c b/migration/multifd.c index cce3ad6988..6a59c03dd2 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -635,6 +635,7 @@ int multifd_send_sync_main(QEMUFile *f) for (i =3D 0; i < migrate_multifd_channels(); i++) { MultiFDSendParams *p =3D &multifd_send_state->params[i]; =20 + qemu_sem_wait(&multifd_send_state->channels_ready); trace_multifd_send_sync_main_wait(p->id); qemu_sem_wait(&p->sem_sync); =20 @@ -668,6 +669,7 @@ static void *multifd_send_thread(void *opaque) p->num_packets =3D 1; =20 while (true) { + qemu_sem_post(&multifd_send_state->channels_ready); qemu_sem_wait(&p->sem); =20 if (qatomic_read(&multifd_send_state->exiting)) { @@ -736,7 +738,6 @@ static void *multifd_send_thread(void *opaque) if (flags & MULTIFD_FLAG_SYNC) { qemu_sem_post(&p->sem_sync); } - qemu_sem_post(&multifd_send_state->channels_ready); } else if (p->quit) { qemu_mutex_unlock(&p->mutex); break; --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682610337; cv=none; d=zohomail.com; s=zohoarc; b=SOVAGS1iImhFg/1fSSPVPzTGhpUa9HZM9t0E8dgRkwANJiIrXVBTwhWRQdfO7Dr/kCUVK8aGdM4mlxVhFqjcfgzZjWtIY+S0io5GmhNu+HdSBhzoHIc/oZV6WrujZkzvz04mpmQ6IVmDl+xt3S5eM354m6gkJS3noz4CcsHnklo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682610337; 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=8IJ7Dhy9FpdFSc2wzLnlGqo4QmLJny/q8vlZoSt/qEA=; b=kAAFQk3HlSpoh2jYF6CrsvY2TwNUgbY5EFNib2IBTO3W/1tJua9f9SHrfuBXcRUjbyQ7QVXetQWqsrhYftb3Pg+/z94Fmy11ObnjknE+qGHDDyzn8uLQEQ/cVDPgocZ0Z2Xi4OXX5erxQNZ49CYJs4HZMgQXs/zbV96MNAAvup0= 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 1682610337946534.433333403898; Thu, 27 Apr 2023 08:45:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3nu-0001jL-Kh; Thu, 27 Apr 2023 11:45:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3ns-0001iY-9i for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:04 -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 1ps3nn-0004W4-Fa for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:45:03 -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-7-mbKBgUOlNIqh-H7SimALww-1; Thu, 27 Apr 2023 11:25:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A1EF8A011C; Thu, 27 Apr 2023 15:22:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id E235140C2064; Thu, 27 Apr 2023 15:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682610298; 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=8IJ7Dhy9FpdFSc2wzLnlGqo4QmLJny/q8vlZoSt/qEA=; b=YJzY6pf+teZ0p22cDxCjxQ7tjESVkWF9zT04b5od+36xSLMsu4Anvh70V395LP9So+ozAb RZur8ab5CGSQNNSd/oLRnh8WneQ3Znx5eUvSLhcQ8HPDXGk+SXhlVKgTezHhv9vTkTAhB8 Gwaom/2hq2oexQCdxNmdxeqidPKiRm0= X-MC-Unique: mbKBgUOlNIqh-H7SimALww-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 02/18] migration: Create migrate_params_init() function Date: Thu, 27 Apr 2023 17:22:18 +0200 Message-Id: <20230427152234.25400-3-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682610338771100001 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 c6030587cf..552e8d8e5c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -741,6 +741,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682610619; cv=none; d=zohomail.com; s=zohoarc; b=i947ENgg4aQbb0O3LiOEN7F5FuBGk4iPwnHRbWoRXdv32Vxwj/6k58pCirYzLKEmOYu1SUXs4K02xhpZ6rJ7totjPfZsAS8MoZVo5endRbOqsZfQPF8rWnjkR1wwNJBdnBLjPIzmZo/SlREKxm7IEIRpIyub6fEDtMF1MZZiS2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682610619; 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=5rCbwUMQ+xaJ6xgaKifwGKtFDaA9sxo0D+nMtAHdLRA=; b=kQWpsPFihSgAxGb61XsuyI2cdBDPIgzutnCqiyI0gkzJolYANyayi1909Ru5JioSB4cYmaScKXmKg54dNr541CNe/q84W7CMK+N7cQ43WfoaI4oBbWpJUPELskKWqHmLqKZyKJUKboz0SAt9ZZv5y4dXVC/hvVhisQzajuv1bkA= 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 168261061924793.25818610736849; Thu, 27 Apr 2023 08:50:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3r4-0008UA-I2; Thu, 27 Apr 2023 11:48: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 1ps3qL-0008Hk-Ra for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:47:38 -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 1ps3qC-00055u-Af for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:47:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-dfN40ueLOlql0bjfyTHPqA-1; Thu, 27 Apr 2023 11:25:11 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDCCC8C447E; Thu, 27 Apr 2023 15:22:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8126D40C2064; Thu, 27 Apr 2023 15:22:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682610439; 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=5rCbwUMQ+xaJ6xgaKifwGKtFDaA9sxo0D+nMtAHdLRA=; b=QuL3sJumuFhBUCSPiFngzpY8vkZd14kimQgBWO3B3mf6VCucF8p8wAOuid5nGihtx3imGE oR01zUgXahRqdCIk3OmvonxrqkVmVh+8EVKWULD5xjCPQ4e1GymPiiNb1BuQoXZFAav09e nqp0M1Y0hOcQb0+pWmEMuehZRpo86pw= X-MC-Unique: dfN40ueLOlql0bjfyTHPqA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 03/18] migration: Make all functions check have the same format Date: Thu, 27 Apr 2023 17:22:19 +0200 Message-Id: <20230427152234.25400-4-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_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: 1682610620764100001 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 552e8d8e5c..0b1b56e68f 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; } @@ -496,126 +457,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; @@ -623,36 +556,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609097; cv=none; d=zohomail.com; s=zohoarc; b=fnRT2qTFbDnhsMbI/+Upg1SVzGLMg5h238Rerm0NJuvXv16j2uw9sd55FY2AOkhfQIuXnqDeX8gTG9iMmWYKURb67CWUYnWJlIfAzC8TIIPs6VDtajJrbHZcp+MkwlsSycmAXOZxAtkAgVoiBbl1QOfgLC7dH+Z983ypEv45mac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609097; 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=nD6TnT3S1BzkTUrct6jJxmsb7FXZzALG/b6ZSeshf8U=; b=n4pziV5W3+1kUWwyKPPpvEK9r+2uwewV8pGWaCBmi/p+uNCovKSVwpAIhNab89qkEb5hMMIHRUHB2j+PZzJJM8Y4ZH6tCkOJdFii4qOeXHKxt91rzvchtU9KwNac2MdWfZjupvNwYFklzKURMTX+y0obI2ykGEJvqVtrqFJvWMM= 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 1682609097745755.0383061213029; Thu, 27 Apr 2023 08:24:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3Tb-0002Fa-LY; Thu, 27 Apr 2023 11:24:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3TQ-0002EY-W2 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:23:58 -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 1ps3TN-0000Pq-IA for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:23:55 -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-76-Bo0VaG4OPki1StTZUkPkvA-1; Thu, 27 Apr 2023 11:23:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BED208A5E3A; Thu, 27 Apr 2023 15:22:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A6DD40C2064; Thu, 27 Apr 2023 15:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609032; 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=nD6TnT3S1BzkTUrct6jJxmsb7FXZzALG/b6ZSeshf8U=; b=Jre39R1MPtKov5zbaLWjFRIX2ap6SdbG2F2UUuT2xcnPFZY9BLGBDZ3AslzR3s/1vunHYV WctHVSgD/922YQ3NfOW99fwUweJVaCfHF0YdYgoJQs9Je8889NyE3j/h2GEzcntZ9ZV3tP O6efOuezLYlVXU8tbAEoWSGZG8YUf5c= X-MC-Unique: Bo0VaG4OPki1StTZUkPkvA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 04/18] migration: Create migrate_downtime_limit() function Date: Thu, 27 Apr 2023 17:22:20 +0200 Message-Id: <20230427152234.25400-5-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609099924100006 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 0b1b56e68f..f4ffe99603 100644 --- a/migration/options.c +++ b/migration/options.c @@ -518,6 +518,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609222; cv=none; d=zohomail.com; s=zohoarc; b=ObgW7WXUVyJmHMuq863HChS8AbHKywP/V/MoXyiHOQrBg+R06ijiLIhj84JjVHVGqkFtfz5yGI7dprtbws8wBbanevHAUgYPeO3TrlDCvcRLwoQqOrgbW2tmJ110LSpZN52UyTXNsBYoVEuz1s/8KeqFPlcH8jWvTEoHUgCHi5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609222; 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=sfNeHbiI2MiO2Acmx2RBKYkwo3iN5u11gyx+ywSHK3A=; b=UmF7JBZ0e9p5Rizcxy6uiofrE3B3QjJ3BLkCG9BBnadbvhnbiAvkQ51n/3QAmdLaHiKqIqzekHbV+aTyRVm62j4UptJVcsJytqrb+fdqGUA4YbOA/fxg6Pjoiw0HAA8u4C7hRBzEcfM+/ynREGCxvGWsUFfYPD34bPHRelo8qRo= 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 1682609222063952.981325472151; Thu, 27 Apr 2023 08:27:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VV-00049t-6d; Thu, 27 Apr 2023 11:26:05 -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 1ps3VI-0003hV-2e for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25: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 1ps3VG-0000d4-2O for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-d4PgdseVOhiPJSFBRle3oA-1; Thu, 27 Apr 2023 11:25:17 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A47A1381D4F1; Thu, 27 Apr 2023 15:22:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1859740C2064; Thu, 27 Apr 2023 15:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609133; 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=sfNeHbiI2MiO2Acmx2RBKYkwo3iN5u11gyx+ywSHK3A=; b=DCUoFIws2jQ9ksvU+o7ub4FjKk0xHWTulgKlxjSme9ZdkqUfA68Z/OaC689/rtso6SMs9d hvuqSa8v8slS5bEvJ2VniweEV3b2mBsdYZuQ1F856LvkAxltlbW0g9So/AmZ4cI8SFCe/o 2yOHKfxQK2eGmDOKTqJsNMZ9wr3yjq8= X-MC-Unique: d4PgdseVOhiPJSFBRle3oA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 05/18] migration: Move migrate_set_block_incremental() to options.c Date: Thu, 27 Apr 2023 17:22:21 +0200 Message-Id: <20230427152234.25400-6-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609224243100003 Content-Type: text/plain; charset="utf-8" Once there, make it more regular and remove the need 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 f4ffe99603..89508d91a3 100644 --- a/migration/options.c +++ b/migration/options.c @@ -589,6 +589,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609130; cv=none; d=zohomail.com; s=zohoarc; b=diweYrO8/h5xz6ZVegrP7Ypvc+dhXHn5pmEiYqIkI+Td/fQxWpdKzEoqs3BA4KjEf+BndWtJO8Qg1XMn4gy8UZ4dbSAOIhbzMaaMsxtwixdvwj0d2U0ellHlbV1Aa7A1WXjW811ohu4k45vvZp2HaYfeaL5mo/lZr0Fd72lbyks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609130; 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=IhIPpR9Bu41GyuzHdX8ZAG+v3LYFnGZh8qcrYbmxNys=; b=XPVHmG/4KMbhRjJu60pmLjeqJTUS3T8igkb5GOYcrca7GD2mwrrNSRjF2UBw5FixGYQD2SCEOlyeLJCW4Xa58TCrgwErsO1Dht+iFG3XPmyGwhPkk69E+lt2mw53pS/3QjfyN3olvLadhlOuT4Oul3VTgy0KFGTj7049wh7h0ck= 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 1682609130161746.0771370524707; Thu, 27 Apr 2023 08:25:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3U9-0002Nm-Hs; Thu, 27 Apr 2023 11:24:41 -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 1ps3U4-0002LC-TF for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:37 -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 1ps3U3-0000W7-Ep for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-161-rctdLsoxMeuJ3Jok7CGjGw-1; Thu, 27 Apr 2023 11:24:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E8648C4597; Thu, 27 Apr 2023 15:22:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA1E140C2064; Thu, 27 Apr 2023 15:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609074; 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=IhIPpR9Bu41GyuzHdX8ZAG+v3LYFnGZh8qcrYbmxNys=; b=hVem9AXLB5NBc942qgEyYbQbucJVrEW5pL5lo0Rgba9TjvXQUDR3HFlo91ypNN1tHWMdsL NTsJJNntz7WY7Bg6+F1tDtfGp8EMyt3c7C+IZWzU1juyZoN8VyaBlCpVaCStLFtnRfz+RZ K0c50LvlasYaDEJap6f4mzf4Z9GY7QI= X-MC-Unique: rctdLsoxMeuJ3Jok7CGjGw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 06/18] migration: Move block_cleanup_parameters() to options.c Date: Thu, 27 Apr 2023 17:22:22 +0200 Message-Id: <20230427152234.25400-7-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609130862100001 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 89508d91a3..82adbf35b0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -600,6 +600,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609200; cv=none; d=zohomail.com; s=zohoarc; b=F5V2Cbl7iOeZNoCID2H6VLMswOAHHMiq92R4HZIs9lQZ0nmivV+xH1z3Wi5VqCTmnZXw/WQdwXtmMJgIMGyDoe1kmkU8jgnXXTzh/b3+fN/fN2yGN/ln0k78jpDXV4ZVhSZYuplQ1ldgF5U1bbOBwsC07uqI3vTQwpsgpWQ9MOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609200; 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=BfCoqVaK033WOQO+UgvXOcU/Q1wZAphrF0sXCzWC3Hw=; b=AeyqkSkilEd/2yd+pM5psUBUqHaEHpBcWxDpEuJwpN/5EWsmI9rzNWRO/w3dJ9sPuDmCYkY9DRWPmp5OiLcM7DAvcraomDXtli2Y8+KJX3lbO1Ff6qz0Lb+Ywyr1s39p/xvOavdWcPiLryWdYrQsKdfwdDAsHxVUT9DBIeGuSGI= 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 1682609200141945.3598898613681; Thu, 27 Apr 2023 08:26:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VY-0004nu-Fv; Thu, 27 Apr 2023 11:26:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3VS-00042G-DO for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:26:04 -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 1ps3VQ-0000oc-Rm for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:26:02 -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-449-kW97KUGcOiuQnqEU8syMiw-1; Thu, 27 Apr 2023 11:25:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E0133827318; Thu, 27 Apr 2023 15:22:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9977D40C2064; Thu, 27 Apr 2023 15:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609159; 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=BfCoqVaK033WOQO+UgvXOcU/Q1wZAphrF0sXCzWC3Hw=; b=CYCaU0REET/xOMdY1tioB2+CwW957BYwHFv3UWA9N+ch0IIfl+aBevAmcpYuna5bmvVY88 xBMMVOlD9S1ElMdx+lcoemLUBAEDQ+uH7OA7fOo3y447w7zis17y2Ny1hbc3jozpV6Zuqx 6bqJIM4hSATGc4/hc3GTL0xJZFCsN8w= X-MC-Unique: kW97KUGcOiuQnqEU8syMiw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 07/18] migration: Remove MigrationState from block_cleanup_parameters() Date: Thu, 27 Apr 2023 17:22:23 +0200 Message-Id: <20230427152234.25400-8-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609201964100010 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 82adbf35b0..da99c6298f 100644 --- a/migration/options.c +++ b/migration/options.c @@ -600,8 +600,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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609225; cv=none; d=zohomail.com; s=zohoarc; b=gXgmJ86RpiV8xsnha8C4FnI7/tUOffM7c3VJ4B7NkkxXFRjFLl7BAib/AAmlUtoWsjgrQzkcHeUyrvX9xl+Dpi0c/aXa5s5bc2Aj8LH8fDGNlP96SW6qnbwVGVGGkKK0b9sB5i0OtJ+wxZEiQj/qpgZzbTigSTnWFMKRHkMjSxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609225; 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=0fkOtRm1l7YBiell8DjUtenZCBbR09zDEB8QCUZwS5E=; b=jVnqueaSJQsWVRgJfY+g/OREQbVEYEeIrYr4XTYfQe5421Drk9ylf56ZYWkJEt3blYjpU+em0rF+EuMeCf/IbXIdaolZ+wcyBW9iamkwyCZ3TeiwOz1uXYQVEHhIS3szA6ppQ/M0q+NCMnhTFLtDGP8wM48M/zfnd7uSXf4HIqQ= 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 1682609225756240.23144476584002; Thu, 27 Apr 2023 08:27:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3WN-0007zZ-Aj; Thu, 27 Apr 2023 11:26:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3W9-0007hI-Ic for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:26:49 -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 1ps3W7-0000x6-Kk for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:26:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-XrhCSlNyORuSG7RDt4Bd_g-1; Thu, 27 Apr 2023 11:25:35 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C3498828C7; Thu, 27 Apr 2023 15:23:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50EE440C2064; Thu, 27 Apr 2023 15:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609202; 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=0fkOtRm1l7YBiell8DjUtenZCBbR09zDEB8QCUZwS5E=; b=GTNLSoRdJngudxRjZ3/DIOK1B7wU8M1/dEw/mCH4swC/tDqcTZ0CyuEd3FXwGPgMLYVcfI 04C+WpP8gNS6NNa5e1CGWmY/rm+RTRlsw3fogHXy0HkY95X/tsE05SG4pmS9LOiAGFhSUS ZYhrDxdE+NNHk99zjFBmeVACgU08jkc= X-MC-Unique: XrhCSlNyORuSG7RDt4Bd_g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 08/18] migration: Create migrate_tls_creds() function Date: Thu, 27 Apr 2023 17:22:24 +0200 Message-Id: <20230427152234.25400-9-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609227326100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- Moved the type to const char * (vladimir) --- 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 da99c6298f..b5d4ebef8d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -582,6 +582,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +const 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..4603ac9201 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); +const 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..6e70887699 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -34,20 +34,19 @@ migration_tls_get_creds(MigrationState *s, Error **errp) { Object *creds; + const 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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609792; cv=none; d=zohomail.com; s=zohoarc; b=KqyCuBSK4MwTAgfoNY1WzCkQImtKwO8fX7RNRyn17Tj8VCt5X0h5qO7UiYOEkkBy+EQfGRrWx+qulR/5hPyIc3eeXM2dcbZSfx4+FkYask7Lf7SsafdO3G39DpRuUV3zIXTeinOO+wi/BWpWvcnpFfbkltE30Km1XOoG1Ig9080= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609792; 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=Vqht4/SshJAYRjHL6cT5pnap3UySXvxESK5Qnytk2xc=; b=PCgHwLJD2Q1MLt6MlZg6mvZWtRMFeo3mZUMw6nAVsJNps2xDqHNL3obmaL1hzpgd5vULDnuLPAn2EmH7wZPVA2XS/BwEZrsT/cQHFLfx/ps7VP8uBdffhOVbRQJ9BBYIo27EcfX/qQwYYBZTgK35x8uyn+Y6rVK8XWZNacAQJJY= 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 1682609792517195.88287687534296; Thu, 27 Apr 2023 08:36:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3fC-000764-Nx; Thu, 27 Apr 2023 11:36:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3f0-00070i-GI for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:35:57 -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 1ps3ey-0002yX-SY for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:35: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-496-_A1tcJfcPHqZYp_G0tUQ6g-1; Thu, 27 Apr 2023 11:35:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E009C29AB402; Thu, 27 Apr 2023 15:23:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEDF340C2064; Thu, 27 Apr 2023 15:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609750; 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=Vqht4/SshJAYRjHL6cT5pnap3UySXvxESK5Qnytk2xc=; b=NzGRqjqcfUoYvzq6WycPE3F20cwrMof9tk71NJPB4coOoUHVi5wVOZ0mhhbr7cQN1Fc7dh UApvJjZ9ya+0843+la6ssQw+P7RK6ockrVeKJ23cOGer5/pWUL7/ojBJ2o9GHfaBFOUECC HUiK1PZ8A1X2EODkvnaLjQIaq5EZ9Fo= X-MC-Unique: _A1tcJfcPHqZYp_G0tUQ6g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 09/18] migration: Create migrate_tls_authz() function Date: Thu, 27 Apr 2023 17:22:25 +0200 Message-Id: <20230427152234.25400-10-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609793573100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- Moved the type to const char * (vladimir) --- 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 b5d4ebef8d..014aecc9ee 100644 --- a/migration/options.c +++ b/migration/options.c @@ -582,6 +582,13 @@ uint8_t migrate_throttle_trigger_threshold(void) return s->parameters.throttle_trigger_threshold; } =20 +const char *migrate_tls_authz(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->parameters.tls_authz; +} + const char *migrate_tls_creds(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/options.h b/migration/options.h index 4603ac9201..987e639a49 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); +const char *migrate_tls_authz(void); const char *migrate_tls_creds(void); uint64_t migrate_xbzrle_cache_size(void); =20 diff --git a/migration/tls.c b/migration/tls.c index 6e70887699..184db4d7bf 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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609097; cv=none; d=zohomail.com; s=zohoarc; b=Qq+YCYYxpyO3KtIHo3jyUUVxJn2WLYn6kXaBvJwD9fB5AE8L+fvoYs6Euaa969mq7YmLdky21r0ToHotpU2VDGPE+Qh6ARlTKaOMxp2fe4bVrpCF/CjWGoZE4B2d+Ru8EDf0deW1aYawq8JlJ11KCzcPgV/6/0pkr9G/KywVPI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609097; 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=BGDvRr0VMOFF07iehFiiG38Rpy7KD/E0KTE/DE3D1NE=; b=Z4zOtjMDUNNilD4ACTwQw4jbQsJRVx9bISH3jGPrxMIAJeZzYmtzI7Kq+LH1GD6EJWZm371tTYGu1uNgjsdjmmva+k5umoFyXSokRN/BJ1b+unY5NiJd1ghNTRb+NAm5Ib9D+qwbDvYIQ7zaa6pVDfdgXg2/vzITgWCAbsqh2+Y= 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 1682609097650158.11089927144883; Thu, 27 Apr 2023 08:24:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3Tr-0002JG-HM; Thu, 27 Apr 2023 11:24:23 -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 1ps3Tp-0002Iz-Vn for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:21 -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 1ps3To-0000UY-HN for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:24:21 -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-279-ItjEUXL4M2SRKcGTVG_Zkw-1; Thu, 27 Apr 2023 11:24:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA01429AB44B; Thu, 27 Apr 2023 15:23:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31B5E40C2020; Thu, 27 Apr 2023 15:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609059; 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=BGDvRr0VMOFF07iehFiiG38Rpy7KD/E0KTE/DE3D1NE=; b=VrVXoaw3Oispk6mXRc9arn+rRSBYKNi+7j3joxvNnmIee/wSOcevqeHUsP4I4RdKiJia/T ZiFZmzGlurKm23rPB6AZHdJF+r+cTTFRKXaz6M3IQKlC4MZyb631SOBO4sbUFU404E2NzP 9+M5p+fp1946GioVtx5gauzxZQqWxSo= X-MC-Unique: ItjEUXL4M2SRKcGTVG_Zkw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 10/18] migration: Create migrate_tls_hostname() function Date: Thu, 27 Apr 2023 17:22:26 +0200 Message-Id: <20230427152234.25400-11-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609098878100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- Moved the type to const char * (vladimir) --- migration/options.c | 7 +++++++ migration/options.h | 1 + migration/tls.c | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/migration/options.c b/migration/options.c index 014aecc9ee..1aa9575bc0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -596,6 +596,13 @@ const char *migrate_tls_creds(void) return s->parameters.tls_creds; } =20 +const 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 987e639a49..819c1b1ce3 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); const char *migrate_tls_authz(void); const char *migrate_tls_creds(void); +const 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 184db4d7bf..cd29177957 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -130,8 +130,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; + const char *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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609548; cv=none; d=zohomail.com; s=zohoarc; b=UJkbJZBCHUi5pnYGz1MaMKctXzCEgfL6b+RTlGq9QbTrYhl2yQQGg+f348nAMD85cfXe9g9iDMEJqD1N0+PFSElZ5PThik7LXJYL5N/Pr+Kfe3pWdt+P46emeO1zPwZcODjvQ4soFSgydETXOe6A+b09nhtsjYlh+xPD8INnSo4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609548; 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=i7skA55+tk9J5A4J7Sib48+3yON9eSySa3BPVsEIMz0=; b=RZbxrfcd+Yk84htskM45oWHWgukqJdDyjNAPRYXWjqzvaBKZxi02c6Y/TUdsGVGQ9UYlTxBuqVZX9nyKnUfMN1899Qu7xnrHIN7aK7fuSYnO0yMmL7fy4/0DOQ0ea4OkkyNvM7eVIrl1p22TRZbJjwnvjG1wjQJGwwF/Yc59n2c= 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 1682609548759788.4321061862051; Thu, 27 Apr 2023 08:32:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3bL-0005sq-DY; Thu, 27 Apr 2023 11:32:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3bG-0005sM-M3 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:32: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 1ps3bE-000224-TE for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:32:02 -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-231-bUuxsyDpMmu-qizPZLo72w-1; Thu, 27 Apr 2023 11:25:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E3B718E0A95; Thu, 27 Apr 2023 15:23:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id F02DC40C201F; Thu, 27 Apr 2023 15:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609511; 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=i7skA55+tk9J5A4J7Sib48+3yON9eSySa3BPVsEIMz0=; b=e9D9VqfzikGgygoxbeuYunOiJK99fywNPcY/Pf4OpqJru3+y/n6/+pWSocwte/vsJ7zIgi 5aSMG5pzmgG2THaXiwXT7COJkjW/v2QNUpLyfU7YvY30KSQGfkD42hVzhmAbYWgsj05epx vPaJFBc563GWwW6c8FpJB0ZuO9E2nU0= X-MC-Unique: bUuxsyDpMmu-qizPZLo72w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 11/18] migration: Create migrate_block_bitmap_mapping() function Date: Thu, 27 Apr 2023 17:22:27 +0200 Message-Id: <20230427152234.25400-12-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609551275100003 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 --- Make it return const (vladimir) --- 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..6624f39bc6 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; + const 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; + const 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 1aa9575bc0..1840a3b220 100644 --- a/migration/options.c +++ b/migration/options.c @@ -455,6 +455,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, =20 /* parameters */ =20 +const 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 819c1b1ce3..9bcb9e558c 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 +const BitmapMigrationNodeAliasList *migrate_block_bitmap_mapping(void); bool migrate_block_incremental(void); uint32_t migrate_checkpoint_delay(void); int migrate_compress_level(void); --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682610488; cv=none; d=zohomail.com; s=zohoarc; b=EdeSIfqi2LNnbLdHFVOyAonmdzLtbN1W1v77l62eW4IsgcylZ7DeCZJJWTxMtmlVkyhOEZlWbROs/phO6fPoHbcpgerT2swGkabNeFoNryUfosIA/OEOvE9fOvbwiLe2Mnbwny5RQGRVbdNgEEadIZUoUlLlQ/5J3HTlz9kkuJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682610488; 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=X0brlK63O6UzIjxMhi6l6iWsakemRykdHJP21Kc3TQc=; b=c2li89ablAKTEfgDK5tVzf147NmHYU00+XupCqWMDsfKTh8sLTMcL6k4t2z2CZ2GdOZL7WTJ46wsyYmXTMvD1v3+qsL6OZmVD0JfZqwJJ46wpgN4zivIA81n4E8VI3hwq39hLOe9nW7VncljNVpGfx4HTWFK/mmh0lyNSKZV/yg= 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 168261048871870.85897914441455; Thu, 27 Apr 2023 08:48:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3pf-0005aF-ND; Thu, 27 Apr 2023 11:46:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3pb-0005C9-12 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:46: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 1ps3pV-00051Q-Uh for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:46:47 -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-563-dcYZfM_QNpuV2FxbWFKYWA-1; Thu, 27 Apr 2023 11:25:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78D758678A0; Thu, 27 Apr 2023 15:23:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id C06BE40C2064; Thu, 27 Apr 2023 15:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682610405; 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=X0brlK63O6UzIjxMhi6l6iWsakemRykdHJP21Kc3TQc=; b=SBg84In/eCnMiOw9y5+D52fE9DrdySabapVBrPBSh47Y4lXGCoiHJ+/lTiAexQfbyC5nGo cYOR7f/mXmqAPWbgtEXrRX3U5fva/XKO90pymHeOGxvbFuV12TYmCxdSOkuZC2T8CTLgzH 8Z1JNAz4+d4ih4ujXOoaNju/IshyqU0= X-MC-Unique: dcYZfM_QNpuV2FxbWFKYWA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 12/18] migration: Move migration_properties to options.c Date: Thu, 27 Apr 2023 17:22:28 +0200 Message-Id: <20230427152234.25400-13-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682610490676100001 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 1840a3b220..f2a77cdef1 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 9bcb9e558c..00854d60f9 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.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609180; cv=none; d=zohomail.com; s=zohoarc; b=ALyp8gKHLkkDeEK3JLPrnF280YeQJMKvC/G8e82lcrCsu5NxmN3LTqMR+/8r5s+ymsvcEnfO1jc+/AebPxcVXVCDgaenx7nYyZ0ybmCjWzg2ZDrDO+82XMvAV3x8FUsSBJ+B+Bk64DEPNMjx0NOFHVvuGQ0ri8rALK9iOHjJH7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609180; 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=O6yrAmv9D4XCGk4nW1h0Lx9YpWijo4R1mmJfz9rbing=; b=eWdl/Q0DGBIg3yOle5UE4/5ZOz0iAI+0X9IiLtpaU79w5zEwywhTBFcKhc6hEheB7l7/CjcZxhRiNjfv+EowFw37KWPedUzEnbWwmg+5nCemZdmhpvDwwzOqf6HgO0S3zxQ23ZCNFWIM124k2RKe42ukQ3hqIplVtB7AsDvyQR4= 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 1682609180244979.8630262865656; Thu, 27 Apr 2023 08:26:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VU-00048b-Sa; Thu, 27 Apr 2023 11:26:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3Ui-0003Co-O9 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:29 -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 1ps3Uh-0000b1-56 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25: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-364-pbk8FUCcNlSR0tOF-84fmQ-1; Thu, 27 Apr 2023 11:25:00 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99A598A5219; Thu, 27 Apr 2023 15:23:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEEA440C2064; Thu, 27 Apr 2023 15:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609114; 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=O6yrAmv9D4XCGk4nW1h0Lx9YpWijo4R1mmJfz9rbing=; b=Zy7zL+65XSWPxvk8OCaPIm7xRH9nJbpyCqPFUaEihMVliDL8Hkyw2Swk5e60AhUEYiAx9n Ws5HmtTSlBbx7qz7t5H7oAutOkw9D4Y4z9k1lpptV4NjTjA+rAX5tL+eokAcyPgbc2dmEh nt1YIsVLmYdvPFAqgiGGJtHhAa0HO6o= X-MC-Unique: pbk8FUCcNlSR0tOF-84fmQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , "Dr . David Alan Gilbert" Subject: [PULL 13/18] multifd: Create property multifd-flush-after-each-section Date: Thu, 27 Apr 2023 17:22:29 +0200 Message-Id: <20230427152234.25400-14-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609181879100001 Content-Type: text/plain; charset="utf-8" We used to flush all channels at the end of each RAM section sent. That is not needed, so preparing to only flush after a full iteration through all the RAM. Default value of the property is false. But we return "true" in migrate_multifd_flush_after_each_section() until we implement the code in following patches. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Acked-by: Peter Xu --- Rename each-iteration to after-each-section Rename multifd-sync-after-each-section to multifd-flush-after-each-section Move to machine-8.0 (peter) --- hw/core/machine.c | 4 +++- migration/migration.h | 12 ++++++++++++ migration/options.c | 13 +++++++++++++ migration/options.h | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 2ce97a5d3b..47a34841a5 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -39,7 +39,9 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-pci.h" =20 -GlobalProperty hw_compat_8_0[] =3D {}; +GlobalProperty hw_compat_8_0[] =3D { + { "migration", "multifd-flush-after-each-section", "on"}, +}; const size_t hw_compat_8_0_len =3D G_N_ELEMENTS(hw_compat_8_0); =20 GlobalProperty hw_compat_7_2[] =3D { diff --git a/migration/migration.h b/migration/migration.h index 2b71df8617..e2247d708f 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -404,6 +404,18 @@ struct MigrationState { */ bool preempt_pre_7_2; =20 + /* + * flush every channel after each section sent. + * + * This assures that we can't mix pages from one iteration through + * ram pages with pages for the following iteration. We really + * only need to do this flush after we have go through all the + * dirty pages. For historical reasons, we do that after each + * section. This is suboptimal (we flush too many times). + * Default value is false. Setting this property has no effect + * until the patch that removes this comment. (since 8.1) + */ + bool multifd_flush_after_each_section; /* * This decides the size of guest memory chunk that will be used * to track dirty bitmap clearing. The size of memory chunk will diff --git a/migration/options.c b/migration/options.c index f2a77cdef1..690c8f718e 100644 --- a/migration/options.c +++ b/migration/options.c @@ -88,6 +88,8 @@ Property migration_properties[] =3D { send_section_footer, true), DEFINE_PROP_BOOL("decompress-error-check", MigrationState, decompress_error_check, true), + DEFINE_PROP_BOOL("multifd-flush-after-each-section", MigrationState, + multifd_flush_after_each_section, 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, @@ -335,6 +337,17 @@ bool migrate_zero_copy_send(void) =20 /* pseudo capabilities */ =20 +bool migrate_multifd_flush_after_each_section(void) +{ + MigrationState *s =3D migrate_get_current(); + + /* + * Until the patch that remove this comment, we always return that + * the property is enabled. + */ + return true || s->multifd_flush_after_each_section; +} + bool migrate_postcopy(void) { return migrate_postcopy_ram() || migrate_dirty_bitmaps(); diff --git a/migration/options.h b/migration/options.h index 00854d60f9..3c322867cd 100644 --- a/migration/options.h +++ b/migration/options.h @@ -59,6 +59,7 @@ bool migrate_zero_copy_send(void); * check, but they are not a capability. */ =20 +bool migrate_multifd_flush_after_each_section(void); bool migrate_postcopy(void); bool migrate_tls(void); =20 --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609172; cv=none; d=zohomail.com; s=zohoarc; b=isBqcDo8WsxJigTCzbgXp3WG5/ozw3GhNggu/j3slTJiuPeFw2LzqZt10W7yAI0CkDUCChlCHPw2yEKL5stCX+FQ+pNMF8hq85g+yszuFTegR/zWig19Ka8ovIAcQL05eFU06UMLyu89YSICzTIs77s+r33BjhT5mWZxwIcPM0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609172; 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=T1cBJX1ouDMnbDsO+Ogp0Q8jRZ8ENZ0BxMiXIpx3+xg=; b=a3+HKOBXoL9i9JoslX3lfmIpOe+6AVngGQrxH2s+Gb+CCe+81Q/dLnINF3P5rm4Izfl8dPmhDSjvR6x0tm+k8y4CXW9HQMdJheajOyAIlbE+7s4qDJIB1V3tcYziNX6l410T+RRaqtSTZl8bsHiN4nvy1GQWn2TNKgsDVjPwqjA= 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 1682609172968797.1607709668119; Thu, 27 Apr 2023 08:26:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VM-0003qY-Rw; Thu, 27 Apr 2023 11:26:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3Uh-0003Az-R6 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:29 -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 1ps3Uf-0000ZU-6T for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:15 -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-558-Huj69sQON5OYn19Fm6Q3KA-1; Thu, 27 Apr 2023 11:25:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CE9310F981F; Thu, 27 Apr 2023 15:23:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB45A40C2064; Thu, 27 Apr 2023 15:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609111; 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=T1cBJX1ouDMnbDsO+Ogp0Q8jRZ8ENZ0BxMiXIpx3+xg=; b=QSGuWTs9rXJETQAafPc3V+jBgIIAFK36iJPQMo605SSlvhjHjOQytRom+/RVcLXfrgxHQJ 1FCFtCcSMqF5qtlAcY4y6gIfkXF23hjq5ab/za5hoKwtTkqz8WgcOd+Xm0j+ttcq/0dC/O x7WvHeP11xxkVdhWHyjIcsvnTCT+0Io= X-MC-Unique: Huj69sQON5OYn19Fm6Q3KA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , "Dr . David Alan Gilbert" Subject: [PULL 14/18] multifd: Protect multifd_send_sync_main() calls Date: Thu, 27 Apr 2023 17:22:30 +0200 Message-Id: <20230427152234.25400-15-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609174945100003 Content-Type: text/plain; charset="utf-8" We only need to do that on the ram_save_iterate() call on sending and on destination when we get a RAM_SAVE_FLAG_EOS. In setup() and complete() we need to synch in both new and old cases, so don't add a check there. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Acked-by: Peter Xu --- Remove the wrappers that we take out on patch 5. --- migration/ram.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 01356f60a4..1e2414d681 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3394,9 +3394,11 @@ static int ram_save_iterate(QEMUFile *f, void *opaqu= e) out: if (ret >=3D 0 && migration_is_setup_or_active(migrate_get_current()->state)) { - ret =3D multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].pss_ch= annel); - if (ret < 0) { - return ret; + if (migrate_multifd_flush_after_each_section()) { + ret =3D multifd_send_sync_main(rs->pss[RAM_CHANNEL_PRECOPY].ps= s_channel); + if (ret < 0) { + return ret; + } } =20 qemu_put_be64(f, RAM_SAVE_FLAG_EOS); @@ -4153,7 +4155,9 @@ int ram_load_postcopy(QEMUFile *f, int channel) =20 case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_flush_after_each_section()) { + multifd_recv_sync_main(); + } break; default: error_report("Unknown combination of migration flags: 0x%x" @@ -4424,7 +4428,9 @@ static int ram_load_precopy(QEMUFile *f) break; case RAM_SAVE_FLAG_EOS: /* normal exit */ - multifd_recv_sync_main(); + if (migrate_multifd_flush_after_each_section()) { + multifd_recv_sync_main(); + } break; default: if (flags & RAM_SAVE_FLAG_HOOK) { --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609247; cv=none; d=zohomail.com; s=zohoarc; b=F+zqRMYmoa4PYYv8zo8OzurjJAONKJXjndiZ0/xug1mlBa+UNUuolzOjpIsI5h5n2JYVFto+U30Cv8hg8PJpoQ7k0oHLgYOwZ+QsGiNeS6AjsLWZghA94vRqWwrjOZ6Vx2OicBDYke/Ny7Hm6utcgHOn8+A8tvkPhjbTdPCFOsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609247; 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=dy1LT4y8A/6RjhKEZRZXKNwPiEwkx5zgEeXLHA5wj5w=; b=n5JKXr/XGA61eSz9kGvYTjhwKw7PgBWQl/zgAhBP2HJsjusaCw9zAftQIUq9a163GR4Hzo67nb1MPlmZJz1Mz6hvxP03LLZaV7XTt/ZxuOpDMSSb9YD1fyrLrlOKG4J+5YprL7BiBnZvOMqFLM3cZdLGm25z54ec8Aexp1IEAxY= 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 1682609247844906.0807702008025; Thu, 27 Apr 2023 08:27:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3Wh-0001ZN-Av; Thu, 27 Apr 2023 11:27:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3WY-0001Nl-Ci for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:27:12 -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 1ps3WW-0000yM-0n for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:27:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-384-XvNiFx8gPpOQ-TY2OzLorA-1; Thu, 27 Apr 2023 11:26:04 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3903F38294DB; Thu, 27 Apr 2023 15:23:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B5940C201F; Thu, 27 Apr 2023 15:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609221; 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=dy1LT4y8A/6RjhKEZRZXKNwPiEwkx5zgEeXLHA5wj5w=; b=Cl1FaXcsT3Rtur5lyv9dyGP+4RtTvu1gG/PZD9bjKYecLYosDFXtKP2VnBwbSgLejqMwJG jWS+PKvjf+brbeHgi/m1TvZccUdDRnbK1HBllb5ODBAeeEQl9mQ0vLqL22VB2PHVIUMCY1 dV9XqPeYh7yF+1uJwmcjhIheTcbgZUw= X-MC-Unique: XvNiFx8gPpOQ-TY2OzLorA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy Subject: [PULL 15/18] multifd: Only flush once each full round of memory Date: Thu, 27 Apr 2023 17:22:31 +0200 Message-Id: <20230427152234.25400-16-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609248160100001 Content-Type: text/plain; charset="utf-8" We need to add a new flag to mean to flush at that point. Notice that we still flush at the end of setup and at the end of complete stages. Signed-off-by: Juan Quintela Acked-by: Peter Xu --- Add missing qemu_fflush(), now it passes all tests always. In the previous version, the check that changes the default value to false got lost in some rebase. Get it back. --- migration/migration.h | 3 +-- migration/options.c | 8 ++------ migration/ram.c | 28 +++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/migration/migration.h b/migration/migration.h index e2247d708f..3a918514e7 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -412,8 +412,7 @@ struct MigrationState { * only need to do this flush after we have go through all the * dirty pages. For historical reasons, we do that after each * section. This is suboptimal (we flush too many times). - * Default value is false. Setting this property has no effect - * until the patch that removes this comment. (since 8.1) + * Default value is false. (since 8.1) */ bool multifd_flush_after_each_section; /* diff --git a/migration/options.c b/migration/options.c index 690c8f718e..53b7fc5d5d 100644 --- a/migration/options.c +++ b/migration/options.c @@ -89,7 +89,7 @@ Property migration_properties[] =3D { DEFINE_PROP_BOOL("decompress-error-check", MigrationState, decompress_error_check, true), DEFINE_PROP_BOOL("multifd-flush-after-each-section", MigrationState, - multifd_flush_after_each_section, true), + multifd_flush_after_each_section, false), DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState, clear_bitmap_shift, CLEAR_BITMAP_SHIFT_DEFAULT), DEFINE_PROP_BOOL("x-preempt-pre-7-2", MigrationState, @@ -341,11 +341,7 @@ bool migrate_multifd_flush_after_each_section(void) { MigrationState *s =3D migrate_get_current(); =20 - /* - * Until the patch that remove this comment, we always return that - * the property is enabled. - */ - return true || s->multifd_flush_after_each_section; + return s->multifd_flush_after_each_section; } =20 bool migrate_postcopy(void) diff --git a/migration/ram.c b/migration/ram.c index 1e2414d681..e9dcda8b9d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -86,6 +86,7 @@ #define RAM_SAVE_FLAG_XBZRLE 0x40 /* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 +#define RAM_SAVE_FLAG_MULTIFD_FLUSH 0x200 /* We can't use any flag that is bigger than 0x200 */ =20 int (*xbzrle_encode_buffer_func)(uint8_t *, uint8_t *, int, @@ -1581,6 +1582,7 @@ retry: * associated with the search process. * * Returns: + * <0: An error happened * PAGE_ALL_CLEAN: no dirty page found, give up * PAGE_TRY_AGAIN: no dirty page found, retry for next block * PAGE_DIRTY_FOUND: dirty page found @@ -1608,6 +1610,15 @@ static int find_dirty_block(RAMState *rs, PageSearch= Status *pss) pss->page =3D 0; pss->block =3D QLIST_NEXT_RCU(pss->block, next); if (!pss->block) { + if (!migrate_multifd_flush_after_each_section()) { + QEMUFile *f =3D rs->pss[RAM_CHANNEL_PRECOPY].pss_channel; + int ret =3D multifd_send_sync_main(f); + if (ret < 0) { + return ret; + } + qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_FLUSH); + qemu_fflush(f); + } /* * If memory migration starts over, we will meet a dirtied page * which may still exists in compression threads's ring, so we @@ -2600,6 +2611,9 @@ static int ram_find_and_save_block(RAMState *rs) break; } else if (res =3D=3D PAGE_TRY_AGAIN) { continue; + } else if (res < 0) { + pages =3D res; + break; } } } @@ -3286,6 +3300,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque) return ret; } =20 + if (!migrate_multifd_flush_after_each_section()) { + qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_FLUSH); + } + qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); =20 @@ -3471,6 +3489,9 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) return ret; } =20 + if (!migrate_multifd_flush_after_each_section()) { + qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_FLUSH); + } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); qemu_fflush(f); =20 @@ -4152,7 +4173,9 @@ int ram_load_postcopy(QEMUFile *f, int channel) } decompress_data_with_multi_threads(f, page_buffer, len); break; - + case RAM_SAVE_FLAG_MULTIFD_FLUSH: + multifd_recv_sync_main(); + break; case RAM_SAVE_FLAG_EOS: /* normal exit */ if (migrate_multifd_flush_after_each_section()) { @@ -4426,6 +4449,9 @@ static int ram_load_precopy(QEMUFile *f) break; } break; + case RAM_SAVE_FLAG_MULTIFD_FLUSH: + multifd_recv_sync_main(); + break; case RAM_SAVE_FLAG_EOS: /* normal exit */ if (migrate_multifd_flush_after_each_section()) { --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609200; cv=none; d=zohomail.com; s=zohoarc; b=h3BzJy6DcryDeost9aeYzVGAxfk1VhW5nJIo2KW3FsAxarX/ztme0DbLLDdox/QwSxS9aeKZpMcxOjIViQV2kgrUOzc6HRFB479sxrRXhjO3zm8l7+9Kl1c6kAS3122L8+pgxRrMc9ycDN/L8BKijetvGBq8gnpXTKcUXZyQtYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609200; 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=Hr2oW3xiLx9AVMNY4v1XO33oNMRQgQz7qAfx2FKzjXw=; b=DkrGhNY0eGgsIaf44ZcE/nl/lu5EysR1Osn6FYiOpfri+Gmbe62OCReIkL/pg7Jfalzp65yT/NLxc6ka6ywO0BaJJrhn51iUEprs/aTZCD8MbdEfn3LJ//xtWB41Pe4B5OWBzPEn8djr0QEWYtYyWoTveWGfqES0mhDpozX5Rfs= 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 1682609200075984.3459399106815; Thu, 27 Apr 2023 08:26:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VW-0004Ff-4J; Thu, 27 Apr 2023 11:26:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3VK-0003oe-Cj for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:54 -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 1ps3VH-0000ck-6S for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25: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-351-ytLdEjv6OBOWTc8NAer0iA-1; Thu, 27 Apr 2023 11:25:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D6A629DD992; Thu, 27 Apr 2023 15:23:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DB2A40C2064; Thu, 27 Apr 2023 15:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609125; 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=Hr2oW3xiLx9AVMNY4v1XO33oNMRQgQz7qAfx2FKzjXw=; b=EhlEV2CJ1bmHKg8Cyn1KEBSx2zaWLhDnOu0UqXDrohpwafQUcUmcB6wNNpSeu00oodqiaf Qs9WReo8xHtl8H9WP38MTHnpCWb69AR41OCY+RvTLqLALOBkQ322fIzQ4tUioi5FhG/exU v7yg2A08umB1xRGcfQU10loDtsxNaJ0= X-MC-Unique: ytLdEjv6OBOWTc8NAer0iA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Paolo Bonzini , Richard Henderson Subject: [PULL 16/18] stat64: Add stat64_set() operation Date: Thu, 27 Apr 2023 17:22:32 +0200 Message-Id: <20230427152234.25400-17-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609201876100003 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Signed-off-by: Paolo Bonzini Reviewed-by: Juan Quintela Reviewed-by: Richard Henderson Signed-off-by: Juan Quintela --- include/qemu/stats64.h | 6 ++++++ util/stats64.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/qemu/stats64.h b/include/qemu/stats64.h index 802402254b..99b5cb724a 100644 --- a/include/qemu/stats64.h +++ b/include/qemu/stats64.h @@ -40,6 +40,11 @@ static inline uint64_t stat64_get(const Stat64 *s) return qatomic_read__nocheck(&s->value); } =20 +static inline void stat64_set(Stat64 *s, uint64_t value) +{ + qatomic_set__nocheck(&s->value, value); +} + static inline void stat64_add(Stat64 *s, uint64_t value) { qatomic_add(&s->value, value); @@ -62,6 +67,7 @@ static inline void stat64_max(Stat64 *s, uint64_t value) } #else uint64_t stat64_get(const Stat64 *s); +void stat64_set(Stat64 *s, uint64_t value); bool stat64_min_slow(Stat64 *s, uint64_t value); bool stat64_max_slow(Stat64 *s, uint64_t value); bool stat64_add32_carry(Stat64 *s, uint32_t low, uint32_t high); diff --git a/util/stats64.c b/util/stats64.c index 897613c949..09736014ec 100644 --- a/util/stats64.c +++ b/util/stats64.c @@ -57,6 +57,17 @@ uint64_t stat64_get(const Stat64 *s) return ((uint64_t)high << 32) | low; } =20 +void stat64_set(Stat64 *s, uint64_t val) +{ + while (!stat64_wrtrylock(s)) { + cpu_relax(); + } + + qatomic_set(&s->high, val >> 32); + qatomic_set(&s->low, val); + stat64_wrunlock(s); +} + bool stat64_add32_carry(Stat64 *s, uint32_t low, uint32_t high) { uint32_t old; --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609145; cv=none; d=zohomail.com; s=zohoarc; b=UDlofm0gSVBwWC4KIvJ/EpsGoj2e1dwa9ymKs+9qrMh5IC+nXOKshEveiXX2CP6IH3KZD3ENIJlEfSxtlPit6rUU5BToFxJP92JxAHwmzbkvsZNBKFIp/tHegZDSqJ4CPpyGbJTs3qmedikzay+qT/N3c6ox/ceWngGdo06U9hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609145; 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=VDeqWFKzV0z60L2xcqjGeWejmqVFcssqvM/1sNGP7DI=; b=bLM8Su/xtD6OGz/G2Ud+1cKiIL6ttQdTQDWFClN3sB3e8KCt6QyNNB/a86K8h+VcmXvYt3CCmJK2+iH3MxFOYg0S3jAyXEbIfQFE6i/Xo0lx0JZoCTu0JrAVUh1m54gdSdLny+UGfJnCxDMmZy738MVdVnMeKaxrjnHvHEq7wDA= 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 1682609145036705.6224134314327; Thu, 27 Apr 2023 08:25:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3Uz-0003LP-On; Thu, 27 Apr 2023 11:25:37 -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 1ps3Uc-00035W-U8 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3UZ-0000YX-Kn for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25: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-79-3zV7MOE6NlCc2i3wm3SQZA-1; Thu, 27 Apr 2023 11:24:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A2DE8A5B62; Thu, 27 Apr 2023 15:23:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id D43B540C2064; Thu, 27 Apr 2023 15:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609107; 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=VDeqWFKzV0z60L2xcqjGeWejmqVFcssqvM/1sNGP7DI=; b=ShekHSHHY6BuArswtJFApticob3vkHSPzs84CIv75Bzufgz3uXI7I5n6j7lYg+P8sSR5kw filPY3Jtr0hNuPT74ROLG0YIM9d1+ga1s+A+sUdh7QRIFAbkuLgIdGvViWImZYk73tp4ym DKzBiIVtmI5Uzz5MdFxdXCXiHsfZqQY= X-MC-Unique: 3zV7MOE6NlCc2i3wm3SQZA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Richard Henderson Subject: [PULL 17/18] migration: Make dirty_pages_rate atomic Date: Thu, 27 Apr 2023 17:22:33 +0200 Message-Id: <20230427152234.25400-18-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609146756100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Peter Xu --- Don't use __nocheck() variants Use stat64_get() --- migration/migration.c | 6 ++++-- migration/ram.c | 5 +++-- migration/ram.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3adcdfe286..9367bb2afc 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -958,7 +958,8 @@ static void populate_ram_info(MigrationInfo *info, Migr= ationState *s) =20 if (s->state !=3D MIGRATION_STATUS_COMPLETED) { info->ram->remaining =3D ram_bytes_remaining(); - info->ram->dirty_pages_rate =3D ram_counters.dirty_pages_rate; + info->ram->dirty_pages_rate =3D + stat64_get(&ram_counters.dirty_pages_rate); } } =20 @@ -2689,7 +2690,8 @@ static void migration_update_counters(MigrationState = *s, * if we haven't sent anything, we don't want to * recalculate. 10000 is a small enough number for our purposes */ - if (ram_counters.dirty_pages_rate && transferred > 10000) { + if (stat64_get(&ram_counters.dirty_pages_rate) && + transferred > 10000) { s->expected_downtime =3D ram_counters.remaining / bandwidth; } =20 diff --git a/migration/ram.c b/migration/ram.c index e9dcda8b9d..5846f6e27f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1130,8 +1130,9 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) double compressed_size; =20 /* calculate period counters */ - ram_counters.dirty_pages_rate =3D rs->num_dirty_pages_period * 1000 - / (end_time - rs->time_last_bitmap_sync); + stat64_set(&ram_counters.dirty_pages_rate, + rs->num_dirty_pages_period * 1000 / + (end_time - rs->time_last_bitmap_sync)); =20 if (!page_count) { return; diff --git a/migration/ram.h b/migration/ram.h index a6e0d70226..f189cc79f8 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,7 +41,7 @@ * one thread). */ typedef struct { - int64_t dirty_pages_rate; + Stat64 dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; --=20 2.40.0 From nobody Sat May 11 22:16:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682609200; cv=none; d=zohomail.com; s=zohoarc; b=jJi3mMsxBvukceIl00aYDNTGHhMMOrqofwwqJYkX8V2R+ncvy6+iHwoWy/nKYY56RjBx5IEQEf32lPpdPOb/c9271heCqKCzGKXQf81bVmm99ESBp52mxUx+PGwKzh1vkSqrpJhNMXWOYbyYgWk6nWGT5X0z81xhVFJhymH+aH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682609200; 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=rScorxR86QO8djbo7rPv1Vb9/pJy/vzwZVQ656Hsqvo=; b=epbUSgtQNS/LbGnZQxGs+/cEU0TVmIFFcD3xDLqMWD+eHaOWubYKVctLs2P4ljK/vqUu0+203iWpsnSfuLmUVuE4k7H9YVyS9jCoKnCjhfk4mbMw9fGH2MFhZFSgV4Gohq8C5QDqZiH/F1A1lIG9mSgqjQbKtqcDVQy8qHFhjos= 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 1682609200743905.0994601204695; Thu, 27 Apr 2023 08:26:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps3VW-0004QZ-J6; Thu, 27 Apr 2023 11:26:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps3VL-0003xo-N3 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:57 -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 1ps3VH-0000h4-RO for qemu-devel@nongnu.org; Thu, 27 Apr 2023 11:25:55 -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-142-8zfLTTMaOhiIDsM9nYQIDQ-1; Thu, 27 Apr 2023 11:25:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 787EA10F98B1; Thu, 27 Apr 2023 15:23:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBEEF40C2064; Thu, 27 Apr 2023 15:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682609150; 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=rScorxR86QO8djbo7rPv1Vb9/pJy/vzwZVQ656Hsqvo=; b=IqfHqD0Ya0v99R2e9IbamAdaubJeru3zAqEL6WjgL5I2O0MS40n0gV0MeH6o5PVg6HMmSQ PrXv407jxewfe0e3USO8vtAlXQDx4mSMkNA9mLtkMDF6Z95mZBP/pJi0W1N6xQFwRH5TK9 wgw8LOmXhl1CYtIdnRO7gTudo5A1ZRU= X-MC-Unique: 8zfLTTMaOhiIDsM9nYQIDQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eric Blake , Juan Quintela , Peter Xu , John Snow , Yanan Wang , Stefan Hajnoczi , Leonardo Bras , Fam Zheng , Eduardo Habkost , Vladimir Sementsov-Ogievskiy , Richard Henderson Subject: [PULL 18/18] migration: Make dirty_bytes_last_sync atomic Date: Thu, 27 Apr 2023 17:22:34 +0200 Message-Id: <20230427152234.25400-19-quintela@redhat.com> In-Reply-To: <20230427152234.25400-1-quintela@redhat.com> References: <20230427152234.25400-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682609201122100001 Content-Type: text/plain; charset="utf-8" As we set its value, it needs to be operated with atomics. We rename it from remaining to better reflect its meaning. Statistics always return the real reamaining bytes. This was used to store how much pages where dirty on the previous generation, so we can calculate the expected downtime as: dirty_bytes_last_sync / current_bandwith. If we use the actual remaining bytes, we would see a very small value at the end of the iteration. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Richard Henderson --- I am open to use ram_bytes_remaining() in its only use and be more "optimistic" about the downtime. Don't use __nocheck() functions. Use stat64_get() now that it exists. --- migration/migration.c | 3 ++- migration/ram.c | 2 +- migration/ram.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9367bb2afc..abcadbb619 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2692,7 +2692,8 @@ static void migration_update_counters(MigrationState = *s, */ if (stat64_get(&ram_counters.dirty_pages_rate) && transferred > 10000) { - s->expected_downtime =3D ram_counters.remaining / bandwidth; + s->expected_downtime =3D + stat64_get(&ram_counters.dirty_bytes_last_sync) / bandwidth; } =20 qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/ram.c b/migration/ram.c index 5846f6e27f..89be3e3320 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1224,7 +1224,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(rs, block); } - ram_counters.remaining =3D ram_bytes_remaining(); + stat64_set(&ram_counters.dirty_bytes_last_sync, ram_bytes_remainin= g()); } qemu_mutex_unlock(&rs->bitmap_mutex); =20 diff --git a/migration/ram.h b/migration/ram.h index f189cc79f8..04b05e1b2c 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,6 +41,7 @@ * one thread). */ typedef struct { + Stat64 dirty_bytes_last_sync; Stat64 dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; @@ -51,7 +52,6 @@ typedef struct { Stat64 postcopy_bytes; Stat64 postcopy_requests; Stat64 precopy_bytes; - int64_t remaining; Stat64 transferred; } RAMStats; =20 --=20 2.40.0