From patchwork Tue Sep 26 16:18:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 1839831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-03-30 header.b=v10LzEDw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rw4hC1QcPz1ynX for ; Wed, 27 Sep 2023 02:19:39 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlAmB-0002co-5e; Tue, 26 Sep 2023 12:19: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 1qlAm9-0002cS-Mh for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:05 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAm6-0004qk-9J for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:05 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFOGGh012299; Tue, 26 Sep 2023 16:18:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=Xr36l8WWm2fA0qQlHeA3gszn8JlFpazIANHUFIyRB2s=; b=v10LzEDwLjOmph5k2bzdj75dUOCCO87mM/yyK18R68dhFTeQ/qbmWZb4ESfVCTCWPdVQ 0mrdQniLRxd422feDnkD3lHb5yTv+Z/6+l0AUnHjlD30cOTASRL6IwW1HWZ0PdnYFcqp hLUtxGXWiKshsLkFiaaIX8GAlFghbLj5TjzHiL1nSIUyjDWdE1b/00gsVvt8rr8x8AuK Nosuh+TyRHUN4/nnmtWrk3VSZ/bbXannZ33oOP9qz/gYa2RKN+eG65xoli4rR1qJyCTz POdxSqwl8zrTB0k66F0jQvMhaXlBuELZFBk2eerSKdkV9DTuBaZ9k8VJsjC3qHZNYtJ/ ng== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9pee6yve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:18:59 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFTek5039482; Tue, 26 Sep 2023 16:18:59 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfceaek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:18:59 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38QGIt9r007977; Tue, 26 Sep 2023 16:18:58 GMT Received: from joaomart-mac.uk.oracle.com (dhcp-10-175-210-190.vpn.oracle.com [10.175.210.190]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pfcea8h-2; Tue, 26 Sep 2023 16:18:58 +0000 From: Joao Martins To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Avihai Horon , Yishai Hadas , "Maciej S. Szmigiero" , Joao Martins Subject: [PATCH 1/5] migration: Store downtime timestamps in an array Date: Tue, 26 Sep 2023 17:18:37 +0100 Message-Id: <20230926161841.98464-2-joao.m.martins@oracle.com> In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com> References: <20230926161841.98464-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260143 X-Proofpoint-ORIG-GUID: 9H6ZoGZX7TF40KUkOOkTCzVvqI1ofx6E X-Proofpoint-GUID: 9H6ZoGZX7TF40KUkOOkTCzVvqI1ofx6E Received-SPF: pass client-ip=205.220.177.32; envelope-from=joao.m.martins@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Right now downtime_start is stored in MigrationState. In preparation to having more downtime timestamps during switchover, move downtime_start to an array namely, @timestamp. Add a setter/getter surrounding which timestamps to record, to make it easier to spread to various migration functions. Signed-off-by: Joao Martins --- qapi/migration.json | 14 ++++++++++++++ migration/migration.h | 7 +++++-- migration/migration.c | 24 ++++++++++++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 8843e74b59c7..b836cc881d33 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -190,6 +190,20 @@ { 'struct': 'VfioStats', 'data': {'transferred': 'int' } } +## +# @MigrationDowntime: +# +# An enumeration of downtime timestamps for all +# steps of the switchover. +# +# @start:Timestamp taken at the start of the switchover right before +# we stop the VM. +# +# Since: 8.2 +## +{ 'enum': 'MigrationDowntime', + 'data': [ 'start' ] } + ## # @MigrationInfo: # diff --git a/migration/migration.h b/migration/migration.h index c390500604b6..180dc31c5306 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -319,8 +319,8 @@ struct MigrationState { int64_t start_time; /* Total time used by latest migration (ms) */ int64_t total_time; - /* Timestamp when VM is down (ms) to migrate the last stuff */ - int64_t downtime_start; + /* Timestamps e.g. when VM is down (ms) to migrate the last stuff */ + int64_t timestamp[MIGRATION_DOWNTIME__MAX]; int64_t downtime; int64_t expected_downtime; bool capabilities[MIGRATION_CAPABILITY__MAX]; @@ -516,4 +516,7 @@ void migration_populate_vfio_info(MigrationInfo *info); void migration_reset_vfio_bytes_transferred(void); void postcopy_temp_page_reset(PostcopyTmpPage *tmp_page); +void migration_set_timestamp(MigrationDowntime tm); +int64_t migration_get_timestamp(MigrationDowntime tm); + #endif diff --git a/migration/migration.c b/migration/migration.c index d61e5727429a..dd955c61acc7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2312,6 +2312,21 @@ static int migration_maybe_pause(MigrationState *s, return s->state == new_state ? 0 : -EINVAL; } +void migration_set_timestamp(MigrationDowntime type) +{ + MigrationState *s = migrate_get_current(); + + s->timestamp[type] = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); +} + +int64_t migration_get_timestamp(MigrationDowntime type) +{ + MigrationState *s = migrate_get_current(); + + return s->timestamp[type]; +} + + /** * migration_completion: Used by migration_thread when there's not much left. * The caller 'breaks' the loop when this returns. @@ -2325,7 +2340,7 @@ static void migration_completion(MigrationState *s) if (s->state == MIGRATION_STATUS_ACTIVE) { qemu_mutex_lock_iothread(); - s->downtime_start = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + migration_set_timestamp(MIGRATION_DOWNTIME_START); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); s->vm_old_state = runstate_get(); @@ -2670,7 +2685,7 @@ static void migration_calculate_complete(MigrationState *s) * It's still not set, so we are precopy migration. For * postcopy, downtime is calculated during postcopy_start(). */ - s->downtime = end_time - s->downtime_start; + s->downtime = end_time - migration_get_timestamp(MIGRATION_DOWNTIME_START); } transfer_time = s->total_time - s->setup_time; @@ -3069,7 +3084,8 @@ static void bg_migration_vm_start_bh(void *opaque) s->vm_start_bh = NULL; vm_start(); - s->downtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - s->downtime_start; + s->downtime = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - + migration_get_timestamp(MIGRATION_DOWNTIME_START); } /** @@ -3134,7 +3150,7 @@ static void *bg_migration_thread(void *opaque) s->setup_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; trace_migration_thread_setup_complete(); - s->downtime_start = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); + migration_set_timestamp(MIGRATION_DOWNTIME_START); qemu_mutex_lock_iothread(); From patchwork Tue Sep 26 16:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 1839835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-03-30 header.b=n3KYTulS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rw4hN4bMbz1ypM for ; Wed, 27 Sep 2023 02:19:48 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlAmG-0002eD-1D; Tue, 26 Sep 2023 12:19:12 -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 1qlAmB-0002dH-QS for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:07 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAm9-0004sc-QA for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:07 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFOqDc016260; Tue, 26 Sep 2023 16:19:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=ASmsvenoKJLPjaK3+00293q6yYqQ6YqFbMy57xo70lM=; b=n3KYTulSBcsR4AZCKf9Q2ijQwuanXEUy306PEuhmcVZ0BrDLhvHuUZV9SNwIRxIqLi8n gZBwGU7dIqKaur0A8u3G1+tPueY4zhTS0s1wQ43FKLi481xxqKFTbsyqLpoSnV+gye1d aJqUfFtZQAhytQB6S2m8rgN8nCDHUeO6J89+RbUfo853zzbSoYgoDyv2A8VTLh7OVmkf k5tofqI2lEBguUVJAxpEaP7A9kgUkCXj6jEgmUo6wspia+zZtfCjc1+aHXOj7zwqDQzt lATAtUumx1J89FeyxM7sb7sMJQQ1bGAxyn3CO/c7M84U2kXDb3vKUHAlXx4LI0yH470G nw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9qwbeysm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:03 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFSbA5039378; Tue, 26 Sep 2023 16:19:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfceahf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:01 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38QGIt9t007977; Tue, 26 Sep 2023 16:19:01 GMT Received: from joaomart-mac.uk.oracle.com (dhcp-10-175-210-190.vpn.oracle.com [10.175.210.190]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pfcea8h-3; Tue, 26 Sep 2023 16:19:01 +0000 From: Joao Martins To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Avihai Horon , Yishai Hadas , "Maciej S. Szmigiero" , Joao Martins Subject: [PATCH 2/5] migration: Collect more timestamps during switchover Date: Tue, 26 Sep 2023 17:18:38 +0100 Message-Id: <20230926161841.98464-3-joao.m.martins@oracle.com> In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com> References: <20230926161841.98464-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=821 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260143 X-Proofpoint-GUID: W1HvVASqUqA9uDeFo9XhKvlIUan4VRqx X-Proofpoint-ORIG-GUID: W1HvVASqUqA9uDeFo9XhKvlIUan4VRqx Received-SPF: pass client-ip=205.220.165.32; envelope-from=joao.m.martins@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In addition to the start of switchover (previously @downtime_start), add other timestamps during saving of state and return path. For precopy migration, it should be able to capture the principal steps of switchover. Resume-side downtime is sadly only possible when return path is enabled. Signed-off-by: Joao Martins --- qapi/migration.json | 16 +++++++++++++++- migration/migration.c | 5 +++++ migration/savevm.c | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index b836cc881d33..2d91fbcb22ff 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -199,10 +199,24 @@ # @start:Timestamp taken at the start of the switchover right before # we stop the VM. # +# @stop: Timestamp taken after stopping the VM. +# +# @precopy-iterable: Timestamp taken after copying all iterable state +# in stop copy phase. +# +# @precopy-noniterable: Timestamp taken after copying all non iterable +# state in stop copy phase. +# +# @resume-return-path: Timestamp taken after return path has finished +# migration on destination. It is zero if +# 'return-path' is not enabled. +# # Since: 8.2 ## { 'enum': 'MigrationDowntime', - 'data': [ 'start' ] } + 'data': [ 'start', 'stop', 'precopy-iterable', 'precopy-noniterable', + 'resume-return-path' ] } + ## # @MigrationInfo: diff --git a/migration/migration.c b/migration/migration.c index dd955c61acc7..d06840024a1e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2348,6 +2348,8 @@ static void migration_completion(MigrationState *s) ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); trace_migration_completion_vm_stop(ret); + migration_set_timestamp(MIGRATION_DOWNTIME_STOP); + if (ret >= 0) { ret = migration_maybe_pause(s, ¤t_active_state, MIGRATION_STATUS_DEVICE); @@ -2401,6 +2403,7 @@ static void migration_completion(MigrationState *s) trace_migration_return_path_end_before(); rp_error = await_return_path_close_on_source(s); trace_migration_return_path_end_after(rp_error); + migration_set_timestamp(MIGRATION_DOWNTIME_RESUME_RETURN_PATH); if (rp_error) { goto fail; } @@ -3166,6 +3169,8 @@ static void *bg_migration_thread(void *opaque) if (vm_stop_force_state(RUN_STATE_PAUSED)) { goto fail; } + migration_set_timestamp(MIGRATION_DOWNTIME_STOP); + /* * Put vCPUs in sync with shadow context structures, then * save their state to channel-buffer along with devices. diff --git a/migration/savevm.c b/migration/savevm.c index bb3e99194c60..e93701ff2393 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1468,6 +1468,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy) } } + migration_set_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE); return 0; } @@ -1524,6 +1525,7 @@ int qemu_savevm_state_complete_precopy_non_iterable(QEMUFile *f, json_writer_free(vmdesc); ms->vmdesc = NULL; + migration_set_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE); return 0; } From patchwork Tue Sep 26 16:18:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 1839836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-03-30 header.b=h68S3p0Y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rw4j53SsMz1ypD for ; Wed, 27 Sep 2023 02:20:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlAmI-0002f3-SA; Tue, 26 Sep 2023 12:19:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAmD-0002eA-J4 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:10 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAmB-0004tc-S6 for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:09 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFOrJc004897; Tue, 26 Sep 2023 16:19:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=Nv04R6yNkgD+tuQEbnhMF3LvSECmo7wziudX5w7LkpI=; b=h68S3p0YSo+NsMwJGXMbDM+Nvm557x58bTs3AL0FKSm3mWSzuGacOxKAQ7nDUhYFiQMo P9byEXM37blNZPvR3CmsJXiyyUZxaJeE+o+aIMjuhXy+krxRxsLBKvE7cokaRaw4DmHS f5qi9FKQMNG6i+lYubYG1Ync7wuGCVPnP44PEFqAZRXmGGbz2DwgPZHgH8dB1pYsDs4Q ZQSimwO2kF6GfSeko15BoeGZs/J3Y1LuBnGnhWfdq6ZN9emiwssETs12fyb/Z0o9lbuJ H6klHqk6w6rH/EOScCdCWO52c/dnmyWX7EXKQ/ZbGHgw6s9F8MktS2xL9aw7cA3wB0PP JQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9rjuf0n0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:06 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38QG5WYE039359; Tue, 26 Sep 2023 16:19:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfceanf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:04 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38QGIt9v007977; Tue, 26 Sep 2023 16:19:04 GMT Received: from joaomart-mac.uk.oracle.com (dhcp-10-175-210-190.vpn.oracle.com [10.175.210.190]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pfcea8h-4; Tue, 26 Sep 2023 16:19:04 +0000 From: Joao Martins To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Avihai Horon , Yishai Hadas , "Maciej S. Szmigiero" , Joao Martins Subject: [PATCH 3/5] migration: Add a tracepoint for the downtime stats Date: Tue, 26 Sep 2023 17:18:39 +0100 Message-Id: <20230926161841.98464-4-joao.m.martins@oracle.com> In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com> References: <20230926161841.98464-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=684 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260143 X-Proofpoint-ORIG-GUID: X8UoEt43sw3jT_Nc52lLlwsgv6YyqBrk X-Proofpoint-GUID: X8UoEt43sw3jT_Nc52lLlwsgv6YyqBrk Received-SPF: pass client-ip=205.220.165.32; envelope-from=joao.m.martins@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To facilitate understanding of what constitutes downtime, add a tracepoint that gives the downtime breakdown throughout all steps of switchover. Signed-off-by: Joao Martins --- migration/migration.c | 34 ++++++++++++++++++++++++++++++++++ migration/trace-events | 1 + 2 files changed, 35 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index d06840024a1e..4b5bed3eb09b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -893,6 +893,34 @@ static bool migrate_show_downtime(MigrationState *s) return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy(); } +static int64_t migrate_get_downtime_stop(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_STOP) - + migration_get_timestamp(MIGRATION_DOWNTIME_START); +} + +static int64_t migrate_get_downtime_precopy_iterable(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE) - + migration_get_timestamp(MIGRATION_DOWNTIME_STOP); +} + +static int64_t migrate_get_downtime_precopy_noniterable(MigrationState *s) +{ + return migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE) - + migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_ITERABLE); +} + +static int64_t migrate_get_downtime_resume_rp(MigrationState *s) +{ + if (migrate_return_path()) { + return migration_get_timestamp(MIGRATION_DOWNTIME_RESUME_RETURN_PATH) - + migration_get_timestamp(MIGRATION_DOWNTIME_PRECOPY_NONITERABLE); + } + + return 0; +} + static void populate_time_info(MigrationInfo *info, MigrationState *s) { info->has_status = true; @@ -2689,6 +2717,12 @@ static void migration_calculate_complete(MigrationState *s) * postcopy, downtime is calculated during postcopy_start(). */ s->downtime = end_time - migration_get_timestamp(MIGRATION_DOWNTIME_START); + + trace_source_downtime_stats(s->downtime, + migrate_get_downtime_stop(s), + migrate_get_downtime_precopy_iterable(s), + migrate_get_downtime_precopy_noniterable(s), + migrate_get_downtime_resume_rp(s)); } transfer_time = s->total_time - s->setup_time; diff --git a/migration/trace-events b/migration/trace-events index 4666f19325e7..163dc74bc49a 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -189,6 +189,7 @@ migrate_transferred(uint64_t transferred, uint64_t time_spent, uint64_t bandwidt process_incoming_migration_co_end(int ret, int ps) "ret=%d postcopy-state=%d" process_incoming_migration_co_postcopy_end_main(void) "" postcopy_preempt_enabled(bool value) "%d" +source_downtime_stats(int64_t downtime, int64_t stop, int64_t iterable, int64_t non_iterable, int64_t resume_rp) "downtime %"PRIi64": stop %"PRIi64" iterable %"PRIi64" non_iterable %"PRIi64" resume-rp %"PRIi64 # migration-stats migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd) "qemu_file %" PRIu64 " multifd %" PRIu64 From patchwork Tue Sep 26 16:18:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 1839833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-03-30 header.b=dHmBzOEw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rw4hJ452rz1ypM for ; Wed, 27 Sep 2023 02:19:44 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlAmK-0002fk-46; Tue, 26 Sep 2023 12:19:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAmG-0002eW-2J for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:14 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAmE-0004uQ-Cs for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:11 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFOr1S004915; Tue, 26 Sep 2023 16:19:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=gn4dQOb4UWnQxT6KvxYcwBPjvAyQPEHZNwf3F6AsY24=; b=dHmBzOEwDavYVszmxS52aXMbJOeAfSqM9syX49vEhGPY3+VjPd5H5phfeZeNKjuD5kqb oxziXjW+nwNQN89ScSL44X91TKyYduCMeIYJ+p/gfpfaSuh/2VSC1hSytXw8L75ILr2X 6+QxZJRb28qm+2sBnm4Gj2E9g8GzKFOlm3nKu3YslNdomHbbvjtevL3UF2gkUdPqab6w 5JpCNhJBQlNwLZCQtrI5l2C9iUfxCvBRCK7m2yHo8PFXFJnLNBEjN8JTOSQoMg9cOZEw SN5VDZxzl5PReXVWRhLJf0nfq+P/RmVKzBXcnMrcun4YuWiOGQVL83dl3g1uE9uSUUmz DA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9rjuf0n1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:08 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38QG2Ot7039388; Tue, 26 Sep 2023 16:19:07 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfcear2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:07 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38QGIt9x007977; Tue, 26 Sep 2023 16:19:07 GMT Received: from joaomart-mac.uk.oracle.com (dhcp-10-175-210-190.vpn.oracle.com [10.175.210.190]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pfcea8h-5; Tue, 26 Sep 2023 16:19:07 +0000 From: Joao Martins To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Avihai Horon , Yishai Hadas , "Maciej S. Szmigiero" , Joao Martins Subject: [PATCH 4/5] migration: Provide QMP access to downtime stats Date: Tue, 26 Sep 2023 17:18:40 +0100 Message-Id: <20230926161841.98464-5-joao.m.martins@oracle.com> In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com> References: <20230926161841.98464-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=693 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260143 X-Proofpoint-ORIG-GUID: fCW5Nzasz9U4PD6Rq3ejiA1x2WSBShwa X-Proofpoint-GUID: fCW5Nzasz9U4PD6Rq3ejiA1x2WSBShwa Received-SPF: pass client-ip=205.220.165.32; envelope-from=joao.m.martins@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Deliver the downtime breakdown also via `query-migrate` to allow users to understand what their downtime value represents. Signed-off-by: Joao Martins --- qapi/migration.json | 22 ++++++++++++++++++++++ migration/migration.c | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/qapi/migration.json b/qapi/migration.json index 2d91fbcb22ff..088e1b2bf440 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -217,6 +217,27 @@ 'data': [ 'start', 'stop', 'precopy-iterable', 'precopy-noniterable', 'resume-return-path' ] } +## +# @DowntimeStats: +# +# Detailed migration downtime statistics. +# +# @stop: Time taken to stop the VM during switchover. +# +# @precopy: Time taken to save all precopy state during switchover. +# +# @precopy-iterable: Time taken to save all precopy iterable state. +# +# @precopy-noniterable: Time taken to save all precopy non iterable state. +# +# @resume-return-path: Time taken to resume if return path is enabled, +# otherwise zero. +# +# Since: 8.2 +## +{ 'struct': 'DowntimeStats', + 'data': {'stop': 'int64', 'precopy': 'int64', 'precopy-iterable': 'int64', + 'precopy-noniterable': 'int64', 'resume-return-path': 'int64' } } ## # @MigrationInfo: @@ -308,6 +329,7 @@ '*total-time': 'int', '*expected-downtime': 'int', '*downtime': 'int', + '*downtime-stats': 'DowntimeStats', '*setup-time': 'int', '*cpu-throttle-percentage': 'int', '*error-desc': 'str', diff --git a/migration/migration.c b/migration/migration.c index 4b5bed3eb09b..dec6c88fbff9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -921,6 +921,19 @@ static int64_t migrate_get_downtime_resume_rp(MigrationState *s) return 0; } +static void populate_downtime_info(MigrationInfo *info, MigrationState *s) +{ + DowntimeStats *stats; + + info->downtime_stats = g_malloc0(sizeof(*info->downtime_stats)); + stats = info->downtime_stats; + stats->stop = migrate_get_downtime_stop(s); + stats->precopy_iterable = migrate_get_downtime_precopy_iterable(s); + stats->precopy_noniterable = migrate_get_downtime_precopy_noniterable(s); + stats->precopy = stats->precopy_iterable + stats->precopy_noniterable; + stats->resume_return_path = migrate_get_downtime_resume_rp(s); +} + static void populate_time_info(MigrationInfo *info, MigrationState *s) { info->has_status = true; @@ -939,6 +952,7 @@ static void populate_time_info(MigrationInfo *info, MigrationState *s) if (migrate_show_downtime(s)) { info->has_downtime = true; info->downtime = s->downtime; + populate_downtime_info(info, s); } else { info->has_expected_downtime = true; info->expected_downtime = s->expected_downtime; From patchwork Tue Sep 26 16:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 1839834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-03-30 header.b=zRq9T7Sw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rw4hN3CV5z1ynX for ; Wed, 27 Sep 2023 02:19:48 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlAmL-0002gM-Q0; Tue, 26 Sep 2023 12:19:17 -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 1qlAmK-0002fj-1f for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:16 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlAmI-0004v5-Gb for qemu-devel@nongnu.org; Tue, 26 Sep 2023 12:19:15 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFOkfu007544; Tue, 26 Sep 2023 16:19:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=EoifFSgy6KyJSPmQ5XrH+l71SCAXSUA4VrQyatL5zWM=; b=zRq9T7SwxXvUbbDxbS3qan2EfLtLB2G7gefaLBNMVTE0NI8zcJ3X73lgSQVm7dH5rILg zAxn8jOMhC2VeaEAwd6fDyOTUDsOy0Rv9EoUsisg3VACKCEas1olV1JhVWUdYhU4HljA wxBYGhFXT/L/1WU8VpeYer6l+iRTRPbEYnF7ftmtLJjPxgLvQcRZgW00NyuVN0ot92N+ afQkMqRuwGKwkp8S2TqmrZHJkOM3o/r7mCXCxnxj2uoJK0fpu0B9dEjbCk/hHOvn7Mug pquj1y4L1lIk+fclwkO7DWK1KBmw3Xk8hJ65skcP4VeOtufxf7r63F/OYoECzFupQ1Vc MA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t9pm2745t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:11 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38QFAD1O039362; Tue, 26 Sep 2023 16:19:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t9pfceatb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Sep 2023 16:19:10 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38QGItA1007977; Tue, 26 Sep 2023 16:19:09 GMT Received: from joaomart-mac.uk.oracle.com (dhcp-10-175-210-190.vpn.oracle.com [10.175.210.190]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t9pfcea8h-6; Tue, 26 Sep 2023 16:19:09 +0000 From: Joao Martins To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Eric Blake , Markus Armbruster , Avihai Horon , Yishai Hadas , "Maciej S. Szmigiero" , Joao Martins Subject: [PATCH 5/5] migration: Print expected-downtime on completion Date: Tue, 26 Sep 2023 17:18:41 +0100 Message-Id: <20230926161841.98464-6-joao.m.martins@oracle.com> In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com> References: <20230926161841.98464-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-26_13,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309260143 X-Proofpoint-ORIG-GUID: 8sMUgqTUet7VPmvTOrDWDF0QXRs_8_Xl X-Proofpoint-GUID: 8sMUgqTUet7VPmvTOrDWDF0QXRs_8_Xl Received-SPF: pass client-ip=205.220.165.32; envelope-from=joao.m.martins@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Right now, migration statistics either print downtime or expected downtime depending on migration completing of in progress. Also in the beginning of migration by printing the downtime limit as expected downtime, when estimation is not available. The pending_size is private in migration iteration and not necessarily accessible outside. Given the non-determinism of the switchover cost, it can be useful to understand if the downtime was far off from the one detected by the migration algoritm, thus print the resultant downtime alongside its estimation. Signed-off-by: Joao Martins --- migration/migration.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index dec6c88fbff9..f08f65b4b1c3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -943,6 +943,10 @@ static void populate_time_info(MigrationInfo *info, MigrationState *s) if (s->state == MIGRATION_STATUS_COMPLETED) { info->has_total_time = true; info->total_time = s->total_time; + if (s->expected_downtime) { + info->has_expected_downtime = true; + info->expected_downtime = s->expected_downtime; + } } else { info->has_total_time = true; info->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - @@ -2844,6 +2848,10 @@ static MigIterateState migration_iteration_run(MigrationState *s) if ((!pending_size || pending_size < s->threshold_size) && can_switchover) { trace_migration_thread_low_pending(pending_size); + if (s->threshold_size) { + s->expected_downtime = (pending_size * s->parameters.downtime_limit) / + s->threshold_size; + } migration_completion(s); return MIG_ITERATE_BREAK; }