From: Joao Martins <joao.m.martins@oracle.com>
To: qemu-devel@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
Leonardo Bras <leobras@redhat.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Avihai Horon <avihaih@nvidia.com>,
Yishai Hadas <yishaih@nvidia.com>,
"Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>,
Joao Martins <joao.m.martins@oracle.com>
Subject: [PATCH 2/5] migration: Collect more timestamps during switchover
Date: Tue, 26 Sep 2023 17:18:38 +0100 [thread overview]
Message-ID: <20230926161841.98464-3-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com>
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 <joao.m.martins@oracle.com>
---
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;
}
--
2.39.3
next prev parent reply other threads:[~2023-09-26 16:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 16:18 [PATCH 0/5] migration: Downtime observability improvements Joao Martins
2023-09-26 16:18 ` [PATCH 1/5] migration: Store downtime timestamps in an array Joao Martins
2023-09-28 1:55 ` Wang, Lei
2023-09-28 13:31 ` Joao Martins
2023-09-26 16:18 ` Joao Martins [this message]
2023-09-26 16:18 ` [PATCH 3/5] migration: Add a tracepoint for the downtime stats Joao Martins
2023-09-26 16:18 ` [PATCH 4/5] migration: Provide QMP access to " Joao Martins
2023-10-04 17:10 ` Peter Xu
2023-10-06 11:37 ` Joao Martins
2023-10-06 14:27 ` Peter Xu
2023-09-26 16:18 ` [PATCH 5/5] migration: Print expected-downtime on completion Joao Martins
2023-10-04 19:33 ` Peter Xu
2023-10-06 11:45 ` Joao Martins
2023-10-31 13:14 ` Juan Quintela
2023-11-02 10:22 ` Joao Martins
2023-10-04 17:19 ` [PATCH 0/5] migration: Downtime observability improvements Peter Xu
2023-10-06 11:39 ` Joao Martins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230926161841.98464-3-joao.m.martins@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=armbru@redhat.com \
--cc=avihaih@nvidia.com \
--cc=eblake@redhat.com \
--cc=leobras@redhat.com \
--cc=maciej.szmigiero@oracle.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yishaih@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).