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 3/5] migration: Add a tracepoint for the downtime stats
Date: Tue, 26 Sep 2023 17:18:39 +0100 [thread overview]
Message-ID: <20230926161841.98464-4-joao.m.martins@oracle.com> (raw)
In-Reply-To: <20230926161841.98464-1-joao.m.martins@oracle.com>
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 <joao.m.martins@oracle.com>
---
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
--
2.39.3
next prev parent reply other threads:[~2023-09-26 16:20 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 ` [PATCH 2/5] migration: Collect more timestamps during switchover Joao Martins
2023-09-26 16:18 ` Joao Martins [this message]
2023-09-26 16:18 ` [PATCH 4/5] migration: Provide QMP access to downtime stats 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-4-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).