qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] augment info migrate with page status
@ 2009-05-20 23:20 Glauber Costa
  2009-05-21 10:22 ` Dor Laor
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Glauber Costa @ 2009-05-20 23:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

This patch augments info migrate output with status about:
* pages remaining
* pages transferred

This should be enough for management tools to realize
whether or not there is progress in migration. We can
add more information later on, if the need arrives

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 migration.c |    2 ++
 sysemu.h    |    6 ++++++
 vl.c        |   13 +++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/migration.c b/migration.c
index b9e3368..88d63c0 100644
--- a/migration.c
+++ b/migration.c
@@ -116,6 +116,8 @@ void do_info_migrate(Monitor *mon)
         switch (s->get_status(s)) {
         case MIG_STATE_ACTIVE:
             monitor_printf(mon, "active\n");
+            monitor_printf(mon, "remaining ram pages: %u\n", ram_save_remaining());
+            monitor_printf(mon, "transferred ram pages: %u\n", ram_save_transferred());
             break;
         case MIG_STATE_COMPLETED:
             monitor_printf(mon, "completed\n");
diff --git a/sysemu.h b/sysemu.h
index 7d65804..76ab84b 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -28,6 +28,12 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_start(void);
 void vm_stop(int reason);
 
+#ifdef NEED_CPU_H
+#include "cpu-defs.h"
+ram_addr_t ram_save_remaining(void);
+ram_addr_t ram_save_transferred(void);
+#endif
+
 int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
 void cpu_disable_ticks(void);
diff --git a/vl.c b/vl.c
index 9f25cd4..97a1bc6 100644
--- a/vl.c
+++ b/vl.c
@@ -3236,8 +3236,9 @@ static int ram_save_block(QEMUFile *f)
 }
 
 static ram_addr_t ram_save_threshold = 10;
+static ram_addr_t pages_transferred = 0;
 
-static ram_addr_t ram_save_remaining(void)
+ram_addr_t ram_save_remaining(void)
 {
     ram_addr_t addr;
     ram_addr_t count = 0;
@@ -3250,6 +3251,11 @@ static ram_addr_t ram_save_remaining(void)
     return count;
 }
 
+ram_addr_t ram_save_transferred(void)
+{
+    return pages_transferred;
+}
+
 static int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
@@ -3271,6 +3277,7 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
         int ret;
 
         ret = ram_save_block(f);
+        pages_transferred += ret;
         if (ret == 0) /* no more blocks */
             break;
     }
@@ -3280,7 +3287,9 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
     if (stage == 3) {
 
         /* flush all remaining blocks regardless of rate limiting */
-        while (ram_save_block(f) != 0);
+        while (ram_save_block(f) != 0) {
+            pages_transferred++;
+        }
         cpu_physical_memory_set_dirty_tracking(0);
     }
 
-- 
1.5.6.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH] augment info migrate with page status
@ 2009-05-21 18:26 Glauber Costa
  0 siblings, 0 replies; 13+ messages in thread
From: Glauber Costa @ 2009-05-21 18:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

This patch augments info migrate output with status about:
* ram bytes remaining
* ram bytes transferred
* ram bytes total

This should be enough for management tools to realize
whether or not there is progress in migration. We can
add more information later on, if the need arrives

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 migration.c |    3 +++
 sysemu.h    |    4 ++++
 vl.c        |   21 ++++++++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/migration.c b/migration.c
index b9e3368..a771f37 100644
--- a/migration.c
+++ b/migration.c
@@ -116,6 +116,9 @@ void do_info_migrate(Monitor *mon)
         switch (s->get_status(s)) {
         case MIG_STATE_ACTIVE:
             monitor_printf(mon, "active\n");
+            monitor_printf(mon, "transferred ram: %lu kbytes\n", ram_bytes_transferred() >> 10);
+            monitor_printf(mon, "remaining ram: %lu kbytes\n", ram_bytes_remaining() >> 10);
+            monitor_printf(mon, "total ram: %lu kbytes\n", ram_bytes_total() >> 10);
             break;
         case MIG_STATE_COMPLETED:
             monitor_printf(mon, "completed\n");
diff --git a/sysemu.h b/sysemu.h
index 7d65804..73f63df 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -28,6 +28,10 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_start(void);
 void vm_stop(int reason);
 
+unsigned long ram_bytes_remaining(void);
+unsigned long ram_bytes_transferred(void);
+unsigned long ram_bytes_total(void);
+
 int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
 void cpu_disable_ticks(void);
diff --git a/vl.c b/vl.c
index d84ecef..74ad688 100644
--- a/vl.c
+++ b/vl.c
@@ -3236,6 +3236,7 @@ static int ram_save_block(QEMUFile *f)
 }
 
 static ram_addr_t ram_save_threshold = 10;
+static ram_addr_t bytes_transferred = 0;
 
 static ram_addr_t ram_save_remaining(void)
 {
@@ -3250,6 +3251,21 @@ static ram_addr_t ram_save_remaining(void)
     return count;
 }
 
+unsigned long ram_bytes_remaining(void)
+{
+    return ram_save_remaining() * TARGET_PAGE_SIZE;
+}
+
+unsigned long ram_bytes_transferred(void)
+{
+    return bytes_transferred;
+}
+
+unsigned long ram_bytes_total(void)
+{
+    return last_ram_offset;
+}
+
 static int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
@@ -3271,6 +3287,7 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
         int ret;
 
         ret = ram_save_block(f);
+        bytes_transferred += ret * TARGET_PAGE_SIZE;
         if (ret == 0) /* no more blocks */
             break;
     }
@@ -3280,7 +3297,9 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
     if (stage == 3) {
 
         /* flush all remaining blocks regardless of rate limiting */
-        while (ram_save_block(f) != 0);
+        while (ram_save_block(f) != 0) {
+            bytes_transferred += TARGET_PAGE_SIZE;
+        }
         cpu_physical_memory_set_dirty_tracking(0);
     }
 
-- 
1.5.6.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [Qemu-devel] [PATCH] augment info migrate with page status
@ 2009-05-21 19:17 Glauber Costa
  0 siblings, 0 replies; 13+ messages in thread
From: Glauber Costa @ 2009-05-21 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

This patch augments info migrate output with status about:
* ram bytes remaining
* ram bytes transferred
* ram bytes total

This should be enough for management tools to realize
whether or not there is progress in migration. We can
add more information later on, if the need arrives

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 migration.c |    3 +++
 sysemu.h    |    4 ++++
 vl.c        |   21 ++++++++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/migration.c b/migration.c
index b9e3368..401383c 100644
--- a/migration.c
+++ b/migration.c
@@ -116,6 +116,9 @@ void do_info_migrate(Monitor *mon)
         switch (s->get_status(s)) {
         case MIG_STATE_ACTIVE:
             monitor_printf(mon, "active\n");
+            monitor_printf(mon, "transferred ram: %" PRIu64 " kbytes\n", ram_bytes_transferred() >> 10);
+            monitor_printf(mon, "remaining ram: %" PRIu64 " kbytes\n", ram_bytes_remaining() >> 10);
+            monitor_printf(mon, "total ram: %" PRIu64 " kbytes\n", ram_bytes_total() >> 10);
             break;
         case MIG_STATE_COMPLETED:
             monitor_printf(mon, "completed\n");
diff --git a/sysemu.h b/sysemu.h
index 7d65804..fdf0971 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -28,6 +28,10 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_start(void);
 void vm_stop(int reason);
 
+uint64_t ram_bytes_remaining(void);
+uint64_t ram_bytes_transferred(void);
+uint64_t ram_bytes_total(void);
+
 int64_t cpu_get_ticks(void);
 void cpu_enable_ticks(void);
 void cpu_disable_ticks(void);
diff --git a/vl.c b/vl.c
index d84ecef..95c268f 100644
--- a/vl.c
+++ b/vl.c
@@ -3236,6 +3236,7 @@ static int ram_save_block(QEMUFile *f)
 }
 
 static ram_addr_t ram_save_threshold = 10;
+static ram_addr_t bytes_transferred = 0;
 
 static ram_addr_t ram_save_remaining(void)
 {
@@ -3250,6 +3251,21 @@ static ram_addr_t ram_save_remaining(void)
     return count;
 }
 
+uint64_t ram_bytes_remaining(void)
+{
+    return ram_save_remaining() * TARGET_PAGE_SIZE;
+}
+
+uint64_t ram_bytes_transferred(void)
+{
+    return bytes_transferred;
+}
+
+uint64_t ram_bytes_total(void)
+{
+    return last_ram_offset;
+}
+
 static int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
@@ -3271,6 +3287,7 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
         int ret;
 
         ret = ram_save_block(f);
+        bytes_transferred += ret * TARGET_PAGE_SIZE;
         if (ret == 0) /* no more blocks */
             break;
     }
@@ -3280,7 +3297,9 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)
     if (stage == 3) {
 
         /* flush all remaining blocks regardless of rate limiting */
-        while (ram_save_block(f) != 0);
+        while (ram_save_block(f) != 0) {
+            bytes_transferred += TARGET_PAGE_SIZE;
+        }
         cpu_physical_memory_set_dirty_tracking(0);
     }
 
-- 
1.5.6.6

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-05-22  0:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-20 23:20 [Qemu-devel] [PATCH] augment info migrate with page status Glauber Costa
2009-05-21 10:22 ` Dor Laor
2009-05-21 13:14   ` Anthony Liguori
2009-05-21 13:52   ` Glauber Costa
2009-05-21 14:40     ` Avi Kivity
2009-05-21 14:05 ` Daniel P. Berrange
2009-05-21 14:20   ` Glauber Costa
2009-05-21 14:58   ` Avi Kivity
2009-05-21 15:04     ` Daniel P. Berrange
2009-05-21 16:07       ` Glauber Costa
2009-05-21 23:41 ` [Qemu-devel] QEMU Official OS Support PAge Natalia Portillo
  -- strict thread matches above, loose matches on Subject: below --
2009-05-21 18:26 [Qemu-devel] [PATCH] augment info migrate with page status Glauber Costa
2009-05-21 19:17 Glauber Costa

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).