Skip to content

Commit

Permalink
migration: Take bitmap mutex when completing ram migration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xzpeter authored and Juan Quintela committed Dec 15, 2022
1 parent a4dbaf8 commit c13221b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions migration/ram.c
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit c13221b

Please sign in to comment.