From patchwork Sun Jun 7 19:46:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 281199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=FROM_WSP_TRAIL, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30971C433E0 for ; Sun, 7 Jun 2020 19:59:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03F542074B for ; Sun, 7 Jun 2020 19:59:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03F542074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ji1S6-0003x7-8F for qemu-devel@archiver.kernel.org; Sun, 07 Jun 2020 15:59:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pr-0000ef-Vx for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:12 -0400 Received: from mga05.intel.com ([192.55.52.43]:14939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pr-0006UL-1X for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:11 -0400 IronPort-SDR: pkc16m3Dd+nuykpD5aNEXlCqxzb55ekezIPtx6voAeZQnzzYOxhMZieniJUIO0OAqQvE93zDvT 50UOefPLtfIw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2020 12:57:09 -0700 IronPort-SDR: 6mBRx3buDGTnzCaMO/1QPQk8eykyaa5SCGKyLgNIZwh8uQO8xyj8Mf85FN/O+ooN1U1mTtgwFL 8OCJi+6BcFTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,485,1583222400"; d="scan'208";a="446509258" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga005.jf.intel.com with ESMTP; 07 Jun 2020 12:57:07 -0700 From: Zhang Chen To: "Dr . David Alan Gilbert" , qemu-dev Subject: [PATCH V3 1/3] migration/colo: Optimize COLO boot code path Date: Mon, 8 Jun 2020 03:46:09 +0800 Message-Id: <20200607194611.24763-2-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200607194611.24763-1-chen.zhang@intel.com> References: <20200607194611.24763-1-chen.zhang@intel.com> Received-SPF: pass client-ip=192.55.52.43; envelope-from=chen.zhang@intel.com; helo=mga05.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/07 15:57:07 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, FROM_ADDR_WS=2.999, FROM_WSP_TRAIL=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Zhanghailiang , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Zhang Chen No need to reuse MIGRATION_STATUS_ACTIVE boot COLO. Signed-off-by: Zhang Chen Reviewed-by: zhanghailiang --- migration/colo.c | 2 -- migration/migration.c | 17 ++++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index ea7d1e9d4e..91c76789fa 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -670,8 +670,6 @@ void migrate_start_colo_process(MigrationState *s) colo_checkpoint_notify, s); 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 b63ad91d34..9059238e3d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2972,7 +2972,10 @@ static void migration_completion(MigrationState *s) goto fail_invalidate; } - if (!migrate_colo_enabled()) { + if (migrate_colo_enabled()) { + migrate_set_state(&s->state, current_active_state, + MIGRATION_STATUS_COLO); + } else { migrate_set_state(&s->state, current_active_state, MIGRATION_STATUS_COMPLETED); } @@ -3304,12 +3307,7 @@ static void migration_iteration_finish(MigrationState *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__); @@ -3321,6 +3319,11 @@ static void migration_iteration_finish(MigrationState *s) */ s->vm_was_running = true; /* 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. + */ case MIGRATION_STATUS_FAILED: case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_CANCELLING: