migration/colo.c: Flush ram cache only after receiving device state
If we suceed in receiving ram state, but fail receiving the device state, there will be a mismatch between the two. Fix this by flushing the ram cache only after the vmstate has been received. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Message-Id: <3289d007d494cb0e2f05b1cf4ae6a78d300fede3.1589193382.git.lukasstraub2@web.de> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
786d8b8e38
commit
24fa16f8cc
@ -748,6 +748,7 @@ static void colo_incoming_process_checkpoint(MigrationIncomingState *mis,
|
|||||||
|
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
vmstate_loading = true;
|
vmstate_loading = true;
|
||||||
|
colo_flush_ram_cache();
|
||||||
ret = qemu_load_device_state(fb);
|
ret = qemu_load_device_state(fb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error_setg(errp, "COLO: load device state failed");
|
error_setg(errp, "COLO: load device state failed");
|
||||||
|
@ -3360,7 +3360,7 @@ static bool postcopy_is_running(void)
|
|||||||
* Flush content of RAM cache into SVM's memory.
|
* Flush content of RAM cache into SVM's memory.
|
||||||
* Only flush the pages that be dirtied by PVM or SVM or both.
|
* Only flush the pages that be dirtied by PVM or SVM or both.
|
||||||
*/
|
*/
|
||||||
static void colo_flush_ram_cache(void)
|
void colo_flush_ram_cache(void)
|
||||||
{
|
{
|
||||||
RAMBlock *block = NULL;
|
RAMBlock *block = NULL;
|
||||||
void *dst_host;
|
void *dst_host;
|
||||||
@ -3632,9 +3632,6 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
|||||||
}
|
}
|
||||||
trace_ram_load_complete(ret, seq_iter);
|
trace_ram_load_complete(ret, seq_iter);
|
||||||
|
|
||||||
if (!ret && migration_incoming_in_colo_state()) {
|
|
||||||
colo_flush_ram_cache();
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ int ram_dirty_bitmap_reload(MigrationState *s, RAMBlock *rb);
|
|||||||
|
|
||||||
/* ram cache */
|
/* ram cache */
|
||||||
int colo_init_ram_cache(void);
|
int colo_init_ram_cache(void);
|
||||||
|
void colo_flush_ram_cache(void);
|
||||||
void colo_release_ram_cache(void);
|
void colo_release_ram_cache(void);
|
||||||
void colo_incoming_start_dirty_log(void);
|
void colo_incoming_start_dirty_log(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user