diff mbox

[3/4] Purge migration of (almost) everything to do with monitors

Message ID 1331316786-7752-4-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino March 9, 2012, 6:13 p.m. UTC
The Monitor object is passed back and forth within the migration/savevm
code so that it can print errors and progress to the user.

However, that approach assumes a HMP monitor, being completely invalid
in QMP.

This commit drops almost every single usage of the Monitor object, all
monitor_printf() calls have been converted into DPRINTF() ones.

There are a few remaining Monitor objects, those are going to be dropped
by the next commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 arch_init.c       |    2 +-
 block-migration.c |   58 +++++++++++++++++++++++------------------------------
 migration.c       |    8 ++++----
 migration.h       |    2 +-
 savevm.c          |   29 +++++++++++++--------------
 sysemu.h          |    9 ++++-----
 vmstate.h         |    3 +--
 7 files changed, 50 insertions(+), 61 deletions(-)

Comments

Jan Kiszka March 9, 2012, 6:20 p.m. UTC | #1
On 2012-03-09 19:13, Luiz Capitulino wrote:
> The Monitor object is passed back and forth within the migration/savevm
> code so that it can print errors and progress to the user.
> 
> However, that approach assumes a HMP monitor, being completely invalid
> in QMP.
> 
> This commit drops almost every single usage of the Monitor object, all
> monitor_printf() calls have been converted into DPRINTF() ones.

I guess for most printfs, this is OK. But do you provide an alternative
for the block migration progress output? I did not find anything on
first glance. That is not a debugging feature.

Jan
Luiz Capitulino March 9, 2012, 6:30 p.m. UTC | #2
On Fri, 09 Mar 2012 19:20:56 +0100
Jan Kiszka <jan.kiszka@siemens.com> wrote:

> On 2012-03-09 19:13, Luiz Capitulino wrote:
> > The Monitor object is passed back and forth within the migration/savevm
> > code so that it can print errors and progress to the user.
> > 
> > However, that approach assumes a HMP monitor, being completely invalid
> > in QMP.
> > 
> > This commit drops almost every single usage of the Monitor object, all
> > monitor_printf() calls have been converted into DPRINTF() ones.
> 
> I guess for most printfs, this is OK. But do you provide an alternative
> for the block migration progress output? I did not find anything on
> first glance. That is not a debugging feature.

Can't the info migrate command be used for that?
Anthony Liguori March 9, 2012, 6:31 p.m. UTC | #3
On 03/09/2012 12:20 PM, Jan Kiszka wrote:
> On 2012-03-09 19:13, Luiz Capitulino wrote:
>> The Monitor object is passed back and forth within the migration/savevm
>> code so that it can print errors and progress to the user.
>>
>> However, that approach assumes a HMP monitor, being completely invalid
>> in QMP.
>>
>> This commit drops almost every single usage of the Monitor object, all
>> monitor_printf() calls have been converted into DPRINTF() ones.
>
> I guess for most printfs, this is OK. But do you provide an alternative
> for the block migration progress output? I did not find anything on
> first glance. That is not a debugging feature.

The block migration progress stuff is horribly broken and I regret ever merging 
it.  Are you actively relying on this?

Does block migration even work?

Could we just remove block migration entirely...

Regards,

Anthony Liguori

>
> Jan
>
Eric Blake March 9, 2012, 6:45 p.m. UTC | #4
On 03/09/2012 11:31 AM, Anthony Liguori wrote:
> On 03/09/2012 12:20 PM, Jan Kiszka wrote:
>> On 2012-03-09 19:13, Luiz Capitulino wrote:
>>> The Monitor object is passed back and forth within the migration/savevm
>>> code so that it can print errors and progress to the user.
>>>
>>> However, that approach assumes a HMP monitor, being completely invalid
>>> in QMP.
>>>
>>> This commit drops almost every single usage of the Monitor object, all
>>> monitor_printf() calls have been converted into DPRINTF() ones.
>>
>> I guess for most printfs, this is OK. But do you provide an alternative
>> for the block migration progress output? I did not find anything on
>> first glance. That is not a debugging feature.
> 
> The block migration progress stuff is horribly broken and I regret ever
> merging it.  Are you actively relying on this?
> 
> Does block migration even work?
> 
> Could we just remove block migration entirely...

Libvirt has already exposed block migration to users, but it is
untested; if, as you say, it is horribly broken, then libvirt needs to
pass on the error message back to the user that it is broken.  But we
regularly get people complaining that they don't have shared storage set
up, and they are looking for a magic bullet that will do block migration
alongside the domain migration; perhaps libvirt can still provide that
with block mirroring or other (working) solutions from the same API it
gives to the user if you end up pulling it out of the migrate QMP
command.  At the end of the day, it's your call whether to pull it out,
and libvirt will adapt, but it would be nice to know what kosher working
alternative(s) to use instead.
Anthony Liguori March 9, 2012, 6:53 p.m. UTC | #5
On 03/09/2012 12:45 PM, Eric Blake wrote:
> On 03/09/2012 11:31 AM, Anthony Liguori wrote:
>> On 03/09/2012 12:20 PM, Jan Kiszka wrote:
>>> On 2012-03-09 19:13, Luiz Capitulino wrote:
>>>> The Monitor object is passed back and forth within the migration/savevm
>>>> code so that it can print errors and progress to the user.
>>>>
>>>> However, that approach assumes a HMP monitor, being completely invalid
>>>> in QMP.
>>>>
>>>> This commit drops almost every single usage of the Monitor object, all
>>>> monitor_printf() calls have been converted into DPRINTF() ones.
>>>
>>> I guess for most printfs, this is OK. But do you provide an alternative
>>> for the block migration progress output? I did not find anything on
>>> first glance. That is not a debugging feature.
>>
>> The block migration progress stuff is horribly broken and I regret ever
>> merging it.  Are you actively relying on this?
>>
>> Does block migration even work?
>>
>> Could we just remove block migration entirely...
>
> Libvirt has already exposed block migration to users,

:-(

Do you rely on the progress stats that are printed?

> but it is
> untested; if, as you say, it is horribly broken, then libvirt needs to
> pass on the error message back to the user that it is broken.  But we
> regularly get people complaining that they don't have shared storage set
> up, and they are looking for a magic bullet that will do block migration
> alongside the domain migration; perhaps libvirt can still provide that
> with block mirroring or other (working) solutions from the same API it
> gives to the user if you end up pulling it out of the migrate QMP
> command.

Well block mirroring is hopefully around the corner.

Regards,

Anthony Liguori

> At the end of the day, it's your call whether to pull it out,
> and libvirt will adapt, but it would be nice to know what kosher working
> alternative(s) to use instead.
>
Jan Kiszka March 9, 2012, 6:59 p.m. UTC | #6
On 2012-03-09 19:31, Anthony Liguori wrote:
> On 03/09/2012 12:20 PM, Jan Kiszka wrote:
>> On 2012-03-09 19:13, Luiz Capitulino wrote:
>>> The Monitor object is passed back and forth within the migration/savevm
>>> code so that it can print errors and progress to the user.
>>>
>>> However, that approach assumes a HMP monitor, being completely invalid
>>> in QMP.
>>>
>>> This commit drops almost every single usage of the Monitor object, all
>>> monitor_printf() calls have been converted into DPRINTF() ones.
>>
>> I guess for most printfs, this is OK. But do you provide an alternative
>> for the block migration progress output? I did not find anything on
>> first glance. That is not a debugging feature.
> 
> The block migration progress stuff is horribly broken and I regret ever merging 
> it.  Are you actively relying on this?
> 
> Does block migration even work?

The last time I tried (a while back), it worked for me, but I also
received reports that it was not working reliably.

> 
> Could we just remove block migration entirely...

Well, if we have a better alternative, replace it.

Jan
Jan Kiszka March 9, 2012, 7:05 p.m. UTC | #7
On 2012-03-09 19:30, Luiz Capitulino wrote:
> On Fri, 09 Mar 2012 19:20:56 +0100
> Jan Kiszka <jan.kiszka@siemens.com> wrote:
> 
>> On 2012-03-09 19:13, Luiz Capitulino wrote:
>>> The Monitor object is passed back and forth within the migration/savevm
>>> code so that it can print errors and progress to the user.
>>>
>>> However, that approach assumes a HMP monitor, being completely invalid
>>> in QMP.
>>>
>>> This commit drops almost every single usage of the Monitor object, all
>>> monitor_printf() calls have been converted into DPRINTF() ones.
>>
>> I guess for most printfs, this is OK. But do you provide an alternative
>> for the block migration progress output? I did not find anything on
>> first glance. That is not a debugging feature.
> 
> Can't the info migrate command be used for that?

This was introduced for synchronous migration, as usability improvement.

Either we expose this feature or we drop it completely. But converting
it to a /dev/null output is pointless.

Jan
Anthony Liguori March 9, 2012, 7:12 p.m. UTC | #8
On 03/09/2012 01:05 PM, Jan Kiszka wrote:
> On 2012-03-09 19:30, Luiz Capitulino wrote:
>> On Fri, 09 Mar 2012 19:20:56 +0100
>> Jan Kiszka<jan.kiszka@siemens.com>  wrote:
>>
>>> On 2012-03-09 19:13, Luiz Capitulino wrote:
>>>> The Monitor object is passed back and forth within the migration/savevm
>>>> code so that it can print errors and progress to the user.
>>>>
>>>> However, that approach assumes a HMP monitor, being completely invalid
>>>> in QMP.
>>>>
>>>> This commit drops almost every single usage of the Monitor object, all
>>>> monitor_printf() calls have been converted into DPRINTF() ones.
>>>
>>> I guess for most printfs, this is OK. But do you provide an alternative
>>> for the block migration progress output? I did not find anything on
>>> first glance. That is not a debugging feature.
>>
>> Can't the info migrate command be used for that?
>
> This was introduced for synchronous migration, as usability improvement.

Synchronous migration doesn't exist in QMP.

It's certainly possible to make the synchronous monitor command spit out status 
as it already uses a polling loop to determine when migration completes.

Regards,

Anthony Liguori

>
> Either we expose this feature or we drop it completely. But converting
> it to a /dev/null output is pointless.
>
> Jan
>
Eric Blake March 9, 2012, 7:42 p.m. UTC | #9
On 03/09/2012 11:53 AM, Anthony Liguori wrote:
>>>
>>> Could we just remove block migration entirely...
>>
>> Libvirt has already exposed block migration to users,
> 
> :-(
> 
> Do you rely on the progress stats that are printed?

I've never personally used it (as I said earlier, the libvirt support
for blk and inc doesn't get much testing), but I can state that if you do:

virsh migrate --copy-storage-all --copy-storage-inc --verbose ...

that virsh will cause libvirt to start up a detached migration, then
repeatedly call the query-migrate monitor command to update an on-screen
progress monitor to the user; this progress monitor tracks both ram and
disk status to compute the percentage complete showed to the user, so at
some level, libvirt really is trying to rely on accurate block migration
progress numbers.

>> regularly get people complaining that they don't have shared storage set
>> up, and they are looking for a magic bullet that will do block migration
>> alongside the domain migration; perhaps libvirt can still provide that
>> with block mirroring or other (working) solutions from the same API it
>> gives to the user if you end up pulling it out of the migrate QMP
>> command.
> 
> Well block mirroring is hopefully around the corner.

Just so I'm clear, are you talking about a more complete mirroring
solution than just the storage migration use of mirroring that enables
live block migration without also migrating VM state?  Also, is this a
qemu 1.1 planned feature, or will it more likely be in the 1.2 timeframe?
Luiz Capitulino March 9, 2012, 7:48 p.m. UTC | #10
On Fri, 09 Mar 2012 13:12:43 -0600
Anthony Liguori <aliguori@us.ibm.com> wrote:

> On 03/09/2012 01:05 PM, Jan Kiszka wrote:
> > On 2012-03-09 19:30, Luiz Capitulino wrote:
> >> On Fri, 09 Mar 2012 19:20:56 +0100
> >> Jan Kiszka<jan.kiszka@siemens.com>  wrote:
> >>
> >>> On 2012-03-09 19:13, Luiz Capitulino wrote:
> >>>> The Monitor object is passed back and forth within the migration/savevm
> >>>> code so that it can print errors and progress to the user.
> >>>>
> >>>> However, that approach assumes a HMP monitor, being completely invalid
> >>>> in QMP.
> >>>>
> >>>> This commit drops almost every single usage of the Monitor object, all
> >>>> monitor_printf() calls have been converted into DPRINTF() ones.
> >>>
> >>> I guess for most printfs, this is OK. But do you provide an alternative
> >>> for the block migration progress output? I did not find anything on
> >>> first glance. That is not a debugging feature.
> >>
> >> Can't the info migrate command be used for that?
> >
> > This was introduced for synchronous migration, as usability improvement.
> 
> Synchronous migration doesn't exist in QMP.
> 
> It's certainly possible to make the synchronous monitor command spit out status 
> as it already uses a polling loop to determine when migration completes.

As HMP now uses QMP as a real client, we'd have to make that information
available for all QMP users. Best place is probably query-migrate.

Don't you prefer to drop the whole thing instead? :-)
Eric Blake March 9, 2012, 7:48 p.m. UTC | #11
On 03/09/2012 12:42 PM, Eric Blake wrote:
> On 03/09/2012 11:53 AM, Anthony Liguori wrote:
>>>>
>>>> Could we just remove block migration entirely...
>>>
>>> Libvirt has already exposed block migration to users,
>>
>> :-(
>>
>> Do you rely on the progress stats that are printed?
> 
> I've never personally used it (as I said earlier, the libvirt support
> for blk and inc doesn't get much testing), but I can state that if you do:
> 
> virsh migrate --copy-storage-all --copy-storage-inc --verbose ...
> 
> that virsh will cause libvirt to start up a detached migration, then
> repeatedly call the query-migrate monitor command to update an on-screen
> progress monitor to the user; this progress monitor tracks both ram and
> disk status to compute the percentage complete showed to the user, so at
> some level, libvirt really is trying to rely on accurate block migration
> progress numbers.

Just realized I wasn't very clear:

libvirt does _not_ play back qemu's status numbers, so much as computing
its _own_ progress monitor based on parsing the output of the repeated
query-migrate commands.  And since libvirt tends to favor QMP over HMP,
the only monitoring we need from QMP is what we query for; we don't need
HMP-style update messages.  Having HMP update a progress line each time
it rearms the one second timer while waiting for the migration to
complete is probably good enough for HMP, and libvirt won't care.
Luiz Capitulino March 9, 2012, 7:57 p.m. UTC | #12
On Fri, 9 Mar 2012 16:48:10 -0300
Luiz Capitulino <lcapitulino@redhat.com> wrote:

> > It's certainly possible to make the synchronous monitor command spit out status 
> > as it already uses a polling loop to determine when migration completes.
> 
> As HMP now uses QMP as a real client, we'd have to make that information
> available for all QMP users. Best place is probably query-migrate.
> 
> Don't you prefer to drop the whole thing instead? :-)

Oh, we actually have block migration information in query-migrate already,
maybe we can use that to have a progress bar (not sure it's the same info
used by current progress bar though).

But dropping it is still a viable alternative :)
Kevin Wolf March 12, 2012, 2:51 p.m. UTC | #13
Am 09.03.2012 20:57, schrieb Luiz Capitulino:
> On Fri, 9 Mar 2012 16:48:10 -0300
> Luiz Capitulino <lcapitulino@redhat.com> wrote:
> 
>>> It's certainly possible to make the synchronous monitor command spit out status 
>>> as it already uses a polling loop to determine when migration completes.
>>
>> As HMP now uses QMP as a real client, we'd have to make that information
>> available for all QMP users. Best place is probably query-migrate.
>>
>> Don't you prefer to drop the whole thing instead? :-)
> 
> Oh, we actually have block migration information in query-migrate already,
> maybe we can use that to have a progress bar (not sure it's the same info
> used by current progress bar though).
> 
> But dropping it is still a viable alternative :)

We should use the decoupling of the human monitor to make it better
rather than worse. :-)

Kevin
Luiz Capitulino March 12, 2012, 3:01 p.m. UTC | #14
On Mon, 12 Mar 2012 15:51:04 +0100
Kevin Wolf <kwolf@redhat.com> wrote:

> Am 09.03.2012 20:57, schrieb Luiz Capitulino:
> > On Fri, 9 Mar 2012 16:48:10 -0300
> > Luiz Capitulino <lcapitulino@redhat.com> wrote:
> > 
> >>> It's certainly possible to make the synchronous monitor command spit out status 
> >>> as it already uses a polling loop to determine when migration completes.
> >>
> >> As HMP now uses QMP as a real client, we'd have to make that information
> >> available for all QMP users. Best place is probably query-migrate.
> >>
> >> Don't you prefer to drop the whole thing instead? :-)
> > 
> > Oh, we actually have block migration information in query-migrate already,
> > maybe we can use that to have a progress bar (not sure it's the same info
> > used by current progress bar though).
> > 
> > But dropping it is still a viable alternative :)
> 
> We should use the decoupling of the human monitor to make it better
> rather than worse. :-)

I've implemented the progress counting and will submit a new version of
the series later today.
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index a95ef49..595badf 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -260,7 +260,7 @@  static void sort_ram_list(void)
     g_free(blocks);
 }
 
-int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
+int ram_save_live(QEMUFile *f, int stage, void *opaque)
 {
     ram_addr_t addr;
     uint64_t bytes_transferred_last;
diff --git a/block-migration.c b/block-migration.c
index 4467468..fd2ffff 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -18,7 +18,6 @@ 
 #include "hw/hw.h"
 #include "qemu-queue.h"
 #include "qemu-timer.h"
-#include "monitor.h"
 #include "block-migration.h"
 #include "migration.h"
 #include "blockdev.h"
@@ -204,8 +203,7 @@  static void blk_mig_read_cb(void *opaque, int ret)
     assert(block_mig_state.submitted >= 0);
 }
 
-static int mig_save_device_bulk(Monitor *mon, QEMUFile *f,
-                                BlkMigDevState *bmds)
+static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
 {
     int64_t total_sectors = bmds->total_sectors;
     int64_t cur_sector = bmds->cur_sector;
@@ -272,7 +270,6 @@  static void set_dirty_tracking(int enable)
 
 static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
 {
-    Monitor *mon = opaque;
     BlkMigDevState *bmds;
     int64_t sectors;
 
@@ -295,19 +292,17 @@  static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
         block_mig_state.total_sector_sum += sectors;
 
         if (bmds->shared_base) {
-            monitor_printf(mon, "Start migration for %s with shared base "
-                                "image\n",
-                           bs->device_name);
+            DPRINTF("Start migration for %s with shared base image\n",
+                    bs->device_name);
         } else {
-            monitor_printf(mon, "Start full migration for %s\n",
-                           bs->device_name);
+            DPRINTF("Start full migration for %s\n", bs->device_name);
         }
 
         QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);
     }
 }
 
-static void init_blk_migration(Monitor *mon, QEMUFile *f)
+static void init_blk_migration(QEMUFile *f)
 {
     block_mig_state.submitted = 0;
     block_mig_state.read_done = 0;
@@ -318,10 +313,10 @@  static void init_blk_migration(Monitor *mon, QEMUFile *f)
     block_mig_state.total_time = 0;
     block_mig_state.reads = 0;
 
-    bdrv_iterate(init_blk_migration_it, mon);
+    bdrv_iterate(init_blk_migration_it, NULL);
 }
 
-static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f)
+static int blk_mig_save_bulked_block(QEMUFile *f)
 {
     int64_t completed_sector_sum = 0;
     BlkMigDevState *bmds;
@@ -330,7 +325,7 @@  static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f)
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
         if (bmds->bulk_completed == 0) {
-            if (mig_save_device_bulk(mon, f, bmds) == 1) {
+            if (mig_save_device_bulk(f, bmds) == 1) {
                 /* completed bulk section for this device */
                 bmds->bulk_completed = 1;
             }
@@ -352,8 +347,7 @@  static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f)
         block_mig_state.prev_progress = progress;
         qemu_put_be64(f, (progress << BDRV_SECTOR_BITS)
                          | BLK_MIG_FLAG_PROGRESS);
-        monitor_printf(mon, "Completed %d %%\r", progress);
-        monitor_flush(mon);
+        DPRINTF("Completed %d %%\r", progress);
     }
 
     return ret;
@@ -368,8 +362,8 @@  static void blk_mig_reset_dirty_cursor(void)
     }
 }
 
-static int mig_save_device_dirty(Monitor *mon, QEMUFile *f,
-                                 BlkMigDevState *bmds, int is_async)
+static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds,
+                                 int is_async)
 {
     BlkMigBlock *blk;
     int64_t total_sectors = bmds->total_sectors;
@@ -428,20 +422,20 @@  static int mig_save_device_dirty(Monitor *mon, QEMUFile *f,
     return (bmds->cur_dirty >= bmds->total_sectors);
 
 error:
-    monitor_printf(mon, "Error reading sector %" PRId64 "\n", sector);
+    DPRINTF("Error reading sector %" PRId64 "\n", sector);
     qemu_file_set_error(f, ret);
     g_free(blk->buf);
     g_free(blk);
     return 0;
 }
 
-static int blk_mig_save_dirty_block(Monitor *mon, QEMUFile *f, int is_async)
+static int blk_mig_save_dirty_block(QEMUFile *f, int is_async)
 {
     BlkMigDevState *bmds;
     int ret = 0;
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
-        if (mig_save_device_dirty(mon, f, bmds, is_async) == 0) {
+        if (mig_save_device_dirty(f, bmds, is_async) == 0) {
             ret = 1;
             break;
         }
@@ -520,7 +514,7 @@  static int is_stage2_completed(void)
     return 0;
 }
 
-static void blk_mig_cleanup(Monitor *mon)
+static void blk_mig_cleanup(void)
 {
     BlkMigDevState *bmds;
     BlkMigBlock *blk;
@@ -540,11 +534,9 @@  static void blk_mig_cleanup(Monitor *mon)
         g_free(blk->buf);
         g_free(blk);
     }
-
-    monitor_printf(mon, "\n");
 }
 
-static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
+static int block_save_live(QEMUFile *f, int stage, void *opaque)
 {
     int ret;
 
@@ -552,7 +544,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
             stage, block_mig_state.submitted, block_mig_state.transferred);
 
     if (stage < 0) {
-        blk_mig_cleanup(mon);
+        blk_mig_cleanup();
         return 0;
     }
 
@@ -563,7 +555,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
     }
 
     if (stage == 1) {
-        init_blk_migration(mon, f);
+        init_blk_migration(f);
 
         /* start track dirty blocks */
         set_dirty_tracking(1);
@@ -573,7 +565,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
 
     ret = qemu_file_get_error(f);
     if (ret) {
-        blk_mig_cleanup(mon);
+        blk_mig_cleanup();
         return ret;
     }
 
@@ -586,12 +578,12 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
                qemu_file_get_rate_limit(f)) {
             if (block_mig_state.bulk_completed == 0) {
                 /* first finish the bulk phase */
-                if (blk_mig_save_bulked_block(mon, f) == 0) {
+                if (blk_mig_save_bulked_block(f) == 0) {
                     /* finished saving bulk on all devices */
                     block_mig_state.bulk_completed = 1;
                 }
             } else {
-                if (blk_mig_save_dirty_block(mon, f, 1) == 0) {
+                if (blk_mig_save_dirty_block(f, 1) == 0) {
                     /* no more dirty blocks */
                     break;
                 }
@@ -602,7 +594,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
 
         ret = qemu_file_get_error(f);
         if (ret) {
-            blk_mig_cleanup(mon);
+            blk_mig_cleanup();
             return ret;
         }
     }
@@ -612,8 +604,8 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
            all async read completed */
         assert(block_mig_state.submitted == 0);
 
-        while (blk_mig_save_dirty_block(mon, f, 0) != 0);
-        blk_mig_cleanup(mon);
+        while (blk_mig_save_dirty_block(f, 0) != 0);
+        blk_mig_cleanup();
 
         /* report completion */
         qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
@@ -623,7 +615,7 @@  static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
             return ret;
         }
 
-        monitor_printf(mon, "Block migration completed\n");
+        DPRINTF("Block migration completed\n");
     }
 
     qemu_put_be64(f, BLK_MIG_FLAG_EOS);
diff --git a/migration.c b/migration.c
index 00fa1e3..b21b2df 100644
--- a/migration.c
+++ b/migration.c
@@ -258,7 +258,7 @@  static void migrate_fd_put_ready(void *opaque)
     }
 
     DPRINTF("iterate\n");
-    ret = qemu_savevm_state_iterate(s->mon, s->file);
+    ret = qemu_savevm_state_iterate(s->file);
     if (ret < 0) {
         migrate_fd_error(s);
     } else if (ret == 1) {
@@ -267,7 +267,7 @@  static void migrate_fd_put_ready(void *opaque)
         DPRINTF("done iterating\n");
         vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
 
-        if (qemu_savevm_state_complete(s->mon, s->file) < 0) {
+        if (qemu_savevm_state_complete(s->file) < 0) {
             migrate_fd_error(s);
         } else {
             migrate_fd_completed(s);
@@ -289,7 +289,7 @@  static void migrate_fd_cancel(MigrationState *s)
 
     s->state = MIG_STATE_CANCELLED;
     notifier_list_notify(&migration_state_notifiers, s);
-    qemu_savevm_state_cancel(s->mon, s->file);
+    qemu_savevm_state_cancel(s->file);
 
     migrate_fd_cleanup(s);
 }
@@ -367,7 +367,7 @@  void migrate_fd_connect(MigrationState *s)
                                       migrate_fd_close);
 
     DPRINTF("beginning savevm\n");
-    ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared);
+    ret = qemu_savevm_state_begin(s->file, s->blk, s->shared);
     if (ret < 0) {
         DPRINTF("failed, %d\n", ret);
         migrate_fd_error(s);
diff --git a/migration.h b/migration.h
index 372b066..0e44197 100644
--- a/migration.h
+++ b/migration.h
@@ -78,7 +78,7 @@  uint64_t ram_bytes_remaining(void);
 uint64_t ram_bytes_transferred(void);
 uint64_t ram_bytes_total(void);
 
-int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque);
+int ram_save_live(QEMUFile *f, int stage, void *opaque);
 int ram_load(QEMUFile *f, void *opaque, int version_id);
 
 /**
diff --git a/savevm.c b/savevm.c
index 80be1ff..70f5c4f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1554,8 +1554,7 @@  bool qemu_savevm_state_blocked(Monitor *mon)
     return false;
 }
 
-int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
-                            int shared)
+int qemu_savevm_state_begin(QEMUFile *f, int blk_enable, int shared)
 {
     SaveStateEntry *se;
     int ret;
@@ -1588,15 +1587,15 @@  int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
         qemu_put_be32(f, se->instance_id);
         qemu_put_be32(f, se->version_id);
 
-        ret = se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque);
+        ret = se->save_live_state(f, QEMU_VM_SECTION_START, se->opaque);
         if (ret < 0) {
-            qemu_savevm_state_cancel(mon, f);
+            qemu_savevm_state_cancel(f);
             return ret;
         }
     }
     ret = qemu_file_get_error(f);
     if (ret != 0) {
-        qemu_savevm_state_cancel(mon, f);
+        qemu_savevm_state_cancel(f);
     }
 
     return ret;
@@ -1609,7 +1608,7 @@  int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
  *   0 : We haven't finished, caller have to go again
  *   1 : We have finished, we can go to complete phase
  */
-int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
+int qemu_savevm_state_iterate(QEMUFile *f)
 {
     SaveStateEntry *se;
     int ret = 1;
@@ -1622,7 +1621,7 @@  int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
         qemu_put_byte(f, QEMU_VM_SECTION_PART);
         qemu_put_be32(f, se->section_id);
 
-        ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque);
+        ret = se->save_live_state(f, QEMU_VM_SECTION_PART, se->opaque);
         if (ret <= 0) {
             /* Do not proceed to the next vmstate before this one reported
                completion of the current stage. This serializes the migration
@@ -1636,12 +1635,12 @@  int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
     }
     ret = qemu_file_get_error(f);
     if (ret != 0) {
-        qemu_savevm_state_cancel(mon, f);
+        qemu_savevm_state_cancel(f);
     }
     return ret;
 }
 
-int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
+int qemu_savevm_state_complete(QEMUFile *f)
 {
     SaveStateEntry *se;
     int ret;
@@ -1656,7 +1655,7 @@  int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
         qemu_put_byte(f, QEMU_VM_SECTION_END);
         qemu_put_be32(f, se->section_id);
 
-        ret = se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
+        ret = se->save_live_state(f, QEMU_VM_SECTION_END, se->opaque);
         if (ret < 0) {
             return ret;
         }
@@ -1688,13 +1687,13 @@  int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
     return qemu_file_get_error(f);
 }
 
-void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
+void qemu_savevm_state_cancel(QEMUFile *f)
 {
     SaveStateEntry *se;
 
     QTAILQ_FOREACH(se, &savevm_handlers, entry) {
         if (se->save_live_state) {
-            se->save_live_state(mon, f, -1, se->opaque);
+            se->save_live_state(f, -1, se->opaque);
         }
     }
 }
@@ -1708,17 +1707,17 @@  static int qemu_savevm_state(Monitor *mon, QEMUFile *f)
         goto out;
     }
 
-    ret = qemu_savevm_state_begin(mon, f, 0, 0);
+    ret = qemu_savevm_state_begin(f, 0, 0);
     if (ret < 0)
         goto out;
 
     do {
-        ret = qemu_savevm_state_iterate(mon, f);
+        ret = qemu_savevm_state_iterate(f);
         if (ret < 0)
             goto out;
     } while (ret == 0);
 
-    ret = qemu_savevm_state_complete(mon, f);
+    ret = qemu_savevm_state_complete(f);
 
 out:
     if (ret == 0) {
diff --git a/sysemu.h b/sysemu.h
index 98118cc..29b0e96 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -77,11 +77,10 @@  void do_info_snapshots(Monitor *mon);
 void qemu_announce_self(void);
 
 bool qemu_savevm_state_blocked(Monitor *mon);
-int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
-                            int shared);
-int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
-int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
-void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
+int qemu_savevm_state_begin(QEMUFile *f, int blk_enable, int shared);
+int qemu_savevm_state_iterate(QEMUFile *f);
+int qemu_savevm_state_complete(QEMUFile *f);
+void qemu_savevm_state_cancel(QEMUFile *f);
 int qemu_loadvm_state(QEMUFile *f);
 
 /* SLIRP */
diff --git a/vmstate.h b/vmstate.h
index 9d3c49c..82d97ae 100644
--- a/vmstate.h
+++ b/vmstate.h
@@ -28,8 +28,7 @@ 
 
 typedef void SaveSetParamsHandler(int blk_enable, int shared, void * opaque);
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
-typedef int SaveLiveStateHandler(Monitor *mon, QEMUFile *f, int stage,
-                                 void *opaque);
+typedef int SaveLiveStateHandler(QEMUFile *f, int stage, void *opaque);
 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 int register_savevm(DeviceState *dev,