Remove res_compatible parameter
cover Remove res_compatible parameter
Hi
This series are the redo of the series from vfio. Vladimir Sementsov-Ogievskiy <[email protected]> asked that I split the change in ram.c (only place that set res_compatible), and the rest of the patches.
So I ended:
- change ram.c to put the memory in res_postcopy
- remove res_compatible
- rename res_postcopy/precopy_only to not have the _only suffix.
Please review.
Juan Quintela (3):
migration: In case of postcopy, the memory ends in res_postcopy_only
migration: Remove unused res_compatible
migration: Remove _only suffix for res_postcopy/precopy
include/migration/register.h | 21 ++++++++------------- migration/savevm.h | 10 ++++------ hw/s390x/s390-stattrib.c | 8 +++----- hw/vfio/migration.c | 11 ++++------- migration/block-dirty-bitmap.c | 7 +++---- migration/block.c | 8 +++----- migration/migration.c | 18 ++++++++---------- migration/ram.c | 20 ++++++++------------ migration/savevm.c | 28 ++++++++++------------------ hw/vfio/trace-events | 2 +- migration/trace-events | 4 ++-- 11 files changed, 54 insertions(+), 83 deletions(-)
Signature · 1 line
2.39.1
PATCH 1/3 migration: In case of postcopy, the memory ends in res_postcopy_only
So remove last assignation of res_compatible.
--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/ram.c +1 -1
@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ - *res_compatible += remaining_size; + *res_postcopy_only += remaining_size; }else { *res_precopy_only += remaining_size; }
Signature · 1 line
2.39.1
Re: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.
I hoped for some description when asked to split it out :)
Quoted 11 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0
migration/ram.c static void ram_state_pending_exact(void *opaque, · line 3477
Quoted 5 lines
migration/ram.c +1
-1@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ - *res_compatible += remaining_size; + *res_postcopy_only += remaining_size;
Actually, these "remaining_size" bytes are still compatible, i.e. we can migrate these pending bytes in pre-copy, and we actually do it, until user call migrate-start-postcopy, yes? But we exploit the fact that, this change don't affect any logic, just name becomes wrong.. Yes? Or I don't follow:/
Quoted 3 lines
migration/ram.c +0
-0}else { *res_precopy_only += remaining_size; }
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.I hoped for some description when asked to split it out :)
Quoted 11 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */
Quoted 8 lines
migration/ram.c static void ram_state_pending_exact(void *opaque, · line 3477
Quoted 2 lines
migration/ram.c +1
-1- *res_compatible += remaining_size; + *res_postcopy_only += remaining_size;Actually, these "
remaining_size" bytes are still compatible, i.e. we can migrate these pending bytes in pre-copy, and we actually do it, until user call migrate-start-postcopy, yes? But we exploit the fact that, this change don't affect any logic, just name becomes wrong.. Yes? Or I don't follow:/
My definition of the fields is: how are we going to transfer that bytes.
if they are on res_precopy_only, we transfer them with precopy, if they are on res_postocpy_only, we transfer them with postcopy.
So, the rest of RAM, if we are in postcopy, we sent it with postcopy, and if we are in precopy, we sent them with precopy. See the whole code. This is the _estimate function.
uint64_t remaining_size = rs->migration_dirty_pages * TARGET_PAGE_SIZE;
if (migrate_postcopy_ram()) {
/* We can do postcopy, and all the data is postcopiable */
*res_postcopy_only += remaining_size;
} else {
*res_precopy_only += remaining_size;
}After the change, _exact does exactly the same.
The caller (migration_iteration_run()) does this (I remove traces and things that don't matter for this). This is before the change.
Remember: in precopy, we add res_compat to pend_pre, and in postcopy to pend_post.
uint64_t pending_size = pend_pre + pend_compat + pend_post;
### pending_size is the sum of the three, so it doesn't matter.
if (pend_pre + pend_compat <= s->threshold_size) {### In precopy, we add pend_compat to pend_pre, so we are ok. ### In postcopy, we add the data to pend_postcopy, but that is right, ### because to calculate the downtime, we only care about what we have ### to transfer with precopy, in particular, we aren't going to send ### more ram, so it is ok that it is in pend_post.
qemu_savevm_state_pending_exact(&pend_pre, &pend_compat, &pend_post);
pending_size = pend_pre + pend_compat + pend_post;
}
if (!pending_size || pending_size < s->threshold_size) {
migration_completion(s);
return MIG_ITERATE_BREAK;
}
/* Still a significant amount to transfer */
if (!in_postcopy && pend_pre <= s->threshold_size &&
qatomic_read(&s->start_postcopy)) {#### this is what I mean. See how we only use pend_pre to decide if we ### are entering postcopy.
if (postcopy_start(s)) {
error_report("%s: postcopy failed to start", __func__);
}
return MIG_ITERATE_SKIP;
}So the only "behaviour" that we can say are having is that with the change we are a little bit more aggressive on calling qemu_savevm_state_pending_exact(), but I will arguee that the new behaviour is the right one.
What do you think?
Later, Juan.
Vladimir Sementsov-Ogievskiy
Reviewed-byRe: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
Quoted 79 lines · Juan Quintela
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.I hoped for some description when asked to split it out :)
Quoted 11 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ Quoted 8 lines
migration/ram.c static void ram_state_pending_exact(void *opaque, · line 3477
Quoted 2 lines
migration/ram.c +1
-1- *res_compatible += remaining_size; + *res_postcopy_only += remaining_size;Actually, these "
remaining_size" bytes are still compatible, i.e. we can migrate these pending bytes in pre-copy, and we actually do it, until user call migrate-start-postcopy, yes? But we exploit the fact that, this change don't affect any logic, just name becomes wrong.. Yes? Or I don't follow:/My definition of the fields is: how are we going to transfer that bytes.
if they are on
res_precopy_only, we transfer them with precopy, if they are onres_postocpy_only, we transfer them with postcopy.So, the rest of RAM, if we are in postcopy, we sent it with postcopy, and if we are in precopy, we sent them with precopy. See the whole code. This is the
_estimatefunction.uint64_t remaining_size = rs->migration_dirty_pages * TARGET_PAGE_SIZE; if (migrate_postcopy_ram()) { /* We can do postcopy, and all the data is postcopiable */ *res_postcopy_only += remaining_size; } else { *res_precopy_only += remaining_size; }After the change,
_exactdoes exactly the same.The caller (
migration_iteration_run()) does this (I remove traces and things that don't matter for this). This is before the change.
Remember: in precopy, we addres_compattopend_pre, and in postcopy topend_post.uint64_t pending_size = pend_pre + pend_compat + pend_post;###
pending_sizeis the sum of the three, so it doesn't matter.if (pend_pre + pend_compat <= s->threshold_size) {### In precopy, we add pend_compat to pend_pre, so we are ok. ### In postcopy, we add the data to pend_postcopy, but that is right, ### because to calculate the downtime, we only care about what we have ### to transfer with precopy, in particular, we aren't going to send ### more ram, so it is ok that it is in pend_post.qemu_savevm_state_pending_exact(&pend_pre, &pend_compat, &pend_post); pending_size = pend_pre + pend_compat + pend_post; } if (!pending_size || pending_size < s->threshold_size) { migration_completion(s); return MIG_ITERATE_BREAK; } /* Still a significant amount to transfer */ if (!in_postcopy && pend_pre <= s->threshold_size && qatomic_read(&s->start_postcopy)) {#### this is what I mean. See how we only use
pend_preto decide if we ### are entering postcopy.
Quoted 7 lines
if (postcopy_start(s)) { error_report("%s: postcopy failed to start", __func__); } return MIG_ITERATE_SKIP; }So the only "behaviour" that we can say are having is that with the
actualy, this one was already "changed", as _estimate never return compat other than zero.
So, The patch really changes nothing
Quoted 6 lines
change we are a little bit more aggressive on calling
qemu_savevm_state_pending_exact(), but I will arguee that the new behaviour is the right one.What do you think?
I think, that the order of logic and documentation changing since introducing _estimate is a bit confused.
But I agree now, that we are safe to unite old compat and old postcopy_only into one variable, as we want only
1. the total sum, to probably go to migration_completion()
2. pend_pre to probably go to postcopy_start()
So, patch is OK, and seems it changes absolutely nothing in logic. Thanks for explanations!
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Quoted 4 lines · Juan Quintela
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.I think, that the order of logic and documentation changing since introducing
_estimateis a bit confused.But I agree now, that we are safe to unite old compat and old
postcopy_onlyinto one variable, as we want only
Quoted 7 lines
1. the total sum, to probably go to
migration_completion()
2.pend_preto probably go topostcopy_start()So, patch is OK, and seems it changes absolutely nothing in logic. Thanks for explanations!
Reviewed-by Vladimir Sementsov-Ogievskiy <[email protected]>
Thanks.
You are welcome.
Re: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
In reply to Vladimir Sementsov-OgievskiyQuoted 16 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.I hoped for some description when asked to split it out :)
Quoted 11 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */
Quoted 8 lines
migration/ram.c static void ram_state_pending_exact(void *opaque, · line 3477
Quoted 2 lines
migration/ram.c +1
-1- *res_compatible += remaining_size; + *res_postcopy_only += remaining_size;Actually, these "
remaining_size" bytes are still compatible, i.e. we can migrate these pending bytes in pre-copy, and we actually do it, until user call migrate-start-postcopy, yes? But we exploit the fact that, this change don't affect any logic, just name becomes wrong.. Yes? Or I don't follow:/
I think of this from this different angle:
- if we are on precopy, we return on res_precopy everything (and nothing on res_postcopy)
- if we are on postcopy, we return on res_precopy what we _must_ sent through precopy, and in res_postcopy what we can sent through postcopy.
i.e. if we stop the guest and do the migration right now, what are we going to send through each channel.
Later, Juan.
Re: [PATCH 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
Quoted 33 lines · Juan Quintela
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
Quoted 1 line · Juan Quintela
So remove last assignation of
res_compatible.I hoped for some description when asked to split it out :)
Quoted 11 lines
Signed-off-by Juan Quintela <[email protected]>--- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)migration/ram.c +0
-0@@ -3474,7 +3474,7 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ Quoted 8 lines
migration/ram.c static void ram_state_pending_exact(void *opaque, · line 3477
Quoted 2 lines
migration/ram.c +1
-1- *res_compatible += remaining_size; + *res_postcopy_only += remaining_size;Actually, these "
remaining_size" bytes are still compatible, i.e. we can migrate these pending bytes in pre-copy, and we actually do it, until user call migrate-start-postcopy, yes? But we exploit the fact that, this change don't affect any logic, just name becomes wrong.. Yes? Or I don't follow:/I think of this from this different angle:
- if we are on precopy, we return onres_precopyeverything (and nothing onres_postcopy)
- if we are on postcopy, we return onres_precopywhat we _must_ sent through precopy, and inres_postcopywhat we can sent through postcopy.
Quoted 3 lines
i.e. if we stop the guest and do the migration right now, what are we going to send through each channel.
I understand.
I've introduced the division into three parts together with block-dirty-bitmap implementation, and it seemed significant to me that block-dirty-bitmap pending is postcopy_only in the sense that it can't be migrated before source stop, unlike RAM. But yes, it turns out that that's not significant for the generic migration algorithm, it works the same way for RAM and block-dirty-bitmap not distinguishing postcopy_only vs comaptible.
Anyway final documentation and new field names that you proposed are clean and correspond to the meaning which you have expected. And it avoids extra variable that I've introduced.
Haha. Looking at my old commit 4799502640e6a29d3 "migration: introduce postcopy-only pending" I see
- uint64_t *non_postcopiable_pending, - uint64_t *postcopiable_pending); + uint64_t *res_precopy_only, + uint64_t *res_compatible, + uint64_t *res_postcopy_only);
so, we just rollback my change, which actually was never necessary. And it was called like I've proposed in 03 discussion thread :) Still, must_precopy and can_postcopy are nicer.
Signature · 2 lines
Best regards, Vladimir
PATCH 2/3 migration: Remove unused res_compatible
In reply to Juan QuintelaNothing assigns to it after previous commit.
--- include/migration/register.h | 7 ++----- migration/savevm.h | 2 -- hw/s390x/s390-stattrib.c | 1 - hw/vfio/migration.c | 3 +-- migration/block-dirty-bitmap.c | 1 - migration/block.c | 1 - migration/migration.c | 18 ++++++++---------- migration/ram.c | 2 -- migration/savevm.c | 8 ++------ hw/vfio/trace-events | 2 +- migration/trace-events | 4 ++-- 11 files changed, 16 insertions(+), 33 deletions(-)
include/migration/register.h +2 -5
@@ -49,22 +49,19 @@ typedef struct SaveVMHandlers {/* Note for save_live_pending: * - res_precopy_only is for data which must be migrated in precopy phase * or in stopped state, in other words - before target vm start -* - res_compatible is for data which may be migrated in any phase * - res_postcopy_only is for data which must be migrated in postcopy phase * or in stopped state, in other words - after source vm stop * -* Sum of res_postcopy_only, res_compatible and res_postcopy_only is the -* whole amount of pending data. +* Sum of res_postcopy_only and res_postcopy_only is the whole +* amount of pending data. */ /* This estimates the remaining data to transfer */ void (*state_pending_estimate)(void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only);/* This calculate the exact remaining data to transfer */ void (*state_pending_exact)(void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only);LoadStateHandler *load_state;int (*load_setup)(QEMUFile *f,void *opaque);
migration/savevm.h +0 -2
@@ -41,10 +41,8 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f);int qemu_savevm_state_complete_precopy (QEMUFile *f,bool iterable_only,bool inactivate_disks);void qemu_savevm_state_pending_exact (uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only);void qemu_savevm_state_pending_estimate (uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only);void qemu_savevm_send_ping (QEMUFile *f,uint32_t value);void qemu_savevm_send_open_return_path (QEMUFile *f);
hw/s390x/s390-stattrib.c +0 -1
@@ -184,7 +184,6 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)static void cmma_state_pending (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {S390StAttribState *sas =S390_STATTRIB (opaque);
hw/vfio/migration.c +1 -2
@@ -458,7 +458,6 @@ static void vfio_save_cleanup(void *opaque)static void vfio_state_pending (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {VFIODevice *vbasedev = opaque;
@@ -473,7 +472,7 @@ static void vfio_state_pending(void *opaque, *res_precopy_only += migration->pending_bytes;trace_vfio_state_pending (vbasedev->name, *res_precopy_only, - *res_postcopy_only, *res_compatible); + *res_postcopy_only); }static int vfio_save_iterate (QEMUFile *f,void *opaque)
migration/block-dirty-bitmap.c +0 -1
@@ -764,7 +764,6 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque)static void dirty_bitmap_state_pending (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {DBMSaveState *s = &((DBMState *)opaque)->save;
migration/block.c +0 -1
@@ -865,7 +865,6 @@ static int block_save_complete(QEMUFile *f, void *opaque)static void block_state_pending (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {/* Estimate pending number of bytes to send */
migration/migration.c +8 -10
@@ -3820,20 +3820,18 @@ typedef enum {*/ static MigIterateState migration_iteration_run (MigrationState *s) { -uint64_t pend_pre, pend_compat, pend_post; +uint64_t pend_pre, pend_post;bool in_postcopy = s->state ==MIGRATION_STATUS_POSTCOPY_ACTIVE ; -qemu_savevm_state_pending_estimate (&pend_pre, &pend_compat, &pend_post); -uint64_t pending_size = pend_pre + pend_compat + pend_post; +qemu_savevm_state_pending_estimate (&pend_pre, &pend_post); +uint64_t pending_size = pend_pre + pend_post; -trace_migrate_pending_estimate (pending_size, - pend_pre, pend_compat, pend_post); +trace_migrate_pending_estimate (pending_size, pend_pre, pend_post); -if (pend_pre + pend_compat <= s->threshold_size) { -qemu_savevm_state_pending_exact (&pend_pre, &pend_compat, &pend_post); - pending_size = pend_pre + pend_compat + pend_post; -trace_migrate_pending_exact (pending_size, - pend_pre, pend_compat, pend_post); +if (pend_pre <= s->threshold_size) { +qemu_savevm_state_pending_exact (&pend_pre, &pend_post); + pending_size = pend_pre + pend_post; +trace_migrate_pending_exact (pending_size, pend_pre, pend_post); }if (!pending_size || pending_size < s->threshold_size) {
migration/ram.c +0 -2
@@ -3437,7 +3437,6 @@ static int ram_save_complete(QEMUFile *f, void *opaque)static void ram_state_pending_estimate (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {RAMState **temp = opaque;
@@ -3455,7 +3454,6 @@ static void ram_state_pending_estimate(void *opaque,static void ram_state_pending_exact (void *opaque,uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {RAMState **temp = opaque;
migration/savevm.c +2 -6
@@ -1542,13 +1542,11 @@ flush:* for units that can't do postcopy. */ void qemu_savevm_state_pending_estimate (uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {SaveStateEntry *se; *res_precopy_only =0 ; - *res_compatible =0 ; *res_postcopy_only =0 ; QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
@@ -1561,19 +1559,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only, } } se->ops->state_pending_exact (se->opaque, - res_precopy_only, res_compatible, + res_precopy_only, res_postcopy_only); } }void qemu_savevm_state_pending_exact (uint64_t *res_precopy_only, -uint64_t *res_compatible,uint64_t *res_postcopy_only) {SaveStateEntry *se; *res_precopy_only =0 ; - *res_compatible =0 ; *res_postcopy_only =0 ; QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
@@ -1586,7 +1582,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only, } } se->ops->state_pending_estimate (se->opaque, - res_precopy_only, res_compatible, + res_precopy_only, res_postcopy_only); } }
hw/vfio/trace-events +1 -1
@@ -157,7 +157,7 @@ vfio_save_cleanup(const char *name) " (%s)" vfio_save_buffer(const char *name, uint64_t data_offset, uint64_t data_size, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pending 0x%"PRIx64 vfio_update_pending(const char *name, uint64_t pending) " (%s) pending 0x%"PRIx64 vfio_save_device_config_state(const char *name) " (%s)" -vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compatible 0x%"PRIx64 +vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64 vfio_save_iterate(const char *name, int data_size) " (%s) data_size %d" vfio_save_complete_precopy(const char *name) " (%s)" vfio_load_device_config_state(const char *name) " (%s)"
migration/trace-events +2 -2
@@ -150,8 +150,8 @@ migrate_fd_cleanup(void) "" migrate_fd_error(const char *error_desc) "error=%s" migrate_fd_cancel(void) "" migrate_handle_rp_req_pages(const char *rbname, size_t start, size_t len) "in %s at 0x%zx len 0x%zx" -migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t compat, uint64_t post) "exact pending size %" PRIu64 " (pre = %" PRIu64 " compat=%" PRIu64 " post=%" PRIu64 ")" -migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t compat, uint64_t post) "estimate pending size %" PRIu64 " (pre = %" PRIu64 " compat=%" PRIu64 " post=%" PRIu64 ")" +migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t post) "exact pending size %" PRIu64 " (pre = %" PRIu64 " post=%" PRIu64 ")" +migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t post) "estimate pending size %" PRIu64 " (pre = %" PRIu64 " post=%" PRIu64 ")" migrate_send_rp_message(int msg_type, uint16_t len) "%d: len %d" migrate_send_rp_recv_bitmap(char *name, int64_t size) "block '%s' size 0x%"PRIi64 migration_completion_file_err(void) ""
Signature · 1 line
2.39.1
Re: [PATCH 2/3] migration: Remove unused res_compatible
migration/migration.c typedef enum { · line 3827
Quoted 9 lines · Juan Quintela
{migration/migration.c +3
-3-uint64_t pend_pre, pend_compat, pend_post; +uint64_t pend_pre, pend_post;bool in_postcopy = s->state ==MIGRATION_STATUS_POSTCOPY_ACTIVE ; -qemu_savevm_state_pending_estimate (&pend_pre, &pend_compat, &pend_post); -uint64_t pending_size = pend_pre + pend_compat + pend_post; +qemu_savevm_state_pending_estimate (&pend_pre, &pend_post); +uint64_t pending_size = pend_pre + pend_post;
Mixed declarations are "gnerally not allowed" by devel/style.rst.. Preexisting, but we may fix it now.
Anyway:
Signature · 2 lines
Best regards, Vladimir
Re: [PATCH 2/3] migration: Remove unused res_compatible
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
migration/migration.c typedef enum { · line 3827
Quoted 9 lines · Juan Quintela
{migration/migration.c +1
-1-uint64_t pend_pre, pend_compat, pend_post; +uint64_t pend_pre, pend_post;bool in_postcopy = s->state ==MIGRATION_STATUS_POSTCOPY_ACTIVE ; - qemu_savevm_state_pending_estimate(&pend_pre, &pend_compat,
&pend_post);migration/migration.c +2
-1-uint64_t pending_size = pend_pre + pend_compat + pend_post; +qemu_savevm_state_pending_estimate (&pend_pre, &pend_post); +uint64_t pending_size = pend_pre + pend_post;
Quoted 1 line
Mixed declarations are "gnerally not allowed" by
devel/style.rst.. Preexisting, but we may fix it now.
They are used left and right.
But you are right. Instead to change my code, I have sent a proposal to change devel/style.rst.
Discuss it there O:-)
Quoted 3 lines
Anyway:
Reviewed-by Vladimir Sementsov-Ogievskiy <[email protected]>
Thanks.
PATCH 3/3 migration: Remove _only suffix for res_postcopy/precopy
In reply to Juan QuintelaOnce that res_compatible is removed, they don't make sense anymore.
--- include/migration/register.h | 18 ++++++++---------- migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 8 files changed, 43 insertions(+), 55 deletions(-)
include/migration/register.h +8 -10
@@ -47,22 +47,20 @@ typedef struct SaveVMHandlers {/* This runs outside the iothread lock! */ int (*save_setup)(QEMUFile *f,void *opaque);/* Note for save_live_pending: -* - res_precopy_only is for data which must be migrated in precopy phase +* - res_precopy is for data which must be migrated in precopy phase * or in stopped state, in other words - before target vm start -* - res_postcopy_only is for data which must be migrated in postcopy phase +* - res_postcopy is for data which must be migrated in postcopy phase * or in stopped state, in other words - after source vm stop * -* Sum of res_postcopy_only and res_postcopy_only is the whole -* amount of pending data. +* Sum of res_postcopy and res_postcopy is the whole amount of +* pending data. */ /* This estimates the remaining data to transfer */ -void (*state_pending_estimate)(void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only); +void (*state_pending_estimate)(void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy);/* This calculate the exact remaining data to transfer */ -void (*state_pending_exact)(void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only); +void (*state_pending_exact)(void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy);LoadStateHandler *load_state;int (*load_setup)(QEMUFile *f,void *opaque);int (*load_cleanup)(void *opaque);
migration/savevm.h +4 -4
@@ -40,10 +40,10 @@ void qemu_savevm_state_cleanup(void);void qemu_savevm_state_complete_postcopy (QEMUFile *f);int qemu_savevm_state_complete_precopy (QEMUFile *f,bool iterable_only,bool inactivate_disks); -void qemu_savevm_state_pending_exact (uint64_t *res_precopy_only, -uint64_t *res_postcopy_only); -void qemu_savevm_state_pending_estimate (uint64_t *res_precopy_only, -uint64_t *res_postcopy_only); +void qemu_savevm_state_pending_exact (uint64_t *res_precopy, +uint64_t *res_postcopy); +void qemu_savevm_state_pending_estimate (uint64_t *res_precopy, +uint64_t *res_postcopy);void qemu_savevm_send_ping (QEMUFile *f,uint32_t value);void qemu_savevm_send_open_return_path (QEMUFile *f);int qemu_savevm_send_packaged (QEMUFile *f,const uint8_t *buf,size_t len);
hw/s390x/s390-stattrib.c +3 -4
@@ -182,16 +182,15 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)return 0 ; } -static void cmma_state_pending (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +static void cmma_state_pending (void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy) {S390StAttribState *sas =S390_STATTRIB (opaque);S390StAttribClass *sac =S390_STATTRIB_GET_CLASS (sas);long long res = sac->get_dirtycount (sas);if (res >=0 ) { - *res_precopy_only += res; + *res_precopy += res; } }
hw/vfio/migration.c +4 -6
@@ -456,9 +456,8 @@ static void vfio_save_cleanup(void *opaque)trace_vfio_save_cleanup (vbasedev->name); } -static void vfio_state_pending (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +static void vfio_state_pending (void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy) {VFIODevice *vbasedev = opaque;VFIOMigration *migration = vbasedev->migration;
@@ -469,10 +468,9 @@ static void vfio_state_pending(void *opaque,return ; } - *res_precopy_only += migration->pending_bytes; + *res_precopy += migration->pending_bytes; -trace_vfio_state_pending (vbasedev->name, *res_precopy_only, - *res_postcopy_only); +trace_vfio_state_pending (vbasedev->name, *res_precopy, *res_postcopy); }static int vfio_save_iterate (QEMUFile *f,void *opaque)
migration/block-dirty-bitmap.c +3 -3
@@ -763,8 +763,8 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque) }static void dirty_bitmap_state_pending (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +uint64_t *res_precopy, +uint64_t *res_postcopy) {DBMSaveState *s = &((DBMState *)opaque)->save;SaveBitmapState *dbms;
@@ -784,7 +784,7 @@ static void dirty_bitmap_state_pending(void *opaque,trace_dirty_bitmap_state_pending (pending); - *res_postcopy_only += pending; + *res_postcopy += pending; }/* First occurrence of this bitmap. It should be created if doesn't exist */
migration/block.c +3 -4
@@ -863,9 +863,8 @@ static int block_save_complete(QEMUFile *f, void *opaque)return 0 ; } -static void block_state_pending (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +static void block_state_pending (void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy) {/* Estimate pending number of bytes to send */ uint64_t pending;
@@ -886,7 +885,7 @@ static void block_state_pending(void *opaque,trace_migration_block_state_pending (pending);/* We don't do postcopy */ - *res_precopy_only += pending; + *res_precopy += pending; }static int block_load (QEMUFile *f,void *opaque,int version_id)
migration/ram.c +8 -10
@@ -3435,9 +3435,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)return 0 ; } -static void ram_state_pending_estimate (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +static void ram_state_pending_estimate (void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy) {RAMState **temp = opaque;RAMState *rs = *temp;
@@ -3446,15 +3445,14 @@ static void ram_state_pending_estimate(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ - *res_postcopy_only += remaining_size; + *res_postcopy += remaining_size; }else { - *res_precopy_only += remaining_size; + *res_precopy += remaining_size; } } -static void ram_state_pending_exact (void *opaque, -uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +static void ram_state_pending_exact (void *opaque,uint64_t *res_precopy, +uint64_t *res_postcopy) {RAMState **temp = opaque;RAMState *rs = *temp;
@@ -3472,9 +3470,9 @@ static void ram_state_pending_exact(void *opaque,if (migrate_postcopy_ram ()) {/* We can do postcopy, and all the data is postcopiable */ - *res_postcopy_only += remaining_size; + *res_postcopy += remaining_size; }else { - *res_precopy_only += remaining_size; + *res_precopy += remaining_size; } }
migration/savevm.c +10 -14
@@ -1541,13 +1541,13 @@ flush:* the result is split into the amount for units that can and * for units that can't do postcopy. */ -void qemu_savevm_state_pending_estimate (uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +void qemu_savevm_state_pending_estimate (uint64_t *res_precopy, +uint64_t *res_postcopy) {SaveStateEntry *se; - *res_precopy_only =0 ; - *res_postcopy_only =0 ; + *res_precopy =0 ; + *res_postcopy =0 ; QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (!se->ops || !se->ops->state_pending_exact) {
@@ -1558,19 +1558,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,continue ; } } - se->ops->state_pending_exact (se->opaque, - res_precopy_only, - res_postcopy_only); + se->ops->state_pending_exact (se->opaque, res_precopy, res_postcopy); } } -void qemu_savevm_state_pending_exact (uint64_t *res_precopy_only, -uint64_t *res_postcopy_only) +void qemu_savevm_state_pending_exact (uint64_t *res_precopy, +uint64_t *res_postcopy) {SaveStateEntry *se; - *res_precopy_only =0 ; - *res_postcopy_only =0 ; + *res_precopy =0 ; + *res_postcopy =0 ; QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {if (!se->ops || !se->ops->state_pending_estimate) {
@@ -1581,9 +1579,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,continue ; } } - se->ops->state_pending_estimate (se->opaque, - res_precopy_only, - res_postcopy_only); + se->ops->state_pending_estimate (se->opaque, res_precopy, res_postcopy); } }
Signature · 1 line
2.39.1
Re: [PATCH 3/3] migration: Remove _only suffix for res_postcopy/precopy
Quoted 19 lines · Juan Quintela
Once that
res_compatibleis removed, they don't make sense anymore.Signed-off-by Juan Quintela <[email protected]>--- include/migration/register.h | 18 ++++++++---------- migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 8 files changed, 43 insertions(+), 55 deletions(-)include/migration/register.h +0
-0
include/migration/register.h typedef struct SaveVMHandlers { · line 53
Quoted 9 lines
include/migration/register.h +2
-2@@ -47,22 +47,20 @@ typedef struct SaveVMHandlers {/* This runs outside the iothread lock! */ int (*save_setup)(QEMUFile *f,void *opaque);/* Note for save_live_pending: -* - res_precopy_only is for data which must be migrated in precopy phase +* - res_precopy is for data which must be migrated in precopy phase * or in stopped state, in other words - before target vm start -* - res_postcopy_only is for data which must be migrated in postcopy phase +* - res_postcopy is for data which must be migrated in postcopy phase * or in stopped state, in other words - after source vm stop
That's now wrong. "postcopy" is everything except "precopy", as it includes "compat". Really, for RAM, it can be copied in precopy too, and it is copied in precopy until user run command migrate-start-postcopy. (In contrast: block-dirty-bitmap cannot migrate in precopy at all, it migrate only in stopped state or in postcopy).
So, finally:
"precopy"
definition:
- must be migrated in precopy or in stopped state
- in other words: must be migrated before target start
- in other words: can't be migrated in postcopy
- in other words: can't be migrated after target start
"postcopy"
definition:
- can migrate in postcopy
- in other words: can migrate after target start
some properties:
- probably can be migrated in precopy (like RAM), or, may be not (like block-dirty-bitmap)
- of course, can be migrated in stopped state
To be absolutely clear, we may rename them to "not_postcopyable" and "postcopyable".
Signature · 2 lines
Best regards, Vladimir
unsubscribe RE: [PATCH 3/3] migration: Remove _only suffix for res_postcopy/precopy
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Vladimir Sementsov-Ogievskiy
Sent: Tuesday, February 14, 2023 9:27 AM
To: Juan Quintela <[email protected]>; [email protected]
Cc: Ilya Leoshkevich <[email protected]>; [email protected]; Alex Williamson <[email protected]>; Fam Zheng <[email protected]>; Eric Blake <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Stefan Hajnoczi <[email protected]>; Halil Pasic <[email protected]>; David Hildenbrand <[email protected]>; Thomas Huth <[email protected]>; Eric Farman <[email protected]>; [email protected]; John Snow <[email protected]>; Christian Borntraeger <[email protected]>; Richard Henderson <[email protected]>
Subject: Re: [PATCH 3/3] migration: Remove _only suffix for res_postcopy/precopy
Quoted 20 lines · Juan Quintela
Once that
res_compatibleis removed, they don't make sense anymore.Signed-off-by Juan Quintela <[email protected]>--- include/migration/register.h | 18 ++++++++---------- migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 8 files changed, 43 insertions(+), 55 deletions(-)(quoted diff) +0
-0
b/include/migration/register.hindexa958a92a0f..4a4a6d7174100644include/migration/register.h +0
-0@@ -47,22 +47,20 @@ typedef struct SaveVMHandlers {/* This runs outside the iothread lock! */
include/migration/register.h typedef struct SaveVMHandlers { · line 55
Quoted 10 lines
include/migration/register.h +4
-2int (*save_setup)(QEMUFile *f,void *opaque);/* Note for save_live_pending: -* - res_precopy_only is for data which must be migrated in precopy phase +* - res_precopy is for data which must be migrated in precopy +phase * or in stopped state, in other words - before target vm start -* - res_postcopy_only is for data which must be migrated in postcopy phase +* - res_postcopy is for data which must be migrated in postcopy +phase * or in stopped state, in other words - after source vm stop
That's now wrong. "postcopy" is everything except "precopy", as it includes "compat". Really, for RAM, it can be copied in precopy too, and it is copied in precopy until user run command migrate-start-postcopy. (In contrast: block-dirty-bitmap cannot migrate in precopy at all, it migrate only in stopped state or in postcopy).
So, finally:
"precopy"
definition:
- must be migrated in precopy or in stopped state
- in other words: must be migrated before target start
- in other words: can't be migrated in postcopy
- in other words: can't be migrated after target start
"postcopy"
definition:
- can migrate in postcopy
- in other words: can migrate after target start
some properties:
- probably can be migrated in precopy (like RAM), or, may be not (like block-dirty-bitmap)
- of course, can be migrated in stopped state
To be absolutely clear, we may rename them to "not_postcopyable" and "postcopyable".
--
Best regards,
Vladimir
This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or intended recipient’s authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.
Re: [PATCH 3/3] migration: Remove _only suffix for res_postcopy/precopy
In reply to Vladimir Sementsov-OgievskiyQuoted 47 lines · Vladimir Sementsov-Ogievskiy
Quoted 18 lines · Juan Quintela
Once that
res_compatibleis removed, they don't make sense anymore.Signed-off-by Juan Quintela <[email protected]>--- include/migration/register.h | 18 ++++++++---------- migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 8 files changed, 43 insertions(+), 55 deletions(-)include/migration/register.h +0
-0include/migration/register.h typedef struct SaveVMHandlers { · line 53
Quoted 9 lines
include/migration/register.h +2
-2@@ -47,22 +47,20 @@ typedef struct SaveVMHandlers {/* This runs outside the iothread lock! */ int (*save_setup)(QEMUFile *f,void *opaque);/* Note for save_live_pending: -* - res_precopy_only is for data which must be migrated in precopy phase +* - res_precopy is for data which must be migrated in precopy phase * or in stopped state, in other words - before target vm start -* - res_postcopy_only is for data which must be migrated in postcopy phase +* - res_postcopy is for data which must be migrated in postcopy phase * or in stopped state, in other words - after source vm stop That's now wrong. "postcopy" is everything except "precopy", as it includes "compat". Really, for RAM, it can be copied in precopy too, and it is copied in precopy until user run command migrate-start-postcopy. (In contrast: block-dirty-bitmap cannot migrate in precopy at all, it migrate only in stopped state or in postcopy).
So, finally:
"precopy"
definition:
- must be migrated in precopy or in stopped state
- in other words: must be migrated before target start
- in other words: can't be migrated in postcopy
- in other words: can't be migrated after target start
Quoted 8 lines
"postcopy"
definition:
- can migrate in postcopy
- in other words: can migrate after target start
some properties:
- probably can be migrated in precopy (like RAM), or, may be not (like block-dirty-bitmap)
- of course, can be migrated in stopped state
What about (with latest naming)
must_precopy:
* must be migrated in precopy or in stopped state
* i.e. must be migrated before target start
can_postcopy:
* 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)
Quoted 1 line
To be absolutely clear, we may rename them to "
not_postcopyable" and "postcopyable".
I hate negatives when naming variables.
What about: must_precopy and can_postcopy?
Later, Juan.
Re: [PATCH 3/3] migration: Remove _only suffix for res_postcopy/precopy
Quoted 63 lines · Juan Quintela
Quoted 47 lines · Vladimir Sementsov-Ogievskiy
Quoted 18 lines · Juan Quintela
Once that
res_compatibleis removed, they don't make sense anymore.Signed-off-by Juan Quintela <[email protected]>--- include/migration/register.h | 18 ++++++++---------- migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 8 files changed, 43 insertions(+), 55 deletions(-)include/migration/register.h +0
-0include/migration/register.h typedef struct SaveVMHandlers { · line 53
Quoted 9 lines
include/migration/register.h +2
-2@@ -47,22 +47,20 @@ typedef struct SaveVMHandlers {/* This runs outside the iothread lock! */ int (*save_setup)(QEMUFile *f,void *opaque);/* Note for save_live_pending: -* - res_precopy_only is for data which must be migrated in precopy phase +* - res_precopy is for data which must be migrated in precopy phase * or in stopped state, in other words - before target vm start -* - res_postcopy_only is for data which must be migrated in postcopy phase +* - res_postcopy is for data which must be migrated in postcopy phase * or in stopped state, in other words - after source vm stop That's now wrong. "postcopy" is everything except "precopy", as it includes "compat". Really, for RAM, it can be copied in precopy too, and it is copied in precopy until user run command migrate-start-postcopy. (In contrast: block-dirty-bitmap cannot migrate in precopy at all, it migrate only in stopped state or in postcopy).
So, finally:
"precopy"
definition:
- must be migrated in precopy or in stopped state
- in other words: must be migrated before target start
- in other words: can't be migrated in postcopy
- in other words: can't be migrated after target startQuoted 8 lines
"postcopy"
definition:
- can migrate in postcopy
- in other words: can migrate after target start
some properties:
- probably can be migrated in precopy (like RAM), or, may be not (like block-dirty-bitmap)
- of course, can be migrated in stopped stateWhat about (with latest naming)
must_precopy:
* must be migrated in precopy or in stopped state
* i.e. must be migrated before target start
Quoted 5 lines
can_postcopy:
* 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)
Sounds very good, I'm for!
Quoted 4 lines
Quoted 2 lines
To be absolutely clear, we may rename them to "
not_postcopyable" and "postcopyable".I hate negatives when naming variables.
Agree.
Quoted 3 lines
What about:
must_precopyandcan_postcopy?
Sounds good!)
Signature · 2 lines
Best regards, Vladimir