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: 11592185 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEC4E618 for ; Sun, 7 Jun 2020 19:59:20 +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 AE0262074B for ; Sun, 7 Jun 2020 19:59:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE0262074B 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+patchwork-qemu-devel=patchwork.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 1ji1Rw-0003x7-0R for patchwork-qemu-devel@patchwork.kernel.org; Sun, 07 Jun 2020 15:59:20 -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+patchwork-qemu-devel=patchwork.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 Reviewed-by: Lukas Straub Tested-by: Lukas Straub --- 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: From patchwork Sun Jun 7 19:46:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 11592205 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78D001391 for ; Sun, 7 Jun 2020 20:08:41 +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 58831206F6 for ; Sun, 7 Jun 2020 20:08:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58831206F6 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ji1ay-0003FL-Is for patchwork-qemu-devel@patchwork.kernel.org; Sun, 07 Jun 2020 16:08:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pt-0000go-4Y for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:13 -0400 Received: from mga05.intel.com ([192.55.52.43]:14935) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pr-0006UC-Pe for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:12 -0400 IronPort-SDR: Gwzr64tGx5/83I3ZuV+WoKPkZvwi3aJNVzmdngLWMb/wiusuj4gus/rLo/hbhME8J4QsRKjfeW 0fBAYH0FAevg== 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:11 -0700 IronPort-SDR: TFtCqwJBNRIV+XFr2OfvjWmOJveDBwQuZJJOnGc2zgdULEoHGDLAT+hi//yW9Fa7g+eLjyyefH qILLjEmWHajQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,485,1583222400"; d="scan'208";a="446509265" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga005.jf.intel.com with ESMTP; 07 Jun 2020 12:57:09 -0700 From: Zhang Chen To: "Dr . David Alan Gilbert" , qemu-dev Subject: [PATCH V3 2/3] migration/colo: Update checkpoint time lately Date: Mon, 8 Jun 2020 03:46:10 +0800 Message-Id: <20200607194611.24763-3-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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Zhang Chen Previous operation(like vm_start and replication_start_all) will consume extra time for first forced synchronization, so reduce it in this patch. Signed-off-by: Zhang Chen Reviewed-by: zhanghailiang Reviewed-by: Lukas Straub Tested-by: Lukas Straub --- migration/colo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 91c76789fa..2b837e1255 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -532,7 +532,6 @@ static void colo_process_checkpoint(MigrationState *s) { QIOChannelBuffer *bioc; QEMUFile *fb = NULL; - int64_t current_time = qemu_clock_get_ms(QEMU_CLOCK_HOST); Error *local_err = NULL; int ret; @@ -581,8 +580,8 @@ static void colo_process_checkpoint(MigrationState *s) qemu_mutex_unlock_iothread(); trace_colo_vm_state_change("stop", "run"); - timer_mod(s->colo_delay_timer, - current_time + s->parameters.x_checkpoint_delay); + timer_mod(s->colo_delay_timer, qemu_clock_get_ms(QEMU_CLOCK_HOST) + + s->parameters.x_checkpoint_delay); while (s->state == MIGRATION_STATUS_COLO) { if (failover_get_state() != FAILOVER_STATUS_NONE) { From patchwork Sun Jun 7 19:46:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 11592193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DA79913 for ; Sun, 7 Jun 2020 20:01:27 +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 5CA652074B for ; Sun, 7 Jun 2020 20:01:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CA652074B 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:43658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ji1Ty-0005rY-Kr for patchwork-qemu-devel@patchwork.kernel.org; Sun, 07 Jun 2020 16:01:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pv-0000lp-Hf for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:15 -0400 Received: from mga05.intel.com ([192.55.52.43]:14944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji1Pu-0006Uc-NN for qemu-devel@nongnu.org; Sun, 07 Jun 2020 15:57:15 -0400 IronPort-SDR: hSy4R+TIpphgrH5qLwb7HZPsHXP8fRjSSSMTRzbNLY9/3YzcIk7lwnH/El2gQroEtkdH4G2+lz HJ5BqqV9eW6w== 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:12 -0700 IronPort-SDR: yc+xQq563Rd0ooyLNDsYv/GcJ3bxMS1YloeXFuvGk+RuUmp2SYArOO3hES0Lh2sj40R02UBZW4 bj9Rvqbb8uRA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,485,1583222400"; d="scan'208";a="446509269" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga005.jf.intel.com with ESMTP; 07 Jun 2020 12:57:11 -0700 From: Zhang Chen To: "Dr . David Alan Gilbert" , qemu-dev Subject: [PATCH V3 3/3] migration/migration.c: Remove MIGRATION_STATUS_ACTIVE in migration_iteration_finish Date: Mon, 8 Jun 2020 03:46:11 +0800 Message-Id: <20200607194611.24763-4-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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Zhang Chen MIGRATION_STATUS_ACTIVE is invalid here, handle it by default case. Suggested-by: Lukas Straub Signed-off-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub --- migration/migration.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 9059238e3d..9958b15202 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3319,11 +3319,6 @@ 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: