diff mbox

[4/6] Migration: Emit event at start of pass

Message ID 1450206170-26901-5-git-send-email-dgilbert@redhat.com
State New
Headers show

Commit Message

Dr. David Alan Gilbert Dec. 15, 2015, 7:02 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Emit an event each time we sync the dirty bitmap on the source;
this helps libvirt use postcopy by giving it a kick when it
might be a good idea to start the postcopy.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/ram.c |  4 ++++
 qapi/event.json | 11 +++++++++++
 2 files changed, 15 insertions(+)

Comments

Eric Blake Dec. 15, 2015, 9:07 p.m. UTC | #1
On 12/15/2015 12:02 PM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Emit an event each time we sync the dirty bitmap on the source;
> this helps libvirt use postcopy by giving it a kick when it
> might be a good idea to start the postcopy.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  migration/ram.c |  4 ++++
>  qapi/event.json | 11 +++++++++++
>  2 files changed, 15 insertions(+)

> +++ b/qapi/event.json
> @@ -255,6 +255,17 @@
>    'data': {'status': 'MigrationStatus'}}
>  
>  ##
> +# @MIGRATION_PASS
> +#
> +# Emitted from the source side of a migration at the start of each pass
> +# (when it syncs the dirty bitmap)
> +#
> +# Since: 2.6

Missing documentation of the 'pass' member - is it a counter that says
which pass this event is, incrementing each time through?

Also missing docs in events.txt (although that file may go away soon,
once we get Marc-Andre's patches in for automating documentation from
.json files).
Dr. David Alan Gilbert Dec. 16, 2015, 10:01 a.m. UTC | #2
* Eric Blake (eblake@redhat.com) wrote:
> On 12/15/2015 12:02 PM, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > Emit an event each time we sync the dirty bitmap on the source;
> > this helps libvirt use postcopy by giving it a kick when it
> > might be a good idea to start the postcopy.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  migration/ram.c |  4 ++++
> >  qapi/event.json | 11 +++++++++++
> >  2 files changed, 15 insertions(+)
> 
> > +++ b/qapi/event.json
> > @@ -255,6 +255,17 @@
> >    'data': {'status': 'MigrationStatus'}}
> >  
> >  ##
> > +# @MIGRATION_PASS
> > +#
> > +# Emitted from the source side of a migration at the start of each pass
> > +# (when it syncs the dirty bitmap)
> > +#
> > +# Since: 2.6
> 
> Missing documentation of the 'pass' member - is it a counter that says
> which pass this event is, incrementing each time through?

Thanks; yes, I added the pass parameter afterwards; I'll add:

# @pass: An incrementing count (starting at 1 on the first pass)

> Also missing docs in events.txt (although that file may go away soon,
> once we get Marc-Andre's patches in for automating documentation from
> .json files).

OK, I'll add the following (docs/qmp-events.txt):

MIGRATION_PASS
--------------

Emitted from the source side of a migration at the start of each pass
(when it syncs the dirty bitmap)

Data:

  - "pass": An incrementing count (starting at 1 on the first pass)

Example:
{"timestamp": {"seconds": 1449669631, "microseconds": 239225},
 "event": "MIGRATION_PASS", "data": {"pass": 2}}

Dave

> 
> -- 
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 


--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Juan Quintela Dec. 16, 2015, 10:29 a.m. UTC | #3
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Emit an event each time we sync the dirty bitmap on the source;
> this helps libvirt use postcopy by giving it a kick when it
> might be a good idea to start the postcopy.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

with changes apperining on reply.
Eric Blake Dec. 16, 2015, 4:40 p.m. UTC | #4
On 12/16/2015 03:01 AM, Dr. David Alan Gilbert wrote:

>> Missing documentation of the 'pass' member - is it a counter that says
>> which pass this event is, incrementing each time through?
> 
> Thanks; yes, I added the pass parameter afterwards; I'll add:
> 
> # @pass: An incrementing count (starting at 1 on the first pass)
> 
>> Also missing docs in events.txt (although that file may go away soon,
>> once we get Marc-Andre's patches in for automating documentation from
>> .json files).
> 
> OK, I'll add the following (docs/qmp-events.txt):

Ah, you figured out the file I really meant.  Your additions look
reasonable for v2.
diff mbox

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 0490f00..102d1f2 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -27,6 +27,7 @@ 
  */
 #include <stdint.h>
 #include <zlib.h>
+#include "qapi-event.h"
 #include "qemu/bitops.h"
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
@@ -682,6 +683,9 @@  static void migration_bitmap_sync(void)
         num_dirty_pages_period = 0;
     }
     s->dirty_sync_count = bitmap_sync_count;
+    if (migrate_use_events()) {
+        qapi_event_send_migration_pass(bitmap_sync_count, NULL);
+    }
 }
 
 /**
diff --git a/qapi/event.json b/qapi/event.json
index f0cef01..2440dbc 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -255,6 +255,17 @@ 
   'data': {'status': 'MigrationStatus'}}
 
 ##
+# @MIGRATION_PASS
+#
+# Emitted from the source side of a migration at the start of each pass
+# (when it syncs the dirty bitmap)
+#
+# Since: 2.6
+##
+{ 'event': 'MIGRATION_PASS',
+  'data': { 'pass': 'int' } }
+
+##
 # @ACPI_DEVICE_OST
 #
 # Emitted when guest executes ACPI _OST method.