mirror of
				https://gitlab.com/qemu-project/qemu.git
				synced 2025-10-30 07:57:14 +08:00 
			
		
		
		
	migration: Rename save_live_complete_precopy_thread to save_complete_precopy_thread
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/20250613140801.474264-7-peterx@redhat.com/ Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Cédric Le Goater <clg@redhat.com> Signed-off-by: Juraj Marcin <jmarcin@redhat.com> Link: https://lore.kernel.org/r/20250626085235.294690-1-jmarcin@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
		 Juraj Marcin
					Juraj Marcin
				
			
				
					committed by
					
						 Fabiano Rosas
						Fabiano Rosas
					
				
			
			
				
	
			
			
			 Fabiano Rosas
						Fabiano Rosas
					
				
			
						parent
						
							3345fb3b6d
						
					
				
				
					commit
					beeac2df5f
				
			| @ -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 | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
| @ -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, | ||||
| }; | ||||
|  | ||||
| /* ---------------------------------------------------------------------- */ | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
|  | ||||
| @ -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.  */ | ||||
|  | ||||
|  | ||||
| @ -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 */ | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user