diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-02-22 17:36:27 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2013-03-11 13:32:01 +0100 |
commit | 32c835ba3984728c22d4e73cdb595090a60f437e (patch) | |
tree | 48c53ef25b4ec19f1f006694294ca109ef3500f1 /arch_init.c | |
parent | 8c8de19d93444536d3291e6ab83e2bcf61dd2d0c (diff) | |
download | qemu-32c835ba3984728c22d4e73cdb595090a60f437e.zip qemu-32c835ba3984728c22d4e73cdb595090a60f437e.tar.gz qemu-32c835ba3984728c22d4e73cdb595090a60f437e.tar.bz2 |
migration: run pending/iterate callbacks out of big lock
This makes it possible to do blocking writes directly to the socket,
with no buffer in the middle. For RAM, only the migration_bitmap_sync()
call needs the iothread lock. For block migration, it is needed by
the block layer (including bdrv_drain_all and dirty bitmap access),
but because some code is shared between iterate and complete, all of
mig_save_device_dirty is run with the lock taken.
In the savevm case, the iterate callback runs within the big lock.
This is annoying because it complicates the rules. Luckily we do not
need to do anything about it: the RAM iterate callback does not need
the iothread lock, and block migration never runs during savevm.
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r-- | arch_init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c index 8daeafa..32b4378 100644 --- a/arch_init.c +++ b/arch_init.c @@ -379,6 +379,8 @@ static inline bool migration_bitmap_set_dirty(MemoryRegion *mr, return ret; } +/* Needs iothread lock! */ + static void migration_bitmap_sync(void) { RAMBlock *block; @@ -690,7 +692,9 @@ static uint64_t ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size) remaining_size = ram_save_remaining() * TARGET_PAGE_SIZE; if (remaining_size < max_size) { + qemu_mutex_lock_iothread(); migration_bitmap_sync(); + qemu_mutex_unlock_iothread(); remaining_size = ram_save_remaining() * TARGET_PAGE_SIZE; } return remaining_size; |