migration: Rename save_live_complete_precopy_thread to save_complete_precopy_thread
PATCH 1/1 migration: Rename save_live_complete_precopy_thread to save_complete_precopy_thread
From: Juraj Marcin <[email protected]>
Recent patch [1] renames the save_live_complete_precopy handler to save_complete, as the machine is not live in most cases when this handler is executed. The same is true also for save_live_complete_precopy_thread, therefore this patch removes the "live" keyword from the handler itself and related types to keep the naming unified.
In contrast to save_complete, this handler is only executed at the end of precopy, therefore the "precopy" keyword is retained.
[1]: https://lore.kernel.org/all/[email protected]/
---
This patch is based on the following series:
https://lore.kernel.org/all/[email protected]/
--- docs/devel/migration/vfio.rst | 4 ++-- hw/vfio/migration-multifd.c | 4 ++-- hw/vfio/migration-multifd.h | 2 +- hw/vfio/migration.c | 2 +- include/migration/misc.h | 8 ++++---- include/migration/register.h | 6 +++--- include/qemu/typedefs.h | 6 +++--- migration/multifd-device-state.c | 10 +++++----- migration/savevm.c | 6 +++--- 9 files changed, 24 insertions(+), 24 deletions(-)
docs/devel/migration/vfio.rst +2 -2
@@ -80,7 +80,7 @@ VFIO implements the device hooks for the iterative approach as follows: 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 +* A ``save_complete_precopy_thread`` function that in the multifd mode provides thread handler performing multifd device state transfer. It sets the VFIO device to _STOP_COPY state, iteratively reads the data from the VFIO device and queues it for multifd transmission until the vendor
@@ -200,7 +200,7 @@ Live migration save path .save_complete() until pending data is 0 In the multifd mode this iteration is done in - .save_live_complete_precopy_thread() instead. + .save_complete_precopy_thread() instead. | (POSTMIGRATE, _COMPLETED, _STOP_COPY) Migraton thread schedules cleanup bottom half and exits
hw/vfio/migration-multifd.c +2 -2
@@ -583,7 +583,7 @@ vfio_save_complete_precopy_thread_config_state(VFIODevice *vbasedev,/* * This thread is spawned by the migration core directly via -* .save_live_complete_precopy_thread SaveVMHandler. +* .save_complete_precopy_thread SaveVMHandler. * * It exits after either: * * completing saving the remaining device state and device config, OR:
@@ -592,7 +592,7 @@ vfio_save_complete_precopy_thread_config_state(VFIODevice *vbasedev,* multifd_device_state_save_thread_should_exit() returning true. */ bool -vfio_multifd_save_complete_precopy_thread (SaveLiveCompletePrecopyThreadData *d, +vfio_multifd_save_complete_precopy_thread (SaveCompletePrecopyThreadData *d,Error **errp) {VFIODevice *vbasedev = d->handler_opaque;
hw/vfio/migration-multifd.h +1 -1
@@ -26,7 +26,7 @@ bool vfio_multifd_load_state_buffer(void *opaque, char *data, size_t data_size,void vfio_multifd_emit_dummy_eos (VFIODevice *vbasedev,QEMUFile *f);bool -vfio_multifd_save_complete_precopy_thread (SaveLiveCompletePrecopyThreadData *d, +vfio_multifd_save_complete_precopy_thread (SaveCompletePrecopyThreadData *d,Error **errp);int vfio_multifd_switchover_start (VFIODevice *vbasedev);
hw/vfio/migration.c +1 -1
@@ -835,7 +835,7 @@ static const SaveVMHandlers savevm_vfio_handlers = {*/ .load_state_buffer = vfio_multifd_load_state_buffer, .switchover_start = vfio_switchover_start, - .save_live_complete_precopy_thread = vfio_multifd_save_complete_precopy_thread, + .save_complete_precopy_thread = vfio_multifd_save_complete_precopy_thread, };/* ---------------------------------------------------------------------- */
include/migration/misc.h +4 -4
@@ -119,19 +119,19 @@ bool migrate_uri_parse(const char *uri, MigrationChannel **channel, Error **errp);/* migration/multifd-device-state.c */ -typedef struct SaveLiveCompletePrecopyThreadData { -SaveLiveCompletePrecopyThreadHandler hdlr; +typedef struct SaveCompletePrecopyThreadData { +SaveCompletePrecopyThreadHandler hdlr;char *idstr;uint32_t instance_id;void *handler_opaque; -}SaveLiveCompletePrecopyThreadData ; +}SaveCompletePrecopyThreadData ;bool multifd_queue_device_state (char *idstr,uint32_t instance_id,char *data,size_t len);bool multifd_device_state_supported (void );void -multifd_spawn_device_state_save_thread (SaveLiveCompletePrecopyThreadHandler hdlr, +multifd_spawn_device_state_save_thread (SaveCompletePrecopyThreadHandler hdlr,char *idstr,uint32_t instance_id,void *opaque);
include/migration/register.h +3 -3
@@ -98,7 +98,7 @@ typedef struct SaveVMHandlers {int (*save_complete)(QEMUFile *f,void *opaque);/** -* @save_live_complete_precopy_thread (invoked in a separate thread) +* @save_complete_precopy_thread (invoked in a separate thread) * * Called at the end of a precopy phase from a separate worker thread * in configurations where multifd device state transfer is supported
@@ -107,14 +107,14 @@ typedef struct SaveVMHandlers {* When postcopy is enabled, devices that support postcopy will skip this * step. * -* @d: a #SaveLiveCompletePrecopyThreadData containing parameters that the +* @d: a #SaveCompletePrecopyThreadData containing parameters that the * handler may need, including this device section idstr and instance_id, * and opaque data pointer passed to register_savevm_live(). * @errp: pointer to Error*, to store an error if it happens. * * Returns true to indicate success and false for errors. */ -SaveLiveCompletePrecopyThreadHandler save_live_complete_precopy_thread; +SaveCompletePrecopyThreadHandler save_complete_precopy_thread;/* This runs both outside and inside the BQL. */
include/qemu/typedefs.h +3 -3
@@ -109,7 +109,7 @@ typedef struct QString QString;typedef struct RAMBlock RAMBlock ;typedef struct Range Range ;typedef struct ReservedRegion ReservedRegion ; -typedef struct SaveLiveCompletePrecopyThreadData SaveLiveCompletePrecopyThreadData ; +typedef struct SaveCompletePrecopyThreadData SaveCompletePrecopyThreadData ;typedef struct SHPCDevice SHPCDevice ;typedef struct SSIBus SSIBus ;typedef struct TCGCPUOps TCGCPUOps ;
@@ -135,7 +135,7 @@ typedef struct IRQState *qemu_irq;typedef void (*qemu_irq_handler )(void *opaque,int n,int level);typedef bool (*MigrationLoadThread )(void *opaque,bool *should_quit,Error **errp); -typedef bool (*SaveLiveCompletePrecopyThreadHandler )(SaveLiveCompletePrecopyThreadData *d, -Error **errp); +typedef bool (*SaveCompletePrecopyThreadHandler )(SaveCompletePrecopyThreadData *d, +Error **errp);#endif /* QEMU_TYPEDEFS_H */
migration/multifd-device-state.c +5 -5
@@ -131,7 +131,7 @@ bool multifd_device_state_supported(void)static void multifd_device_state_save_thread_data_free (void *opaque) { -SaveLiveCompletePrecopyThreadData *data = opaque; +SaveCompletePrecopyThreadData *data = opaque;g_clear_pointer (&data->idstr, g_free);g_free (data);
@@ -139,7 +139,7 @@ static void multifd_device_state_save_thread_data_free(void *opaque)static int multifd_device_state_save_thread (void *opaque) { -SaveLiveCompletePrecopyThreadData *data = opaque; +SaveCompletePrecopyThreadData *data = opaque;g_autoptr (Error) local_err =NULL ;if (!data->hdlr (data, &local_err)) {
@@ -170,18 +170,18 @@ bool multifd_device_state_save_thread_should_exit(void) }void -multifd_spawn_device_state_save_thread (SaveLiveCompletePrecopyThreadHandler hdlr, +multifd_spawn_device_state_save_thread (SaveCompletePrecopyThreadHandler hdlr,char *idstr,uint32_t instance_id,void *opaque) { -SaveLiveCompletePrecopyThreadData *data; +SaveCompletePrecopyThreadData *data;assert (multifd_device_state_supported ());assert (multifd_send_device_state);assert (!qatomic_read (&multifd_send_device_state->threads_abort)); - data =g_new (SaveLiveCompletePrecopyThreadData,1 ); + data =g_new (SaveCompletePrecopyThreadData,1 ); data->hdlr = hdlr; data->idstr =g_strdup (idstr); data->instance_id = instance_id;
migration/savevm.c +3 -3
@@ -1581,15 +1581,15 @@ int qemu_savevm_state_complete_precopy_iterable(QEMUFile *f, bool in_postcopy)if (multifd_device_state) { QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { -SaveLiveCompletePrecopyThreadHandler hdlr; +SaveCompletePrecopyThreadHandler hdlr;if (!se->ops || (in_postcopy && se->ops->has_postcopy && se->ops->has_postcopy (se->opaque)) || - !se->ops->save_live_complete_precopy_thread) { + !se->ops->save_complete_precopy_thread) {continue ; } - hdlr = se->ops->save_live_complete_precopy_thread; + hdlr = se->ops->save_complete_precopy_thread;multifd_spawn_device_state_save_thread (hdlr, se->idstr, se->instance_id, se->opaque);
Signature · 1 line
2.49.0
Peter Xu
AppliedQuoted 12 lines · Juraj Marcin
From: Juraj Marcin <[email protected]>
Recent patch [1] renames the
save_live_complete_precopyhandler tosave_complete, as the machine is not live in most cases when this handler is executed. The same is true also forsave_live_complete_precopy_thread, therefore this patch removes the "live" keyword from the handler itself and related types to keep the naming unified.In contrast to
save_complete, this handler is only executed at the end of precopy, therefore the "precopy" keyword is retained.
Quoted 6 lines
[1]: https://lore.kernel.org/all/[email protected]/
Signed-off-by Juraj Marcin <[email protected]>---
This patch is based on the following series:
https://lore.kernel.org/all/[email protected]/
queued, thanks.
Signature · 1 line
Peter Xu