Blame SOURCES/kvm-rdma-account-for-the-time-spent-in-MIG_STATE_SETUP-t.patch

0a122b
From 55c36d5525751d4b2676e206680762769758d934 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <55c36d5525751d4b2676e206680762769758d934.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:52:55 +0100
0a122b
Subject: [PATCH 19/46] rdma: account for the time spent in MIG_STATE_SETUP
0a122b
 through QMP
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-20-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55701
0a122b
O-Subject: [RHEL7.0 PATCH 19/42] rdma: account for the time spent in MIG_STATE_SETUP through QMP
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit ed4fbd10823a7b0dbded6b481a68973e47f7e14d
0a122b
Author: Michael R. Hines <mrhines@us.ibm.com>
0a122b
Date:   Mon Jul 22 10:01:58 2013 -0400
0a122b
0a122b
    rdma: account for the time spent in MIG_STATE_SETUP through QMP
0a122b
0a122b
    Using the previous patches, we're now able to timestamp the SETUP
0a122b
    state. Once we have this time, let the user know about it in the
0a122b
    schema.
0a122b
0a122b
    Reviewed-by: Juan Quintela <quintela@redhat.com>
0a122b
    Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
---
0a122b
 hmp.c                         |    4 ++++
0a122b
 include/migration/migration.h |    1 +
0a122b
 migration.c                   |    9 +++++++++
0a122b
 qapi-schema.json              |    9 ++++++++-
0a122b
 4 files changed, 22 insertions(+), 1 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hmp.c                         | 4 ++++
0a122b
 include/migration/migration.h | 1 +
0a122b
 migration.c                   | 9 +++++++++
0a122b
 qapi-schema.json              | 9 ++++++++-
0a122b
 4 files changed, 22 insertions(+), 1 deletion(-)
0a122b
0a122b
diff --git a/hmp.c b/hmp.c
0a122b
index 316e6a1..841929d 100644
0a122b
--- a/hmp.c
0a122b
+++ b/hmp.c
0a122b
@@ -162,6 +162,10 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
0a122b
             monitor_printf(mon, "downtime: %" PRIu64 " milliseconds\n",
0a122b
                            info->downtime);
0a122b
         }
0a122b
+        if (info->has_setup_time) {
0a122b
+            monitor_printf(mon, "setup: %" PRIu64 " milliseconds\n",
0a122b
+                           info->setup_time);
0a122b
+        }
0a122b
     }
0a122b
 
0a122b
     if (info->has_ram) {
0a122b
diff --git a/include/migration/migration.h b/include/migration/migration.h
0a122b
index 13a9629..08c772d 100644
0a122b
--- a/include/migration/migration.h
0a122b
+++ b/include/migration/migration.h
0a122b
@@ -49,6 +49,7 @@ struct MigrationState
0a122b
     int64_t dirty_bytes_rate;
0a122b
     bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
0a122b
     int64_t xbzrle_cache_size;
0a122b
+    int64_t setup_time;
0a122b
 };
0a122b
 
0a122b
 void process_incoming_migration(QEMUFile *f);
0a122b
diff --git a/migration.c b/migration.c
0a122b
index ddbfd45..4f070a3 100644
0a122b
--- a/migration.c
0a122b
+++ b/migration.c
0a122b
@@ -191,6 +191,7 @@ MigrationInfo *qmp_query_migrate(Error **errp)
0a122b
     case MIG_STATE_SETUP:
0a122b
         info->has_status = true;
0a122b
         info->status = g_strdup("setup");
0a122b
+        info->has_total_time = false;
0a122b
         break;
0a122b
     case MIG_STATE_ACTIVE:
0a122b
         info->has_status = true;
0a122b
@@ -200,6 +201,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
0a122b
             - s->total_time;
0a122b
         info->has_expected_downtime = true;
0a122b
         info->expected_downtime = s->expected_downtime;
0a122b
+        info->has_setup_time = true;
0a122b
+        info->setup_time = s->setup_time;
0a122b
 
0a122b
         info->has_ram = true;
0a122b
         info->ram = g_malloc0(sizeof(*info->ram));
0a122b
@@ -232,6 +235,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
0a122b
         info->total_time = s->total_time;
0a122b
         info->has_downtime = true;
0a122b
         info->downtime = s->downtime;
0a122b
+        info->has_setup_time = true;
0a122b
+        info->setup_time = s->setup_time;
0a122b
 
0a122b
         info->has_ram = true;
0a122b
         info->ram = g_malloc0(sizeof(*info->ram));
0a122b
@@ -548,6 +553,7 @@ static void *migration_thread(void *opaque)
0a122b
 {
0a122b
     MigrationState *s = opaque;
0a122b
     int64_t initial_time = qemu_get_clock_ms(rt_clock);
0a122b
+    int64_t setup_start = qemu_get_clock_ms(host_clock);
0a122b
     int64_t initial_bytes = 0;
0a122b
     int64_t max_size = 0;
0a122b
     int64_t start_time = initial_time;
0a122b
@@ -556,8 +562,11 @@ static void *migration_thread(void *opaque)
0a122b
     DPRINTF("beginning savevm\n");
0a122b
     qemu_savevm_state_begin(s->file, &s->params);
0a122b
 
0a122b
+    s->setup_time = qemu_get_clock_ms(host_clock) - setup_start;
0a122b
     migrate_set_state(s, MIG_STATE_SETUP, MIG_STATE_ACTIVE);
0a122b
 
0a122b
+    DPRINTF("setup complete\n");
0a122b
+
0a122b
     while (s->state == MIG_STATE_ACTIVE) {
0a122b
         int64_t current_time;
0a122b
         uint64_t pending_size;
0a122b
diff --git a/qapi-schema.json b/qapi-schema.json
0a122b
index bf1fe68..7333b8f 100644
0a122b
--- a/qapi-schema.json
0a122b
+++ b/qapi-schema.json
0a122b
@@ -634,6 +634,12 @@
0a122b
 #        expected downtime in milliseconds for the guest in last walk
0a122b
 #        of the dirty bitmap. (since 1.3)
0a122b
 #
0a122b
+# @setup-time: #optional amount of setup time in milliseconds _before_ the
0a122b
+#        iterations begin but _after_ the QMP command is issued. This is designed
0a122b
+#        to provide an accounting of any activities (such as RDMA pinning) which
0a122b
+#        may be expensive, but do not actually occur during the iterative
0a122b
+#        migration rounds themselves. (since 1.6)
0a122b
+#
0a122b
 # Since: 0.14.0
0a122b
 ##
0a122b
 { 'type': 'MigrationInfo',
0a122b
@@ -642,7 +648,8 @@
0a122b
            '*xbzrle-cache': 'XBZRLECacheStats',
0a122b
            '*total-time': 'int',
0a122b
            '*expected-downtime': 'int',
0a122b
-           '*downtime': 'int'} }
0a122b
+           '*downtime': 'int',
0a122b
+           '*setup-time': 'int'} }
0a122b
 
0a122b
 ##
0a122b
 # @query-migrate
0a122b
-- 
0a122b
1.7.11.7
0a122b