Now after merging the precopy and postcopy version of complete() hook,
rename the precopy version from save_live_complete_precopy() to
save_complete().
Dropping the "live" when at it, because it's in most cases not live when
happening (in precopy).
No functional change intended.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/migration/register.h | 4 ++--
hw/ppc/spapr.c | 2 +-
hw/s390x/s390-stattrib.c | 2 +-
hw/vfio/migration.c | 2 +-
migration/block-dirty-bitmap.c | 2 +-
migration/ram.c | 2 +-
migration/savevm.c | 8 ++++----
7 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/migration/register.h b/include/migration/register.h
index e022195785..0510534515 100644
--- a/include/migration/register.h
+++ b/include/migration/register.h
@@ -78,7 +78,7 @@ typedef struct SaveVMHandlers {
void (*save_cleanup)(void *opaque);
/**
- * @save_live_complete_precopy
+ * @save_complete
*
* Transmits the last section for the device containing any
* remaining data at the end phase of migration.
@@ -95,7 +95,7 @@ typedef struct SaveVMHandlers {
*
* Returns zero to indicate success and negative for error
*/
- int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
+ int (*save_complete)(QEMUFile *f, void *opaque);
/**
* @save_live_complete_precopy_thread (invoked in a separate thread)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 702f774cda..c5d30f2ebd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2518,7 +2518,7 @@ static void htab_save_cleanup(void *opaque)
static SaveVMHandlers savevm_htab_handlers = {
.save_setup = htab_save_setup,
.save_live_iterate = htab_save_iterate,
- .save_live_complete_precopy = htab_save_complete,
+ .save_complete = htab_save_complete,
.save_cleanup = htab_save_cleanup,
.load_state = htab_load,
};
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index f74cf32636..13a678a803 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -338,7 +338,7 @@ static const TypeInfo qemu_s390_stattrib_info = {
static SaveVMHandlers savevm_s390_stattrib_handlers = {
.save_setup = cmma_save_setup,
.save_live_iterate = cmma_save_iterate,
- .save_live_complete_precopy = cmma_save_complete,
+ .save_complete = cmma_save_complete,
.state_pending_exact = cmma_state_pending,
.state_pending_estimate = cmma_state_pending,
.save_cleanup = cmma_save_cleanup,
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index b76697bd1a..33a71f8999 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -824,7 +824,7 @@ static const SaveVMHandlers savevm_vfio_handlers = {
.state_pending_exact = vfio_state_pending_exact,
.is_active_iterate = vfio_is_active_iterate,
.save_live_iterate = vfio_save_iterate,
- .save_live_complete_precopy = vfio_save_complete_precopy,
+ .save_complete = vfio_save_complete_precopy,
.save_state = vfio_save_state,
.load_setup = vfio_load_setup,
.load_cleanup = vfio_load_cleanup,
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 6ee3c32a76..a061aad817 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -1248,7 +1248,7 @@ static bool dirty_bitmap_has_postcopy(void *opaque)
static SaveVMHandlers savevm_dirty_bitmap_handlers = {
.save_setup = dirty_bitmap_save_setup,
- .save_live_complete_precopy = dirty_bitmap_save_complete,
+ .save_complete = dirty_bitmap_save_complete,
.has_postcopy = dirty_bitmap_has_postcopy,
.state_pending_exact = dirty_bitmap_state_pending,
.state_pending_estimate = dirty_bitmap_state_pending,
diff --git a/migration/ram.c b/migration/ram.c
index 8b43b9e1e8..ed380ac86f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4545,7 +4545,7 @@ void postcopy_preempt_shutdown_file(MigrationState *s)
static SaveVMHandlers savevm_ram_handlers = {
.save_setup = ram_save_setup,
.save_live_iterate = ram_save_iterate,
- .save_live_complete_precopy = ram_save_complete,
+ .save_complete = ram_save_complete,
.has_postcopy = ram_has_postcopy,
.state_pending_exact = ram_state_pending_exact,
.state_pending_estimate = ram_state_pending_estimate,
diff --git a/migration/savevm.c b/migration/savevm.c
index 3e20f8608a..454e914b56 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1496,7 +1496,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
int ret;
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
- if (!se->ops || !se->ops->save_live_complete_precopy) {
+ if (!se->ops || !se->ops->save_complete) {
continue;
}
if (se->ops->is_active) {
@@ -1509,7 +1509,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
qemu_put_byte(f, QEMU_VM_SECTION_END);
qemu_put_be32(f, se->section_id);
- ret = se->ops->save_live_complete_precopy(f, se->opaque);
+ ret = se->ops->save_complete(f, se->opaque);
trace_savevm_section_end(se->idstr, se->section_id, ret);
save_section_footer(f, se);
if (ret < 0) {
@@ -1583,7 +1583,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
if (!se->ops ||
(in_postcopy && se->ops->has_postcopy &&
se->ops->has_postcopy(se->opaque)) ||
- !se->ops->save_live_complete_precopy) {
+ !se->ops->save_complete) {
continue;
}
@@ -1598,7 +1598,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
save_section_header(f, se, QEMU_VM_SECTION_END);
- ret = se->ops->save_live_complete_precopy(f, se->opaque);
+ ret = se->ops->save_complete(f, se->opaque);
trace_savevm_section_end(se->idstr, se->section_id, ret);
save_section_footer(f, se);
if (ret < 0) {
--
2.49.0
Hi Peter,
On 2025-06-13 10:07, Peter Xu wrote:
> Now after merging the precopy and postcopy version of complete() hook,
> rename the precopy version from save_live_complete_precopy() to
> save_complete().
>
> Dropping the "live" when at it, because it's in most cases not live when
> happening (in precopy).
>
> No functional change intended.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> include/migration/register.h | 4 ++--
> hw/ppc/spapr.c | 2 +-
> hw/s390x/s390-stattrib.c | 2 +-
> hw/vfio/migration.c | 2 +-
> migration/block-dirty-bitmap.c | 2 +-
> migration/ram.c | 2 +-
> migration/savevm.c | 8 ++++----
> 7 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/include/migration/register.h b/include/migration/register.h
> index e022195785..0510534515 100644
> --- a/include/migration/register.h
> +++ b/include/migration/register.h
> @@ -78,7 +78,7 @@ typedef struct SaveVMHandlers {
> void (*save_cleanup)(void *opaque);
>
> /**
> - * @save_live_complete_precopy
> + * @save_complete
> *
> * Transmits the last section for the device containing any
> * remaining data at the end phase of migration.
> @@ -95,7 +95,7 @@ typedef struct SaveVMHandlers {
> *
> * Returns zero to indicate success and negative for error
> */
> - int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
> + int (*save_complete)(QEMUFile *f, void *opaque);
>
> /**
> * @save_live_complete_precopy_thread (invoked in a separate thread)
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 702f774cda..c5d30f2ebd 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2518,7 +2518,7 @@ static void htab_save_cleanup(void *opaque)
> static SaveVMHandlers savevm_htab_handlers = {
> .save_setup = htab_save_setup,
> .save_live_iterate = htab_save_iterate,
> - .save_live_complete_precopy = htab_save_complete,
> + .save_complete = htab_save_complete,
> .save_cleanup = htab_save_cleanup,
> .load_state = htab_load,
> };
> diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index f74cf32636..13a678a803 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -338,7 +338,7 @@ static const TypeInfo qemu_s390_stattrib_info = {
> static SaveVMHandlers savevm_s390_stattrib_handlers = {
> .save_setup = cmma_save_setup,
> .save_live_iterate = cmma_save_iterate,
> - .save_live_complete_precopy = cmma_save_complete,
> + .save_complete = cmma_save_complete,
> .state_pending_exact = cmma_state_pending,
> .state_pending_estimate = cmma_state_pending,
> .save_cleanup = cmma_save_cleanup,
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index b76697bd1a..33a71f8999 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -824,7 +824,7 @@ static const SaveVMHandlers savevm_vfio_handlers = {
> .state_pending_exact = vfio_state_pending_exact,
> .is_active_iterate = vfio_is_active_iterate,
> .save_live_iterate = vfio_save_iterate,
> - .save_live_complete_precopy = vfio_save_complete_precopy,
> + .save_complete = vfio_save_complete_precopy,
> .save_state = vfio_save_state,
> .load_setup = vfio_load_setup,
> .load_cleanup = vfio_load_cleanup,
> diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
> index 6ee3c32a76..a061aad817 100644
> --- a/migration/block-dirty-bitmap.c
> +++ b/migration/block-dirty-bitmap.c
> @@ -1248,7 +1248,7 @@ static bool dirty_bitmap_has_postcopy(void *opaque)
>
> static SaveVMHandlers savevm_dirty_bitmap_handlers = {
> .save_setup = dirty_bitmap_save_setup,
> - .save_live_complete_precopy = dirty_bitmap_save_complete,
> + .save_complete = dirty_bitmap_save_complete,
> .has_postcopy = dirty_bitmap_has_postcopy,
> .state_pending_exact = dirty_bitmap_state_pending,
> .state_pending_estimate = dirty_bitmap_state_pending,
> diff --git a/migration/ram.c b/migration/ram.c
> index 8b43b9e1e8..ed380ac86f 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -4545,7 +4545,7 @@ void postcopy_preempt_shutdown_file(MigrationState *s)
> static SaveVMHandlers savevm_ram_handlers = {
> .save_setup = ram_save_setup,
> .save_live_iterate = ram_save_iterate,
> - .save_live_complete_precopy = ram_save_complete,
> + .save_complete = ram_save_complete,
> .has_postcopy = ram_has_postcopy,
> .state_pending_exact = ram_state_pending_exact,
> .state_pending_estimate = ram_state_pending_estimate,
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 3e20f8608a..454e914b56 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1496,7 +1496,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
> int ret;
>
> QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
> - if (!se->ops || !se->ops->save_live_complete_precopy) {
> + if (!se->ops || !se->ops->save_complete) {
> continue;
> }
> if (se->ops->is_active) {
> @@ -1509,7 +1509,7 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f)
> qemu_put_byte(f, QEMU_VM_SECTION_END);
> qemu_put_be32(f, se->section_id);
>
> - ret = se->ops->save_live_complete_precopy(f, se->opaque);
> + ret = se->ops->save_complete(f, se->opaque);
> trace_savevm_section_end(se->idstr, se->section_id, ret);
> save_section_footer(f, se);
> if (ret < 0) {
> @@ -1583,7 +1583,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
> if (!se->ops ||
> (in_postcopy && se->ops->has_postcopy &&
> se->ops->has_postcopy(se->opaque)) ||
> - !se->ops->save_live_complete_precopy) {
> + !se->ops->save_complete) {
> continue;
> }
>
> @@ -1598,7 +1598,7 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)
>
> save_section_header(f, se, QEMU_VM_SECTION_END);
>
> - ret = se->ops->save_live_complete_precopy(f, se->opaque);
> + ret = se->ops->save_complete(f, se->opaque);
> trace_savevm_section_end(se->idstr, se->section_id, ret);
> save_section_footer(f, se);
> if (ret < 0) {
> --
> 2.49.0
>
There are still mentions of 'save_live_complete_precopy' in:
include/migration/register.h:100
* parallel with @save_live_complete_precopy handlers.
docs/devel/migration/vfio.rst:78
* A ``save_live_complete_precopy`` function that sets the VFIO device in
docs/devel/migration/vfio.rst:198
.save_live_complete_precopy() is called for each active device
docs/devel/migration/vfio.rst:200
.save_live_complete_precopy() until
docs/devel/migration/main.rst:511
- A ``save_live_complete_precopy`` function that must transmit the
Also, should we also drop "live" from
'save_live_complete_precopy_thread' as well? IIUC they are called
together with (now) 'save_complete()' during precopy.
Best regards
Juraj Marcin
On Tue, Jun 24, 2025 at 04:36:39PM +0200, Juraj Marcin wrote:
[...]
> There are still mentions of 'save_live_complete_precopy' in:
>
> include/migration/register.h:100
> * parallel with @save_live_complete_precopy handlers.
> docs/devel/migration/vfio.rst:78
> * A ``save_live_complete_precopy`` function that sets the VFIO device in
> docs/devel/migration/vfio.rst:198
> .save_live_complete_precopy() is called for each active device
> docs/devel/migration/vfio.rst:200
> .save_live_complete_precopy() until
> docs/devel/migration/main.rst:511
> - A ``save_live_complete_precopy`` function that must transmit the
Good catch. If I prepare this fixup to be squashed, can I get your R-b?
From 58147b11276fa193c25f35e63f41a8e34d444dd9 Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Tue, 24 Jun 2025 11:38:17 -0400
Subject: [PATCH] fixup! migration: Rename save_live_complete_precopy to
save_complete
Signed-off-by: Peter Xu <peterx@redhat.com>
---
docs/devel/migration/main.rst | 4 ++--
docs/devel/migration/vfio.rst | 12 ++++++------
include/migration/register.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst
index cdd4f4a6d7..6493c1d2bc 100644
--- a/docs/devel/migration/main.rst
+++ b/docs/devel/migration/main.rst
@@ -508,8 +508,8 @@ An iterative device must provide:
the point that stream bandwidth limits tell it to stop. Each call
generates one section.
- - A ``save_live_complete_precopy`` function that must transmit the
- last section for the device containing any remaining data.
+ - A ``save_complete`` function that must transmit the last section for
+ the device containing any remaining data.
- A ``load_state`` function used to load sections generated by
any of the save functions that generate sections.
diff --git a/docs/devel/migration/vfio.rst b/docs/devel/migration/vfio.rst
index 673e354754..8ff5ab0c74 100644
--- a/docs/devel/migration/vfio.rst
+++ b/docs/devel/migration/vfio.rst
@@ -75,10 +75,10 @@ VFIO implements the device hooks for the iterative approach as follows:
in the non-multifd mode.
In the multifd mode it just emits either a dummy EOS marker.
-* A ``save_live_complete_precopy`` function that sets the VFIO device in
- _STOP_COPY state and iteratively copies the data for the VFIO device until
- the vendor driver indicates that no data remains.
- In the multifd mode it just emits a dummy EOS marker.
+* A ``save_complete`` function that sets the VFIO device in _STOP_COPY
+ state and iteratively copies the data for the VFIO device until the
+ vendor driver indicates that no data remains. In the multifd mode it
+ just emits a dummy EOS marker.
* A ``save_live_complete_precopy_thread`` function that in the multifd mode
provides thread handler performing multifd device state transfer.
@@ -195,9 +195,9 @@ Live migration save path
|
Then the VFIO device is put in _STOP_COPY state
(FINISH_MIGRATE, _ACTIVE, _STOP_COPY)
- .save_live_complete_precopy() is called for each active device
+ .save_complete() is called for each active device
For the VFIO device: in the non-multifd mode iterate in
- .save_live_complete_precopy() until
+ .save_complete() until
pending data is 0
In the multifd mode this iteration is done in
.save_live_complete_precopy_thread() instead.
diff --git a/include/migration/register.h b/include/migration/register.h
index 0510534515..2a26e76a68 100644
--- a/include/migration/register.h
+++ b/include/migration/register.h
@@ -103,7 +103,7 @@ typedef struct SaveVMHandlers {
* Called at the end of a precopy phase from a separate worker thread
* in configurations where multifd device state transfer is supported
* in order to perform asynchronous transmission of the remaining data in
- * parallel with @save_live_complete_precopy handlers.
+ * parallel with @save_complete handlers.
* When postcopy is enabled, devices that support postcopy will skip this
* step.
*
--
2.49.0
>
> Also, should we also drop "live" from
> 'save_live_complete_precopy_thread' as well? IIUC they are called
> together with (now) 'save_complete()' during precopy.
Agreed, though it's better done in a separate one.
If so, wanna send a patch? :)
PS: would be nice if on top of this series, then I can collect them together.
Thanks!
--
Peter Xu
On 2025-06-24 11:41, Peter Xu wrote:
> On Tue, Jun 24, 2025 at 04:36:39PM +0200, Juraj Marcin wrote:
>
> [...]
>
> > There are still mentions of 'save_live_complete_precopy' in:
> >
> > include/migration/register.h:100
> > * parallel with @save_live_complete_precopy handlers.
> > docs/devel/migration/vfio.rst:78
> > * A ``save_live_complete_precopy`` function that sets the VFIO device in
> > docs/devel/migration/vfio.rst:198
> > .save_live_complete_precopy() is called for each active device
> > docs/devel/migration/vfio.rst:200
> > .save_live_complete_precopy() until
> > docs/devel/migration/main.rst:511
> > - A ``save_live_complete_precopy`` function that must transmit the
>
> Good catch. If I prepare this fixup to be squashed, can I get your R-b?
Yes, with the fixup it looks good.
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
>
> From 58147b11276fa193c25f35e63f41a8e34d444dd9 Mon Sep 17 00:00:00 2001
> From: Peter Xu <peterx@redhat.com>
> Date: Tue, 24 Jun 2025 11:38:17 -0400
> Subject: [PATCH] fixup! migration: Rename save_live_complete_precopy to
> save_complete
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> docs/devel/migration/main.rst | 4 ++--
> docs/devel/migration/vfio.rst | 12 ++++++------
> include/migration/register.h | 2 +-
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst
> index cdd4f4a6d7..6493c1d2bc 100644
> --- a/docs/devel/migration/main.rst
> +++ b/docs/devel/migration/main.rst
> @@ -508,8 +508,8 @@ An iterative device must provide:
> the point that stream bandwidth limits tell it to stop. Each call
> generates one section.
>
> - - A ``save_live_complete_precopy`` function that must transmit the
> - last section for the device containing any remaining data.
> + - A ``save_complete`` function that must transmit the last section for
> + the device containing any remaining data.
>
> - A ``load_state`` function used to load sections generated by
> any of the save functions that generate sections.
> diff --git a/docs/devel/migration/vfio.rst b/docs/devel/migration/vfio.rst
> index 673e354754..8ff5ab0c74 100644
> --- a/docs/devel/migration/vfio.rst
> +++ b/docs/devel/migration/vfio.rst
> @@ -75,10 +75,10 @@ VFIO implements the device hooks for the iterative approach as follows:
> in the non-multifd mode.
> In the multifd mode it just emits either a dummy EOS marker.
>
> -* A ``save_live_complete_precopy`` function that sets the VFIO device in
> - _STOP_COPY state and iteratively copies the data for the VFIO device until
> - the vendor driver indicates that no data remains.
> - In the multifd mode it just emits a dummy EOS marker.
> +* A ``save_complete`` function that sets the VFIO device in _STOP_COPY
> + state and iteratively copies the data for the VFIO device until the
> + vendor driver indicates that no data remains. In the multifd mode it
> + just emits a dummy EOS marker.
>
> * A ``save_live_complete_precopy_thread`` function that in the multifd mode
> provides thread handler performing multifd device state transfer.
> @@ -195,9 +195,9 @@ Live migration save path
> |
> Then the VFIO device is put in _STOP_COPY state
> (FINISH_MIGRATE, _ACTIVE, _STOP_COPY)
> - .save_live_complete_precopy() is called for each active device
> + .save_complete() is called for each active device
> For the VFIO device: in the non-multifd mode iterate in
> - .save_live_complete_precopy() until
> + .save_complete() until
> pending data is 0
> In the multifd mode this iteration is done in
> .save_live_complete_precopy_thread() instead.
> diff --git a/include/migration/register.h b/include/migration/register.h
> index 0510534515..2a26e76a68 100644
> --- a/include/migration/register.h
> +++ b/include/migration/register.h
> @@ -103,7 +103,7 @@ typedef struct SaveVMHandlers {
> * Called at the end of a precopy phase from a separate worker thread
> * in configurations where multifd device state transfer is supported
> * in order to perform asynchronous transmission of the remaining data in
> - * parallel with @save_live_complete_precopy handlers.
> + * parallel with @save_complete handlers.
> * When postcopy is enabled, devices that support postcopy will skip this
> * step.
> *
> --
> 2.49.0
>
>
> >
> > Also, should we also drop "live" from
> > 'save_live_complete_precopy_thread' as well? IIUC they are called
> > together with (now) 'save_complete()' during precopy.
>
> Agreed, though it's better done in a separate one.
>
> If so, wanna send a patch? :)
Sure, I will send it today.
>
> PS: would be nice if on top of this series, then I can collect them together.
>
> Thanks!
>
> --
> Peter Xu
>
On Wed, Jun 25, 2025 at 01:13:48PM +0200, Juraj Marcin wrote: > Sure, I will send it today. Thanks. In case it helps, can fetch head here: https://gitlab.com/peterx/qemu/-/tree/migration-staging -- Peter Xu
© 2016 - 2025 Red Hat, Inc.