mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Modify save_live_pending for postcopy
Modify save_live_pending to return separate postcopiable and non-postcopiable counts. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
11cf1d984b
commit
c31b098f64
7 changed files with 38 additions and 14 deletions
|
@ -748,7 +748,9 @@ static int block_save_complete(QEMUFile *f, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
|
||||
static void block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size,
|
||||
uint64_t *non_postcopiable_pending,
|
||||
uint64_t *postcopiable_pending)
|
||||
{
|
||||
/* Estimate pending number of bytes to send */
|
||||
uint64_t pending;
|
||||
|
@ -767,7 +769,8 @@ static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
|
|||
qemu_mutex_unlock_iothread();
|
||||
|
||||
DPRINTF("Enter save live pending %" PRIu64 "\n", pending);
|
||||
return pending;
|
||||
/* We don't do postcopy */
|
||||
*non_postcopiable_pending += pending;
|
||||
}
|
||||
|
||||
static int block_load(QEMUFile *f, void *opaque, int version_id)
|
||||
|
|
|
@ -1288,8 +1288,13 @@ static void *migration_thread(void *opaque)
|
|||
uint64_t pending_size;
|
||||
|
||||
if (!qemu_file_rate_limit(s->file)) {
|
||||
pending_size = qemu_savevm_state_pending(s->file, max_size);
|
||||
trace_migrate_pending(pending_size, max_size);
|
||||
uint64_t pend_post, pend_nonpost;
|
||||
|
||||
qemu_savevm_state_pending(s->file, max_size, &pend_nonpost,
|
||||
&pend_post);
|
||||
pending_size = pend_nonpost + pend_post;
|
||||
trace_migrate_pending(pending_size, max_size,
|
||||
pend_post, pend_nonpost);
|
||||
if (pending_size && pending_size >= max_size) {
|
||||
qemu_savevm_state_iterate(s->file);
|
||||
} else {
|
||||
|
|
|
@ -1383,7 +1383,9 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint64_t ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
|
||||
static void ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size,
|
||||
uint64_t *non_postcopiable_pending,
|
||||
uint64_t *postcopiable_pending)
|
||||
{
|
||||
uint64_t remaining_size;
|
||||
|
||||
|
@ -1397,7 +1399,9 @@ static uint64_t ram_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
|
|||
qemu_mutex_unlock_iothread();
|
||||
remaining_size = ram_save_remaining() * TARGET_PAGE_SIZE;
|
||||
}
|
||||
return remaining_size;
|
||||
|
||||
/* We can do postcopy, and all the data is postcopiable */
|
||||
*postcopiable_pending += remaining_size;
|
||||
}
|
||||
|
||||
static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
|
||||
|
|
|
@ -1053,10 +1053,19 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f)
|
|||
qemu_fflush(f);
|
||||
}
|
||||
|
||||
uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
|
||||
/* Give an estimate of the amount left to be transferred,
|
||||
* the result is split into the amount for units that can and
|
||||
* for units that can't do postcopy.
|
||||
*/
|
||||
void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size,
|
||||
uint64_t *res_non_postcopiable,
|
||||
uint64_t *res_postcopiable)
|
||||
{
|
||||
SaveStateEntry *se;
|
||||
uint64_t ret = 0;
|
||||
|
||||
*res_non_postcopiable = 0;
|
||||
*res_postcopiable = 0;
|
||||
|
||||
|
||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||
if (!se->ops || !se->ops->save_live_pending) {
|
||||
|
@ -1067,9 +1076,9 @@ uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
ret += se->ops->save_live_pending(f, se->opaque, max_size);
|
||||
se->ops->save_live_pending(f, se->opaque, max_size,
|
||||
res_non_postcopiable, res_postcopiable);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void qemu_savevm_state_cleanup(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue