Migration stats
v2 cover Migration stats
Hi
v2:
- rebase on top of master
- apply all review comments for Eric & Luiz (1st time writting Eric correctly)
- dropped dirty_pages_rate: requires migration bitmap changes
- add examples were missing
- get feedback from several people that they were useful
- Intregrated migration bitmap sync, otherwise, we are transferring unmapped pages twice
- once there, minimal g_realloc() not needed NULL test
Please comment
v1:
This modifies the output of info migrate/qmp_query_migrate to add the stats that I got request for.
- It moves total time to MigrationInfo instead of ram (luiz suggestion)
- Prints the real downtime that we have had
really, it prints the total downtime of the complete phase, but the downtime also includes the last ram_iterate phase. Working on fixing that one.
- Prints the expected downtime of the last time that w e synchronized
the dirty bitmap with kvm. So we have one idea of what downtime value we need for migration to converge.
- Prints the dirty_pages_rate, that is the number of pages that we have written in the last second. This one prints always zero. To fill it, I need the dirty bitmap changes on the migration_thread series.
The following changes since commit 731dc9ecd4f2c3041538f7eb2d10eee0cb82da1b:
Update version to 1.2.0-rc0 (2012-08-16 13:56:34 -0500)
are available in the git repository at:
ssh://repo.or.cz/srv/git/qemu/quintela.git migration-next-20120819
for you to fetch changes up to 0fad89c1f4e6d4e48ab786acc3aa18e171b0fab2:
migration: print expected downtime in info migrate (2012-08-18 12:40:36 +0200)
(Yes, I don't know in what day I live and put 19 instead of 18th. It is not that the patches are coming from the future O:-)
Juan Quintela (8):
buffered_file: g_realloc() can't fail
fix migration sync
migration: move total_time from ram stats to migration info
migration: store end_time in a local variable
migration: print total downtime for final phase of migration
migration: rename expected_time to expected_downtime
migration: export migrate_get_current()
migration: print expected downtime in info migrate
arch_init.c | 20 ++++++++++++-------- buffered_file.c | 10 +--------- hmp.c | 12 ++++++++++-- migration.c | 18 +++++++++++++----- migration.h | 3 +++ qapi-schema.json | 24 +++++++++++++++++------- qmp-commands.hx | 15 ++++++++++++--- 7 files changed, 68 insertions(+), 34 deletions(-)
Signature · 1 line
1.7.11.2
PATCH v2 1/8 buffered_file: g_realloc() can't fail
--- buffered_file.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
buffered_file.c +1 -9
@@ -50,20 +50,12 @@ static void buffered_append(QEMUFileBuffered *s, const uint8_t *buf, size_t size) { if (size > (s->buffer_capacity - s->buffer_size)) { - void *tmp; -DPRINTF ("increasing buffer capacity from %zu by %zu\n" , s->buffer_capacity, size +1024 ); s->buffer_capacity += size +1024 ; - tmp =g_realloc (s->buffer, s->buffer_capacity); -if (tmp ==NULL ) { -fprintf (stderr,"qemu file buffer expansion failed\n" ); -exit (1 ); - } - - s->buffer = tmp; + s->buffer =g_realloc (s->buffer, s->buffer_capacity); }memcpy (s->buffer + s->buffer_size, buf, size);
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 1/8] buffered_file: g_realloc() can't fail
Quoted 22 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- buffered_file.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)buffered_file.c +0
-3@@ -50,20 +50,12 @@ static void buffered_append(QEMUFileBuffered *s, const uint8_t *buf, size_t size) { if (size > (s->buffer_capacity - s->buffer_size)) { - void *tmp; -DPRINTF ("increasing buffer capacity from %zu by %zu\n" , s->buffer_capacity, size +1024 ); s->buffer_capacity += size +1024 ; - tmp =g_realloc (s->buffer, s->buffer_capacity);
buffered_file.c static void buffered_append(QEMUFileBuffered *s, · line 61
Quoted 10 lines
buffered_file.c +1
-6-if (tmp ==NULL ) { -fprintf (stderr,"qemu file buffer expansion failed\n" ); -exit (1 ); - } - - s->buffer = tmp; + s->buffer =g_realloc (s->buffer, s->buffer_capacity); }memcpy (s->buffer + s->buffer_size, buf, size);
PATCH v2 2/8 fix migration sync
In reply to Juan Quintela--- arch_init.c | 1 + 1 file changed, 1 insertion(+)
arch_init.c +1 -0
@@ -488,6 +488,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)ram_addr_t addr;RAMBlock *block; +memory_global_sync_dirty_bitmap (get_system_memory ()); bytes_transferred =0 ; last_block =NULL ; last_offset =0 ;
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 2/8] fix migration sync
Quoted 11 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- arch_init.c | 1 + 1 file changed, 1 insertion(+)arch_init.c +0
-0
arch_init.c static int ram_save_setup(QEMUFile *f, void *opaque) · line 494
Quoted 7 lines
arch_init.c +1
-0@@ -488,6 +488,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)ram_addr_t addr;RAMBlock *block; +memory_global_sync_dirty_bitmap (get_system_memory ()); bytes_transferred =0 ; last_block =NULL ; last_offset =0 ;
PATCH v2 3/8 migration: move total_time from ram stats to migration info
In reply to Juan Quintela--- hmp.c | 4 ++-- migration.c | 6 +++--- qapi-schema.json | 14 +++++++------- qmp-commands.hx | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-)
hmp.c +2 -2
@@ -149,6 +149,8 @@ void hmp_info_migrate(Monitor *mon)if (info->has_status) {monitor_printf (mon,"Migration status: %s\n" , info->status); +monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , + info->total_time); }if (info->has_ram) {
@@ -158,8 +160,6 @@ void hmp_info_migrate(Monitor *mon) info->ram->remaining >> 10);monitor_printf (mon,"total ram: %" PRIu64" kbytes\n" , info->ram->total >>10 ); -monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , - info->ram->total_time);monitor_printf (mon,"duplicate: %" PRIu64" pages\n" , info->ram->duplicate); monitor_printf(mon, "normal: %" PRIu64 " pages\n",
migration.c +3 -3
@@ -166,14 +166,14 @@ MigrationInfo *qmp_query_migrate(Error **errp)case MIG_STATE_ACTIVE : info->has_status = true; info->status =g_strdup ("active" ); + info->total_time =qemu_get_clock_ms (rt_clock) + - s->total_time; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram)); info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =ram_bytes_remaining (); info->ram->total =ram_bytes_total (); - info->ram->total_time =qemu_get_clock_ms (rt_clock) - - s->total_time; info->ram->duplicate =dup_mig_pages_transferred (); info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred ();
@@ -193,13 +193,13 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->has_status = true; info->status =g_strdup ("completed" ); + info->total_time = s->total_time; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram)); info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =0 ; info->ram->total =ram_bytes_total (); - info->ram->total_time = s->total_time; info->ram->duplicate =dup_mig_pages_transferred (); info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred ();
qapi-schema.json +7 -7
@@ -290,10 +290,6 @@ # # @total: total amount of bytes involved in the migration process # -# @total-time: total amount of ms since migration started. If -# migration has ended, it returns the total migration -# time. (since 1.2) -# # @duplicate: number of duplicate pages (since 1.2) # # @normal : number of normal pages (since 1.2)
@@ -304,8 +300,7 @@ ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'total-time': 'int', 'duplicate': 'int', 'normal': 'int', - 'normal-bytes': 'int' } } + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } } ## # @XBZRLECacheStats
@@ -350,12 +345,17 @@ # migration statistics, only returned if XBZRLE feature is on and # status is 'active' or 'completed' (since 1.2) # +# @total-time: total amount of milliseconds since migration started. +# If migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', - '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} } ## # @query-migrate
qmp-commands.hx +3 -3
@@ -2239,14 +2239,14 @@ The main json-object contains the following: - "status": migration status (json-string) - Possible values: "active", "completed", "failed", "cancelled" +- "total-time": total amount of ms since migration started. If + migration has ended, it returns the total migration + time (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int) - "remaining": amount remaining (json-int) - "total": total (json-int) - - "total-time": total amount of ms since migration started. If - migration has ended, it returns the total migration time - (json-int) - "duplicate": number of duplicated pages (json-int) - "normal" : number of normal pages transferred (json-int) - "normal-bytes" : number of normal bytes transferred (json-int)
Signature · 1 line
1.7.11.2
[Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
Quoted 37 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++-- migration.c | 6 +++--- qapi-schema.json | 14 +++++++------- qmp-commands.hx | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-)+++
b/qapi-schema.jsonqapi-schema.json +3
-6@@ -290,10 +290,6 @@ # # @total: total amount of bytes involved in the migration process # -# @total-time: total amount of ms since migration started. If -# migration has ended, it returns the total migration -# time. (since 1.2) -# # @duplicate: number of duplicate pages (since 1.2) # # @normal : number of normal pages (since 1.2)@@ -304,8 +300,7 @@ ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'total-time': 'int', 'duplicate': 'int', 'normal': 'int', - 'normal-bytes': 'int' } } + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } } ## # @XBZRLECacheStats@@ -350,12 +345,17 @@ # migration statistics, only returned if XBZRLE feature is on and # status is 'active' or 'completed' (since 1.2) # +# @total-time: total amount of milliseconds since migration started. +# If migration has ended, it returns the total migration
qapi-schema.json line 358
Quoted 10 lines
qapi-schema.json +4
-1+# time. (since 1.2) +# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', - '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} }
Anthony - are you planning on taking this series for 1.2? If we don't get this patch in on time, then taking this for 1.3 would result in changing released QMP interface (right now, there has been no release with the field in the wrong type).
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
Quoted 30 lines · On Sat, 18 Aug 2012 07:02:50 -0600 Eric Blake <[email protected]> wrote:
Quoted 29 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++-- migration.c | 6 +++--- qapi-schema.json | 14 +++++++------- qmp-commands.hx | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-)+++
b/qapi-schema.jsonqapi-schema.json +1
-6@@ -290,10 +290,6 @@ # # @total: total amount of bytes involved in the migration process # -# @total-time: total amount of ms since migration started. If -# migration has ended, it returns the total migration -# time. (since 1.2) -# # @duplicate: number of duplicate pages (since 1.2) # # @normal : number of normal pages (since 1.2)@@ -304,8 +300,7 @@ ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'total-time': 'int', 'duplicate': 'int', 'normal': 'int', - 'normal-bytes': 'int' } } + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } }
Quoted 9 lines
qapi-schema.json line 350
Quoted 9 lines
qapi-schema.json +3
-0## # @XBZRLECacheStats@@ -350,12 +345,17 @@ # migration statistics, only returned if XBZRLE feature is on and # status is 'active' or 'completed' (since 1.2) # +# @total-time: total amount of milliseconds since migration started. +# If migration has ended, it returns the total migration +# time. (since 1.2)
Field is optional, needs to be marked as such and the has_total_time field should be set appropriately.
Quoted 10 lines
qapi-schema.json line 358
Quoted 9 lines
qapi-schema.json +3
-1+# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', - '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} }
Quoted 4 lines
Anthony - are you planning on taking this series for 1.2? If we don't get this patch in on time, then taking this for 1.3 would result in changing released QMP interface (right now, there has been no release with the field in the wrong type).
I can cherry-pick this into the qmp branch.
Juan, I can also fix myself the problem I pointed out above if that works for you.
Re: [Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
Quoted 7 lines · Luiz Capitulino
On Sat, 18 Aug 2012 07:02:50 -0600
Eric Blake <[email protected]> wrote:I can cherry-pick this into the qmp branch.
Juan, I can also fix myself the problem I pointed out above if that works for you.
I very much preffer that. But what to do with the other ones?
They are really simple, and it makes things better for users?
Anthony?
Later, Juan.
Re: [Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
Quoted 10 lines · On Tue, 21 Aug 2012 17:00:20 +0200 Juan Quintela <[email protected]> wrote:
Quoted 7 lines · Luiz Capitulino
On Sat, 18 Aug 2012 07:02:50 -0600
Eric Blake <[email protected]> wrote:I can cherry-pick this into the qmp branch.
Juan, I can also fix myself the problem I pointed out above if that works for you.
I very much preffer that.
Done, and applied to the qmp branch for 1.2.
Quoted 1 line
But what to do with the other ones?
They look good to me, but I think it's too late for 1.2.
Re: [Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
In reply to Eric BlakeQuoted 42 lines · Eric Blake
Quoted 41 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++-- migration.c | 6 +++--- qapi-schema.json | 14 +++++++------- qmp-commands.hx | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-)+++
b/qapi-schema.jsonqapi-schema.json +5
-6@@ -290,10 +290,6 @@ # # @total: total amount of bytes involved in the migration process # -# @total-time: total amount of ms since migration started. If -# migration has ended, it returns the total migration -# time. (since 1.2) -# # @duplicate: number of duplicate pages (since 1.2) # # @normal : number of normal pages (since 1.2)@@ -304,8 +300,7 @@ ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'total-time': 'int', 'duplicate': 'int', 'normal': 'int', - 'normal-bytes': 'int' } } + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } } ## # @XBZRLECacheStats@@ -350,12 +345,17 @@ # migration statistics, only returned if XBZRLE feature is on and # status is 'active' or 'completed' (since 1.2) # +# @total-time: total amount of milliseconds since migration started. +# If migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0 ##
Quoted 8 lines
qapi-schema.json line 358
Quoted 6 lines
qapi-schema.json +2
-1{ 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', - '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} }Anthony - are you planning on taking this series for 1.2?
No. This is a new feature and we're past freeze.
Quoted 4 lines
If we don't
get this patch in on time, then taking this for 1.3 would result in changing released QMP interface (right now, there has been no release with the field in the wrong type).
Ack. We need to preserve compat with the 1.2 interface.
Regards,
Anthony Liguori
Quoted 4 lines
Signature · 3 lines
-- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] For 1.2: Re: [PATCH 3/8] migration: move total_time from ram stats to migration info
On 08/22/2012 07:22 AM, Anthony Liguori wrote:
Just restating things to make sure I'm clear...
Quoted 10 lines
Quoted 8 lines
qapi-schema.json line 358
Quoted 6 lines
{ 'type': 'MigrationInfo',
'data': {'*status': 'str', '*ram': 'MigrationStats','*disk': 'MigrationStats',qapi-schema.json +2
-1- '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} }Anthony - are you planning on taking this series for 1.2?
No. This is a new feature and we're past freeze.
No, the overall series (patches 1,2,4-8) is not appropriate at this time.
Quoted 7 lines
Quoted 5 lines
If we don't
get this patch in on time, then taking this for 1.3 would result in changing released QMP interface (right now, there has been no release with the field in the wrong type).Ack. We need to preserve compat with the 1.2 interface.
Yes, this particular patch 3 is a bug fix in order to prevent a future regression when 1.3 takes the rest of the series, and must therefore be part of the 1.2 release (and Luiz is on top of that, via the qmp branch).
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 3/8] migration: move total_time from ram stats to migration info
In reply to Juan QuintelaQuoted 123 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++-- migration.c | 6 +++--- qapi-schema.json | 14 +++++++------- qmp-commands.hx | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-)hmp.c +2
-2@@ -149,6 +149,8 @@ void hmp_info_migrate(Monitor *mon)if (info->has_status) {monitor_printf (mon,"Migration status: %s\n" , info->status); +monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , + info->total_time); }if (info->has_ram) {@@ -158,8 +160,6 @@ void hmp_info_migrate(Monitor *mon) info->ram->remaining >> 10);monitor_printf (mon,"total ram: %" PRIu64" kbytes\n" , info->ram->total >>10 ); -monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , - info->ram->total_time);monitor_printf (mon,"duplicate: %" PRIu64" pages\n" , info->ram->duplicate); monitor_printf(mon, "normal: %" PRIu64 " pages\n",migration.c +3
-3@@ -166,14 +166,14 @@ MigrationInfo *qmp_query_migrate(Error **errp)case MIG_STATE_ACTIVE : info->has_status = true; info->status =g_strdup ("active" ); + info->total_time =qemu_get_clock_ms (rt_clock) + - s->total_time; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram)); info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =ram_bytes_remaining (); info->ram->total =ram_bytes_total (); - info->ram->total_time =qemu_get_clock_ms (rt_clock) - - s->total_time; info->ram->duplicate =dup_mig_pages_transferred (); info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred ();@@ -193,13 +193,13 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->has_status = true; info->status =g_strdup ("completed" ); + info->total_time = s->total_time; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram)); info->ram->transferred =ram_bytes_transferred (); info->ram->remaining =0 ; info->ram->total =ram_bytes_total (); - info->ram->total_time = s->total_time; info->ram->duplicate =dup_mig_pages_transferred (); info->ram->normal =norm_mig_pages_transferred (); info->ram->normal_bytes =norm_mig_bytes_transferred ();qapi-schema.json +7
-7@@ -290,10 +290,6 @@ # # @total: total amount of bytes involved in the migration process # -# @total-time: total amount of ms since migration started. If -# migration has ended, it returns the total migration -# time. (since 1.2) -# # @duplicate: number of duplicate pages (since 1.2) # # @normal : number of normal pages (since 1.2)@@ -304,8 +300,7 @@ ## { 'type': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'total-time': 'int', 'duplicate': 'int', 'normal': 'int', - 'normal-bytes': 'int' } } + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } } ## # @XBZRLECacheStats@@ -350,12 +345,17 @@ # migration statistics, only returned if XBZRLE feature is on and # status is 'active' or 'completed' (since 1.2) # +# @total-time: total amount of milliseconds since migration started. +# If migration has ended, it returns the total migration +# time. (since 1.2) +# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', - '*xbzrle-cache': 'XBZRLECacheStats'} } + '*xbzrle-cache': 'XBZRLECacheStats', + 'total-time': 'int'} } ## # @query-migrateqmp-commands.hx +3
-0@@ -2239,14 +2239,14 @@ The main json-object contains the following: - "status": migration status (json-string) - Possible values: "active", "completed", "failed", "cancelled" +- "total-time": total amount of ms since migration started. If + migration has ended, it returns the total migration + time (json-int) - "ram": only present if "status" is "active", it is a json-object with the
qmp-commands.hx The main json-object contains the following: · line 2252
Quoted 10 lines
qmp-commands.hx +0
-3following RAM information (in bytes): - "transferred": amount transferred (json-int) - "remaining": amount remaining (json-int) - "total": total (json-int) - - "total-time": total amount of ms since migration started. If - migration has ended, it returns the total migration time - (json-int) - "duplicate": number of duplicated pages (json-int) - "normal" : number of normal pages transferred (json-int) - "normal-bytes" : number of normal bytes transferred (json-int)
PATCH v2 4/8 migration: store end_time in a local variable
In reply to Juan Quintela--- migration.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
migration.c +3 -1
@@ -326,6 +326,7 @@ static void migrate_fd_put_ready(void *opaque)migrate_fd_error (s); }else if (ret ==1 ) {int old_vm_running =runstate_is_running (); +int64_t end_time;DPRINTF ("done iterating\n" );qemu_system_wakeup_request (QEMU_WAKEUP_REASON_OTHER );
@@ -336,7 +337,8 @@ static void migrate_fd_put_ready(void *opaque) }else {migrate_fd_completed (s); } - s->total_time =qemu_get_clock_ms (rt_clock) - s->total_time; + end_time =qemu_get_clock_ms (rt_clock); + s->total_time = end_time - s->total_time;if (s->state !=MIG_STATE_COMPLETED ) {if (old_vm_running) {vm_start ();
Signature · 1 line
1.7.11.2
PATCH v2 5/8 migration: print total downtime for final phase of migration
In reply to Juan Quintela--- hmp.c | 4 ++++ migration.c | 6 +++++- migration.h | 1 + qapi-schema.json | 7 ++++++- qmp-commands.hx | 3 +++ 5 files changed, 19 insertions(+), 2 deletions(-)
hmp.c +4 -0
@@ -151,6 +151,10 @@ void hmp_info_migrate(Monitor *mon)monitor_printf (mon,"Migration status: %s\n" , info->status);monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , info->total_time); +if (info->has_downtime) { +monitor_printf (mon,"downtime: %" PRIu64" milliseconds\n" , + info->downtime); + } }if (info->has_ram) {
migration.c +5 -1
@@ -194,6 +194,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->has_status = true; info->status =g_strdup ("completed" ); info->total_time = s->total_time; + info->has_downtime = true; + info->downtime = s->downtime; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram));
@@ -326,9 +328,10 @@ static void migrate_fd_put_ready(void *opaque)migrate_fd_error (s); }else if (ret ==1 ) {int old_vm_running =runstate_is_running (); -int64_t end_time; +int64_t start_time, end_time;DPRINTF ("done iterating\n" ); + start_time =qemu_get_clock_ms (rt_clock);qemu_system_wakeup_request (QEMU_WAKEUP_REASON_OTHER );vm_stop_force_state (RUN_STATE_FINISH_MIGRATE );
@@ -339,6 +342,7 @@ static void migrate_fd_put_ready(void *opaque) } end_time =qemu_get_clock_ms (rt_clock); s->total_time = end_time - s->total_time; + s->downtime = end_time - start_time;if (s->state !=MIG_STATE_COMPLETED ) {if (old_vm_running) {vm_start ();
migration.h +1 -0
@@ -40,6 +40,7 @@ struct MigrationStatevoid *opaque;MigrationParams params;int64_t total_time; +int64_t downtime;bool enabled_capabilities[MIGRATION_CAPABILITY_MAX ];int64_t xbzrle_cache_size; };
qapi-schema.json +6 -1
@@ -349,13 +349,18 @@ # If migration has ended, it returns the total migration # time. (since 1.2) # +# @downtime: #optional only present when migration finishes correctly +# total downtime in milliseconds for the guest. +# (since 1.2) +# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', '*xbzrle-cache': 'XBZRLECacheStats', - 'total-time': 'int'} } + 'total-time': 'int', + '*downtime': 'int'} } ## # @query-migrate
qmp-commands.hx +3 -0
@@ -2242,6 +2242,8 @@ The main json-object contains the following: - "total-time": total amount of ms since migration started. If migration has ended, it returns the total migration time (json-int) +- "downtime": only present when migration has finished correctly + total amount in ms for downtime that happened (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int)
@@ -2279,6 +2281,7 @@ Examples: "remaining":123, "total":246, "total-time":12345, + "expected-downtime":12345, "duplicate":123, "normal":123, "normal-bytes":123456
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 5/8] migration: print total downtime for final phase of migration
Quoted 20 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++++ migration.c | 6 +++++- migration.h | 1 + qapi-schema.json | 7 ++++++- qmp-commands.hx | 3 +++ 5 files changed, 19 insertions(+), 2 deletions(-)+++ b/qmp-commands.hx
qmp-commands.hx +2
-0@@ -2242,6 +2242,8 @@ The main json-object contains the following: - "total-time": total amount of ms since migration started. If migration has ended, it returns the total migration time (json-int) +- "downtime": only present when migration has finished correctly + total amount in ms for downtime that happened (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int)
qmp-commands.hx Examples: · line 2284
Quoted 4 lines
qmp-commands.hx +1
-0@@ -2279,6 +2281,7 @@ Examples: "remaining":123, "total":246, "total-time":12345, + "expected-downtime":12345,
s/expected-//
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH 5/8] migration: print total downtime for final phase of migration
In reply to Juan QuintelaQuoted 74 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- hmp.c | 4 ++++ migration.c | 6 +++++- migration.h | 1 + qapi-schema.json | 7 ++++++- qmp-commands.hx | 3 +++ 5 files changed, 19 insertions(+), 2 deletions(-)hmp.c +4
-0@@ -151,6 +151,10 @@ void hmp_info_migrate(Monitor *mon)monitor_printf (mon,"Migration status: %s\n" , info->status);monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , info->total_time); +if (info->has_downtime) { +monitor_printf (mon,"downtime: %" PRIu64" milliseconds\n" , + info->downtime); + } }if (info->has_ram) {migration.c +5
-1@@ -194,6 +194,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->has_status = true; info->status =g_strdup ("completed" ); info->total_time = s->total_time; + info->has_downtime = true; + info->downtime = s->downtime; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram));@@ -326,9 +328,10 @@ static void migrate_fd_put_ready(void *opaque)migrate_fd_error (s); }else if (ret ==1 ) {int old_vm_running =runstate_is_running (); -int64_t end_time; +int64_t start_time, end_time;DPRINTF ("done iterating\n" ); + start_time =qemu_get_clock_ms (rt_clock);qemu_system_wakeup_request (QEMU_WAKEUP_REASON_OTHER );vm_stop_force_state (RUN_STATE_FINISH_MIGRATE );@@ -339,6 +342,7 @@ static void migrate_fd_put_ready(void *opaque) } end_time =qemu_get_clock_ms (rt_clock); s->total_time = end_time - s->total_time; + s->downtime = end_time - start_time;if (s->state !=MIG_STATE_COMPLETED ) {if (old_vm_running) {vm_start ();migration.h +1
-0@@ -40,6 +40,7 @@ struct MigrationStatevoid *opaque;MigrationParams params;int64_t total_time; +int64_t downtime;bool enabled_capabilities[MIGRATION_CAPABILITY_MAX ];int64_t xbzrle_cache_size; };qapi-schema.json +0
-0
qapi-schema.json line 354
Quoted 6 lines
qapi-schema.json +3
-0@@ -349,13 +349,18 @@ # If migration has ended, it returns the total migration # time. (since 1.2) # +# @downtime: #optional only present when migration finishes correctly +# total downtime in milliseconds for the guest. +# (since 1.2)
will it make it to 1.2 ? if not than 1.3
Quoted 35 lines
qapi-schema.json +3
-1+# # Since: 0.14.0 ## { 'type': 'MigrationInfo', 'data': {'*status': 'str', '*ram': 'MigrationStats', '*disk': 'MigrationStats', '*xbzrle-cache': 'XBZRLECacheStats', - 'total-time': 'int'} } + 'total-time': 'int', + '*downtime': 'int'} } ## # @query-migrateqmp-commands.hx +3
-0@@ -2242,6 +2242,8 @@ The main json-object contains the following: - "total-time": total amount of ms since migration started. If migration has ended, it returns the total migration time (json-int) +- "downtime": only present when migration has finished correctly + total amount in ms for downtime that happened (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int)@@ -2279,6 +2281,7 @@ Examples: "remaining":123, "total":246, "total-time":12345, + "expected-downtime":12345, "duplicate":123, "normal":123, "normal-bytes":123456
PATCH v2 6/8 migration: rename expected_time to expected_downtime
In reply to Juan Quintela--- arch_init.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
arch_init.c +9 -8
@@ -538,7 +538,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)double bwidth =0 ;int ret;int i; -uint64_t expected_time; +uint64_t expected_downtime; bytes_transferred_last = bytes_transferred; bwidth =qemu_get_clock_ns (rt_clock);
@@ -577,24 +577,25 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) bwidth =qemu_get_clock_ns (rt_clock) - bwidth; bwidth = (bytes_transferred - bytes_transferred_last) / bwidth; -/* if we haven't transferred anything this round, force expected_time to a -* a very high value, but without crashing */ +/* if we haven't transferred anything this round, force +* expected_downtime to a very high value, but without +* crashing */ if (bwidth ==0 ) { bwidth =0.000001 ; }qemu_put_be64 (f,RAM_SAVE_FLAG_EOS ); - expected_time =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; + expected_downtime =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth;DPRINTF ("ram_save_live: expected(" PRIu64") <= max(" PRIu64")?\n" , - expected_time,migrate_max_downtime ()); + expected_downtime,migrate_max_downtime ()); -if (expected_time <=migrate_max_downtime ()) { +if (expected_downtime <=migrate_max_downtime ()) {memory_global_sync_dirty_bitmap (get_system_memory ()); - expected_time =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; + expected_downtime =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; -return expected_time <=migrate_max_downtime (); +return expected_downtime <=migrate_max_downtime (); }return 0 ; }
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 6/8] migration: rename expected_time to expected_downtime
Quoted 42 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- arch_init.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)arch_init.c +6
-6@@ -538,7 +538,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)double bwidth =0 ;int ret;int i; -uint64_t expected_time; +uint64_t expected_downtime; bytes_transferred_last = bytes_transferred; bwidth =qemu_get_clock_ns (rt_clock);@@ -577,24 +577,25 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) bwidth =qemu_get_clock_ns (rt_clock) - bwidth; bwidth = (bytes_transferred - bytes_transferred_last) / bwidth; -/* if we haven't transferred anything this round, force expected_time to a -* a very high value, but without crashing */ +/* if we haven't transferred anything this round, force +* expected_downtime to a very high value, but without +* crashing */ if (bwidth ==0 ) { bwidth =0.000001 ; }qemu_put_be64 (f,RAM_SAVE_FLAG_EOS ); - expected_time =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; + expected_downtime =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth;DPRINTF ("ram_save_live: expected(" PRIu64") <= max(" PRIu64")?\n" , - expected_time,migrate_max_downtime ()); + expected_downtime,migrate_max_downtime ()); -if (expected_time <=migrate_max_downtime ()) {
arch_init.c static int ram_save_iterate(QEMUFile *f, void *opaque) · line 601
Quoted 10 lines
arch_init.c +3
-2+if (expected_downtime <=migrate_max_downtime ()) {memory_global_sync_dirty_bitmap (get_system_memory ()); - expected_time =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; + expected_downtime =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; -return expected_time <=migrate_max_downtime (); +return expected_downtime <=migrate_max_downtime (); }return 0 ; }
PATCH v2 7/8 migration: export migrate_get_current()
In reply to Juan Quintela--- migration.c | 2 +- migration.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
migration.c +1 -1
@@ -53,7 +53,7 @@ static NotifierList migration_state_notifiers =migrations at once. For now we don't need to add dynamic creation of migration */ -static MigrationState *migrate_get_current (void ) +MigrationState *migrate_get_current (void ) {static MigrationState current_migration = { .state =MIG_STATE_SETUP ,
migration.h +1 -0
@@ -81,6 +81,7 @@ void remove_migration_state_change_notifier(Notifier *notify);bool migration_is_active (MigrationState *);bool migration_has_finished (MigrationState *);bool migration_has_failed (MigrationState *); +MigrationState *migrate_get_current (void );uint64_t ram_bytes_remaining (void );uint64_t ram_bytes_transferred (void );
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 7/8] migration: export migrate_get_current()
Quoted 25 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- migration.c | 2 +- migration.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)migration.c +1
-1@@ -53,7 +53,7 @@ static NotifierList migration_state_notifiers =migrations at once. For now we don't need to add dynamic creation of migration */ -static MigrationState *migrate_get_current (void ) +MigrationState *migrate_get_current (void ) {static MigrationState current_migration = { .state =MIG_STATE_SETUP ,migration.h +0
-0
migration.h void remove_migration_state_change_notifier(Notifier *notify); · line 87
Quoted 7 lines
migration.h +1
-0@@ -81,6 +81,7 @@ void remove_migration_state_change_notifier(Notifier *notify);bool migration_is_active (MigrationState *);bool migration_has_finished (MigrationState *);bool migration_has_failed (MigrationState *); +MigrationState *migrate_get_current (void );uint64_t ram_bytes_remaining (void );uint64_t ram_bytes_transferred (void );
PATCH v2 8/8 migration: print expected downtime in info migrate
In reply to Juan Quintela--- arch_init.c | 2 ++ hmp.c | 4 ++++ migration.c | 2 ++ migration.h | 1 + qapi-schema.json | 5 +++++ qmp-commands.hx | 6 ++++++ 6 files changed, 20 insertions(+)
arch_init.c +2 -0
@@ -539,6 +539,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)int ret;int i;uint64_t expected_downtime; +MigrationState *s =migrate_get_current (); bytes_transferred_last = bytes_transferred; bwidth =qemu_get_clock_ns (rt_clock);
@@ -594,6 +595,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)if (expected_downtime <=migrate_max_downtime ()) {memory_global_sync_dirty_bitmap (get_system_memory ()); expected_downtime =ram_save_remaining () *TARGET_PAGE_SIZE / bwidth; + s->expected_downtime = expected_downtime /1000000 ;/* ns -> ms */ return expected_downtime <=migrate_max_downtime (); }
hmp.c +4 -0
@@ -151,6 +151,10 @@ void hmp_info_migrate(Monitor *mon)monitor_printf (mon,"Migration status: %s\n" , info->status);monitor_printf (mon,"total time: %" PRIu64" milliseconds\n" , info->total_time); +if (info->has_expected_downtime) { +monitor_printf (mon,"expected downtime: %" PRIu64" milliseconds\n" , + info->expected_downtime); + }if (info->has_downtime) {monitor_printf (mon,"downtime: %" PRIu64" milliseconds\n" , info->downtime);
migration.c +2 -0
@@ -168,6 +168,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->status =g_strdup ("active" ); info->total_time =qemu_get_clock_ms (rt_clock) - s->total_time; + info->has_expected_downtime = true; + info->expected_downtime = s->expected_downtime; info->has_ram = true; info->ram =g_malloc0 (sizeof (*info->ram));
migration.h +1 -0
@@ -41,6 +41,7 @@ struct MigrationStateMigrationParams params;int64_t total_time;int64_t downtime; +int64_t expected_downtime;bool enabled_capabilities[MIGRATION_CAPABILITY_MAX ];int64_t xbzrle_cache_size; };
qapi-schema.json +5 -0
@@ -353,6 +353,10 @@ # total downtime in milliseconds for the guest. # (since 1.2) # +# @expected-downtime: #optional only present while migration is active +# expected downtime in milliseconds for the guest in last walk +# of the dirty bitmap. (since 1.2) +# # Since: 0.14.0 ## { 'type': 'MigrationInfo',
@@ -360,6 +364,7 @@ '*disk': 'MigrationStats', '*xbzrle-cache': 'XBZRLECacheStats', 'total-time': 'int', + '*expected-downtime': 'int', '*downtime': 'int'} } ##
qmp-commands.hx +6 -0
@@ -2244,6 +2244,9 @@ The main json-object contains the following: time (json-int) - "downtime": only present when migration has finished correctly total amount in ms for downtime that happened (json-int) +- "expected-downtime": only present while migration is active + total amount in ms for downtime that was calculated on + the last bitmap round (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int)
@@ -2305,6 +2308,7 @@ Examples: "remaining":123, "total":246, "total-time":12345, + "expected-downtime":12345, "duplicate":123, "normal":123, "normal-bytes":123456
@@ -2323,6 +2327,7 @@ Examples: "remaining":1053304, "transferred":3720, "total-time":12345, + "expected-downtime":12345, "duplicate":123, "normal":123, "normal-bytes":123456
@@ -2347,6 +2352,7 @@ Examples: "remaining":1053304, "transferred":3720, "total-time":12345, + "expected-downtime":12345, "duplicate":10, "normal":3333, "normal-bytes":3412992
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH 8/8] migration: print expected downtime in info migrate
Quoted 23 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>--- arch_init.c | 2 ++ hmp.c | 4 ++++ migration.c | 2 ++ migration.h | 1 + qapi-schema.json | 5 +++++ qmp-commands.hx | 6 ++++++ 6 files changed, 20 insertions(+)+++ b/qmp-commands.hx
qmp-commands.hx +3
-0@@ -2244,6 +2244,9 @@ The main json-object contains the following: time (json-int) - "downtime": only present when migration has finished correctly total amount in ms for downtime that happened (json-int) +- "expected-downtime": only present while migration is active + total amount in ms for downtime that was calculated on + the last bitmap round (json-int) - "ram": only present if "status" is "active", it is a json-object with the following RAM information (in bytes): - "transferred": amount transferred (json-int)
qmp-commands.hx Examples: · line 2311
Quoted 4 lines
qmp-commands.hx +1
-0@@ -2305,6 +2308,7 @@ Examples: "remaining":123, "total":246, "total-time":12345, + "expected-downtime":12345,
TAB damage, on several examples.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org