aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2022-10-11 17:55:45 -0400
committerJuan Quintela <quintela@redhat.com>2022-12-15 10:30:37 +0100
commitc13221b56faaaf732de95d05a7742c1913363b48 (patch)
tree335721133e2ec7dd2dd824c664c6c3de3a0cff42 /migration
parenta4dbaf8eedbb81060ce6963f118442f7aa0ba61e (diff)
downloadqemu-c13221b56faaaf732de95d05a7742c1913363b48.zip
qemu-c13221b56faaaf732de95d05a7742c1913363b48.tar.gz
qemu-c13221b56faaaf732de95d05a7742c1913363b48.tar.bz2
migration: Take bitmap mutex when completing ram migration
Any call to ram_find_and_save_block() needs to take the bitmap mutex. We used to not take it for most of ram_save_complete() because we thought we're the only one left using the bitmap, but it's not true after the preempt full patchset applied, since the return path can be taking it too. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 8aad17c..cc72c24 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3406,6 +3406,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
/* try transferring iterative blocks of memory */
/* flush all remaining blocks regardless of rate limiting */
+ qemu_mutex_lock(&rs->bitmap_mutex);
while (true) {
int pages;
@@ -3419,6 +3420,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
break;
}
}
+ qemu_mutex_unlock(&rs->bitmap_mutex);
flush_compressed_data(rs);
ram_control_after_iterate(f, RAM_CONTROL_FINISH);