Message ID | 1450266458-3178-5-git-send-email-dgilbert@redhat.com |
---|---|
State | New |
Headers | show |
"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>
On 12/16/2015 04:47 AM, 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> > --- > docs/qmp-events.txt | 14 ++++++++++++++ > migration/ram.c | 4 ++++ > qapi/event.json | 13 +++++++++++++ > 3 files changed, 31 insertions(+) > > > +MIGRATION_PASS > +-------------- > + > +Emitted from the source side of a migration at the start of each pass > +(when it syncs the dirty bitmap) > + > +Data: None. > + > + - "pass": An incrementing count (starting at 1 on the first pass) > + > +Example: > +{"timestamp": {"seconds": 1449669631, "microseconds": 239225}, > + "event": "MIGRATION_PASS", "data": {"pass": 2}} How frequently can this event be emitted? It is not under guest control, so it's harder to argue that it could be abused as a way for the guest to DoS the host. And hopefully it is slow enough (considering that each pass also requires lots more effort for actually transmitting state from source to dest), so I don't think we have to worry about adding rate-limiting to avoid overwhelming the monitor client. Reviewed-by: Eric Blake <eblake@redhat.com>
* Eric Blake (eblake@redhat.com) wrote: > On 12/16/2015 04:47 AM, 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> > > --- > > docs/qmp-events.txt | 14 ++++++++++++++ > > migration/ram.c | 4 ++++ > > qapi/event.json | 13 +++++++++++++ > > 3 files changed, 31 insertions(+) > > > > > > > +MIGRATION_PASS > > +-------------- > > + > > +Emitted from the source side of a migration at the start of each pass > > +(when it syncs the dirty bitmap) > > + > > +Data: None. > > + > > + - "pass": An incrementing count (starting at 1 on the first pass) > > + > > +Example: > > +{"timestamp": {"seconds": 1449669631, "microseconds": 239225}, > > + "event": "MIGRATION_PASS", "data": {"pass": 2}} > > How frequently can this event be emitted? It is not under guest > control, so it's harder to argue that it could be abused as a way for > the guest to DoS the host. And hopefully it is slow enough (considering > that each pass also requires lots more effort for actually transmitting > state from source to dest), so I don't think we have to worry about > adding rate-limiting to avoid overwhelming the monitor client. The only way that you'd get a rapid repetition of the events is if the pass was very short. However a very short pass is normally the signal to exit the iterative loop of migration and send the last blob at the end of migration. And that definition of 'short' is determined by the downtime set by the management layer anyway. > > Reviewed-by: Eric Blake <eblake@redhat.com> Thanks. 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
On (Wed) 16 Dec 2015 [16:52:14], Dr. David Alan Gilbert wrote: > * Eric Blake (eblake@redhat.com) wrote: > > On 12/16/2015 04:47 AM, 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> > > > --- > > > docs/qmp-events.txt | 14 ++++++++++++++ > > > migration/ram.c | 4 ++++ > > > qapi/event.json | 13 +++++++++++++ > > > 3 files changed, 31 insertions(+) > > > > > > > > > > > +MIGRATION_PASS > > > +-------------- > > > + > > > +Emitted from the source side of a migration at the start of each pass > > > +(when it syncs the dirty bitmap) > > > + > > > +Data: None. > > > + > > > + - "pass": An incrementing count (starting at 1 on the first pass) > > > + > > > +Example: > > > +{"timestamp": {"seconds": 1449669631, "microseconds": 239225}, > > > + "event": "MIGRATION_PASS", "data": {"pass": 2}} > > > > How frequently can this event be emitted? It is not under guest > > control, so it's harder to argue that it could be abused as a way for > > the guest to DoS the host. And hopefully it is slow enough (considering > > that each pass also requires lots more effort for actually transmitting > > state from source to dest), so I don't think we have to worry about > > adding rate-limiting to avoid overwhelming the monitor client. > > The only way that you'd get a rapid repetition of the events > is if the pass was very short. However a very short pass is normally > the signal to exit the iterative loop of migration and send the > last blob at the end of migration. And that definition of 'short' is > determined by the downtime set by the management layer anyway. Yes, and this can also give us stats on how quickly migration is progressing. Amit
diff --git a/docs/qmp-events.txt b/docs/qmp-events.txt index d2f1ce4..52eb7e2 100644 --- a/docs/qmp-events.txt +++ b/docs/qmp-events.txt @@ -496,6 +496,20 @@ Example: {"timestamp": {"seconds": 1432121972, "microseconds": 744001}, "event": "MIGRATION", "data": {"status": "completed"}} +MIGRATION_PASS +-------------- + +Emitted from the source side of a migration at the start of each pass +(when it syncs the dirty bitmap) + +Data: None. + + - "pass": An incrementing count (starting at 1 on the first pass) + +Example: +{"timestamp": {"seconds": 1449669631, "microseconds": 239225}, + "event": "MIGRATION_PASS", "data": {"pass": 2}} + STOP ---- 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..390fd45 100644 --- a/qapi/event.json +++ b/qapi/event.json @@ -255,6 +255,19 @@ '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) +# +# @pass: An incrementing count (starting at 1 on the first pass) +# +# Since: 2.6 +## +{ 'event': 'MIGRATION_PASS', + 'data': { 'pass': 'int' } } + +## # @ACPI_DEVICE_OST # # Emitted when guest executes ACPI _OST method.