migration: Rename res_{postcopy,precopy}_only
Once that res_compatible is removed, they don't make sense anymore. We remove the _only preffix. And to make things clearer we rename them to must_precopy and can_postcopy. Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
24f254ed79
commit
24beea4efe
@ -182,16 +182,15 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmma_state_pending(void *opaque,
|
static void cmma_state_pending(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy)
|
||||||
uint64_t *res_postcopy_only)
|
|
||||||
{
|
{
|
||||||
S390StAttribState *sas = S390_STATTRIB(opaque);
|
S390StAttribState *sas = S390_STATTRIB(opaque);
|
||||||
S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
|
S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
|
||||||
long long res = sac->get_dirtycount(sas);
|
long long res = sac->get_dirtycount(sas);
|
||||||
|
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
*res_precopy_only += res;
|
*must_precopy += res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,9 +456,8 @@ static void vfio_save_cleanup(void *opaque)
|
|||||||
trace_vfio_save_cleanup(vbasedev->name);
|
trace_vfio_save_cleanup(vbasedev->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_state_pending(void *opaque,
|
static void vfio_state_pending(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy)
|
||||||
uint64_t *res_postcopy_only)
|
|
||||||
{
|
{
|
||||||
VFIODevice *vbasedev = opaque;
|
VFIODevice *vbasedev = opaque;
|
||||||
VFIOMigration *migration = vbasedev->migration;
|
VFIOMigration *migration = vbasedev->migration;
|
||||||
@ -469,10 +468,9 @@ static void vfio_state_pending(void *opaque,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*res_precopy_only += migration->pending_bytes;
|
*must_precopy += migration->pending_bytes;
|
||||||
|
|
||||||
trace_vfio_state_pending(vbasedev->name, *res_precopy_only,
|
trace_vfio_state_pending(vbasedev->name, *must_precopy, *can_postcopy);
|
||||||
*res_postcopy_only);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vfio_save_iterate(QEMUFile *f, void *opaque)
|
static int vfio_save_iterate(QEMUFile *f, void *opaque)
|
||||||
|
@ -47,22 +47,25 @@ typedef struct SaveVMHandlers {
|
|||||||
/* This runs outside the iothread lock! */
|
/* This runs outside the iothread lock! */
|
||||||
int (*save_setup)(QEMUFile *f, void *opaque);
|
int (*save_setup)(QEMUFile *f, void *opaque);
|
||||||
/* Note for save_live_pending:
|
/* Note for save_live_pending:
|
||||||
* - res_precopy_only is for data which must be migrated in precopy phase
|
* must_precopy:
|
||||||
* or in stopped state, in other words - before target vm start
|
* - must be migrated in precopy or in stopped state
|
||||||
* - res_postcopy_only is for data which must be migrated in postcopy phase
|
* - i.e. must be migrated before target start
|
||||||
* or in stopped state, in other words - after source vm stop
|
|
||||||
*
|
*
|
||||||
* Sum of res_postcopy_only and res_postcopy_only is the whole
|
* can_postcopy:
|
||||||
* amount of pending data.
|
* - can migrate in postcopy or in stopped state
|
||||||
|
* - i.e. can migrate after target start
|
||||||
|
* - some can also be migrated during precopy (RAM)
|
||||||
|
* - some must be migrated after source stops (block-dirty-bitmap)
|
||||||
|
*
|
||||||
|
* Sum of can_postcopy and must_postcopy is the whole amount of
|
||||||
|
* pending data.
|
||||||
*/
|
*/
|
||||||
/* This estimates the remaining data to transfer */
|
/* This estimates the remaining data to transfer */
|
||||||
void (*state_pending_estimate)(void *opaque,
|
void (*state_pending_estimate)(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy);
|
||||||
uint64_t *res_postcopy_only);
|
|
||||||
/* This calculate the exact remaining data to transfer */
|
/* This calculate the exact remaining data to transfer */
|
||||||
void (*state_pending_exact)(void *opaque,
|
void (*state_pending_exact)(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy);
|
||||||
uint64_t *res_postcopy_only);
|
|
||||||
LoadStateHandler *load_state;
|
LoadStateHandler *load_state;
|
||||||
int (*load_setup)(QEMUFile *f, void *opaque);
|
int (*load_setup)(QEMUFile *f, void *opaque);
|
||||||
int (*load_cleanup)(void *opaque);
|
int (*load_cleanup)(void *opaque);
|
||||||
|
@ -763,8 +763,8 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void dirty_bitmap_state_pending(void *opaque,
|
static void dirty_bitmap_state_pending(void *opaque,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *must_precopy,
|
||||||
uint64_t *res_postcopy_only)
|
uint64_t *can_postcopy)
|
||||||
{
|
{
|
||||||
DBMSaveState *s = &((DBMState *)opaque)->save;
|
DBMSaveState *s = &((DBMState *)opaque)->save;
|
||||||
SaveBitmapState *dbms;
|
SaveBitmapState *dbms;
|
||||||
@ -784,7 +784,7 @@ static void dirty_bitmap_state_pending(void *opaque,
|
|||||||
|
|
||||||
trace_dirty_bitmap_state_pending(pending);
|
trace_dirty_bitmap_state_pending(pending);
|
||||||
|
|
||||||
*res_postcopy_only += pending;
|
*can_postcopy += pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First occurrence of this bitmap. It should be created if doesn't exist */
|
/* First occurrence of this bitmap. It should be created if doesn't exist */
|
||||||
|
@ -853,9 +853,8 @@ static int block_save_complete(QEMUFile *f, void *opaque)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void block_state_pending(void *opaque,
|
static void block_state_pending(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy)
|
||||||
uint64_t *res_postcopy_only)
|
|
||||||
{
|
{
|
||||||
/* Estimate pending number of bytes to send */
|
/* Estimate pending number of bytes to send */
|
||||||
uint64_t pending;
|
uint64_t pending;
|
||||||
@ -876,7 +875,7 @@ static void block_state_pending(void *opaque,
|
|||||||
|
|
||||||
trace_migration_block_state_pending(pending);
|
trace_migration_block_state_pending(pending);
|
||||||
/* We don't do postcopy */
|
/* We don't do postcopy */
|
||||||
*res_precopy_only += pending;
|
*must_precopy += pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int block_load(QEMUFile *f, void *opaque, int version_id)
|
static int block_load(QEMUFile *f, void *opaque, int version_id)
|
||||||
|
@ -3863,18 +3863,18 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
static MigIterateState migration_iteration_run(MigrationState *s)
|
static MigIterateState migration_iteration_run(MigrationState *s)
|
||||||
{
|
{
|
||||||
uint64_t pend_pre, pend_post;
|
uint64_t must_precopy, can_postcopy;
|
||||||
bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
|
bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
|
||||||
|
|
||||||
qemu_savevm_state_pending_estimate(&pend_pre, &pend_post);
|
qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy);
|
||||||
uint64_t pending_size = pend_pre + pend_post;
|
uint64_t pending_size = must_precopy + can_postcopy;
|
||||||
|
|
||||||
trace_migrate_pending_estimate(pending_size, pend_pre, pend_post);
|
trace_migrate_pending_estimate(pending_size, must_precopy, can_postcopy);
|
||||||
|
|
||||||
if (pend_pre <= s->threshold_size) {
|
if (must_precopy <= s->threshold_size) {
|
||||||
qemu_savevm_state_pending_exact(&pend_pre, &pend_post);
|
qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
|
||||||
pending_size = pend_pre + pend_post;
|
pending_size = must_precopy + can_postcopy;
|
||||||
trace_migrate_pending_exact(pending_size, pend_pre, pend_post);
|
trace_migrate_pending_exact(pending_size, must_precopy, can_postcopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pending_size || pending_size < s->threshold_size) {
|
if (!pending_size || pending_size < s->threshold_size) {
|
||||||
@ -3884,7 +3884,7 @@ static MigIterateState migration_iteration_run(MigrationState *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Still a significant amount to transfer */
|
/* Still a significant amount to transfer */
|
||||||
if (!in_postcopy && pend_pre <= s->threshold_size &&
|
if (!in_postcopy && must_precopy <= s->threshold_size &&
|
||||||
qatomic_read(&s->start_postcopy)) {
|
qatomic_read(&s->start_postcopy)) {
|
||||||
if (postcopy_start(s)) {
|
if (postcopy_start(s)) {
|
||||||
error_report("%s: postcopy failed to start", __func__);
|
error_report("%s: postcopy failed to start", __func__);
|
||||||
|
@ -3489,9 +3489,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ram_state_pending_estimate(void *opaque,
|
static void ram_state_pending_estimate(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy)
|
||||||
uint64_t *res_postcopy_only)
|
|
||||||
{
|
{
|
||||||
RAMState **temp = opaque;
|
RAMState **temp = opaque;
|
||||||
RAMState *rs = *temp;
|
RAMState *rs = *temp;
|
||||||
@ -3500,15 +3499,14 @@ static void ram_state_pending_estimate(void *opaque,
|
|||||||
|
|
||||||
if (migrate_postcopy_ram()) {
|
if (migrate_postcopy_ram()) {
|
||||||
/* We can do postcopy, and all the data is postcopiable */
|
/* We can do postcopy, and all the data is postcopiable */
|
||||||
*res_postcopy_only += remaining_size;
|
*can_postcopy += remaining_size;
|
||||||
} else {
|
} else {
|
||||||
*res_precopy_only += remaining_size;
|
*must_precopy += remaining_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ram_state_pending_exact(void *opaque,
|
static void ram_state_pending_exact(void *opaque, uint64_t *must_precopy,
|
||||||
uint64_t *res_precopy_only,
|
uint64_t *can_postcopy)
|
||||||
uint64_t *res_postcopy_only)
|
|
||||||
{
|
{
|
||||||
RAMState **temp = opaque;
|
RAMState **temp = opaque;
|
||||||
RAMState *rs = *temp;
|
RAMState *rs = *temp;
|
||||||
@ -3526,9 +3524,9 @@ static void ram_state_pending_exact(void *opaque,
|
|||||||
|
|
||||||
if (migrate_postcopy_ram()) {
|
if (migrate_postcopy_ram()) {
|
||||||
/* We can do postcopy, and all the data is postcopiable */
|
/* We can do postcopy, and all the data is postcopiable */
|
||||||
*res_postcopy_only += remaining_size;
|
*can_postcopy += remaining_size;
|
||||||
} else {
|
} else {
|
||||||
*res_precopy_only += remaining_size;
|
*must_precopy += remaining_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1541,13 +1541,13 @@ flush:
|
|||||||
* the result is split into the amount for units that can and
|
* the result is split into the amount for units that can and
|
||||||
* for units that can't do postcopy.
|
* for units that can't do postcopy.
|
||||||
*/
|
*/
|
||||||
void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
|
||||||
uint64_t *res_postcopy_only)
|
uint64_t *can_postcopy)
|
||||||
{
|
{
|
||||||
SaveStateEntry *se;
|
SaveStateEntry *se;
|
||||||
|
|
||||||
*res_precopy_only = 0;
|
*must_precopy = 0;
|
||||||
*res_postcopy_only = 0;
|
*can_postcopy = 0;
|
||||||
|
|
||||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||||
if (!se->ops || !se->ops->state_pending_estimate) {
|
if (!se->ops || !se->ops->state_pending_estimate) {
|
||||||
@ -1558,19 +1558,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
se->ops->state_pending_estimate(se->opaque,
|
se->ops->state_pending_estimate(se->opaque, must_precopy, can_postcopy);
|
||||||
res_precopy_only,
|
|
||||||
res_postcopy_only);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
|
||||||
uint64_t *res_postcopy_only)
|
uint64_t *can_postcopy)
|
||||||
{
|
{
|
||||||
SaveStateEntry *se;
|
SaveStateEntry *se;
|
||||||
|
|
||||||
*res_precopy_only = 0;
|
*must_precopy = 0;
|
||||||
*res_postcopy_only = 0;
|
*can_postcopy = 0;
|
||||||
|
|
||||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||||
if (!se->ops || !se->ops->state_pending_exact) {
|
if (!se->ops || !se->ops->state_pending_exact) {
|
||||||
@ -1581,9 +1579,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
se->ops->state_pending_exact(se->opaque,
|
se->ops->state_pending_exact(se->opaque, must_precopy, can_postcopy);
|
||||||
res_precopy_only,
|
|
||||||
res_postcopy_only);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ void qemu_savevm_state_cleanup(void);
|
|||||||
void qemu_savevm_state_complete_postcopy(QEMUFile *f);
|
void qemu_savevm_state_complete_postcopy(QEMUFile *f);
|
||||||
int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
|
int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
|
||||||
bool inactivate_disks);
|
bool inactivate_disks);
|
||||||
void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
|
void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
|
||||||
uint64_t *res_postcopy_only);
|
uint64_t *can_postcopy);
|
||||||
void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
|
void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
|
||||||
uint64_t *res_postcopy_only);
|
uint64_t *can_postcopy);
|
||||||
void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
|
void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
|
||||||
void qemu_savevm_send_open_return_path(QEMUFile *f);
|
void qemu_savevm_send_open_return_path(QEMUFile *f);
|
||||||
int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
|
int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
|
||||||
|
Loading…
Reference in New Issue
Block a user