thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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