From nobody Sun Feb 8 12:57:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1637138492027335.21987793241647; Wed, 17 Nov 2021 00:41:32 -0800 (PST) Received: from localhost ([::1]:38142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnGVW-0002yR-SH for importer@patchew.org; Wed, 17 Nov 2021 03:41:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnGUQ-0001Ci-2l for qemu-devel@nongnu.org; Wed, 17 Nov 2021 03:40:22 -0500 Received: from mga02.intel.com ([134.134.136.20]:10626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnGUN-0003n6-4K for qemu-devel@nongnu.org; Wed, 17 Nov 2021 03:40:21 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2021 00:40:16 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2021 00:40:14 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10170"; a="221121557" X-IronPort-AV: E=Sophos;i="5.87,241,1631602800"; d="scan'208";a="221121557" X-IronPort-AV: E=Sophos;i="5.87,241,1631602800"; d="scan'208";a="506822168" From: Zhang Chen To: Hailiang Zhang , Juan Quintela , "Dr . David Alan Gilbert" Subject: [PATCH V2] migration/colo: Optimize COLO primary node start code path Date: Wed, 17 Nov 2021 16:30:02 +0800 Message-Id: <20211117083002.206290-1-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=134.134.136.20; envelope-from=chen.zhang@intel.com; helo=mga02.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Cc: Zhang Chen , qemu-dev Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1637138493003100001 Content-Type: text/plain; charset="utf-8" Optimize COLO primary start path from: MIGRATION_STATUS_XXX --> MIGRATION_STATUS_ACTIVE --> MIGRATION_STATUS_COLO = --> MIGRATION_STATUS_COMPLETED To: MIGRATION_STATUS_XXX --> MIGRATION_STATUS_COLO --> MIGRATION_STATUS_COMPLET= ED No need to start primary COLO through "MIGRATION_STATUS_ACTIVE". Signed-off-by: Zhang Chen Reviewed-by: Juan Quintela --- migration/colo.c | 2 -- migration/migration.c | 13 +++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 2415325262..ad1a4426b3 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -667,8 +667,6 @@ void migrate_start_colo_process(MigrationState *s) colo_checkpoint_notify, s); =20 qemu_sem_init(&s->colo_exit_sem, 0); - migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_COLO); colo_process_checkpoint(s); qemu_mutex_lock_iothread(); } diff --git a/migration/migration.c b/migration/migration.c index abaf6f9e3d..380fa05f12 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3607,12 +3607,7 @@ static void migration_iteration_finish(MigrationStat= e *s) migration_calculate_complete(s); runstate_set(RUN_STATE_POSTMIGRATE); break; - - case MIGRATION_STATUS_ACTIVE: - /* - * We should really assert here, but since it's during - * migration, let's try to reduce the usage of assertions. - */ + case MIGRATION_STATUS_COLO: if (!migrate_colo_enabled()) { error_report("%s: critical error: calling COLO code without " "COLO enabled", __func__); @@ -3622,6 +3617,12 @@ static void migration_iteration_finish(MigrationStat= e *s) * Fixme: we will run VM in COLO no matter its old running state. * After exited COLO, we will keep running. */ + /* Fallthrough */ + case MIGRATION_STATUS_ACTIVE: + /* + * We should really assert here, but since it's during + * migration, let's try to reduce the usage of assertions. + */ s->vm_was_running =3D true; /* Fallthrough */ case MIGRATION_STATUS_FAILED: --=20 2.25.1