mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
migration: Replace switchover_ack_needed SaveVMHandler
A new switchover-ack mechanism that will replace the existing one will be added in the following patches. The new mechanism will not use switchover_ack_needed SaveVMHandler, however, the old mechanism must still be kept for backward compatibility. To keep things clear and decrease API surface of old code, replace switchover_ack_needed SaveVMHandler with a regular function migration_request_switchover_ack(). No functional changes intended. Acked-by: Peter Xu <peterx@redhat.com> Signed-off-by: Avihai Horon <avihaih@nvidia.com> Link: https://lore.kernel.org/qemu-devel/20260706085211.13905-6-avihaih@nvidia.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
committed by
Cédric Le Goater
parent
92d7a11085
commit
f267196712
@@ -2202,6 +2202,21 @@ void migration_rp_kick(MigrationState *s)
|
||||
qemu_sem_post(&s->rp_state.rp_sem);
|
||||
}
|
||||
|
||||
/* This is called only on destination side */
|
||||
void migration_request_switchover_ack(const char *requester)
|
||||
{
|
||||
MigrationIncomingState *mis = migration_incoming_get_current();
|
||||
|
||||
if (!migrate_switchover_ack()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mis->switchover_ack_pending_num++;
|
||||
|
||||
trace_migration_request_switchover_ack(requester,
|
||||
mis->switchover_ack_pending_num);
|
||||
}
|
||||
|
||||
static struct rp_cmd_args {
|
||||
ssize_t len; /* -1 = variable */
|
||||
const char *name;
|
||||
|
||||
@@ -2800,23 +2800,6 @@ static int qemu_loadvm_state_header(QEMUFile *f, Error **errp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void qemu_loadvm_state_switchover_ack_needed(MigrationIncomingState *mis)
|
||||
{
|
||||
SaveStateEntry *se;
|
||||
|
||||
QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
|
||||
if (!se->ops || !se->ops->switchover_ack_needed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (se->ops->switchover_ack_needed(se->opaque)) {
|
||||
mis->switchover_ack_pending_num++;
|
||||
}
|
||||
}
|
||||
|
||||
trace_loadvm_state_switchover_ack_needed(mis->switchover_ack_pending_num);
|
||||
}
|
||||
|
||||
static int qemu_loadvm_state_setup(QEMUFile *f, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
@@ -3078,10 +3061,6 @@ int qemu_loadvm_state(QEMUFile *f, Error **errp)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (migrate_switchover_ack()) {
|
||||
qemu_loadvm_state_switchover_ack_needed(mis);
|
||||
}
|
||||
|
||||
cpu_synchronize_all_pre_loadvm();
|
||||
|
||||
ret = qemu_loadvm_state_main(f, mis, errp);
|
||||
|
||||
@@ -8,7 +8,6 @@ qemu_loadvm_state_post_main(int ret) "%d"
|
||||
qemu_loadvm_state_section_startfull(uint32_t section_id, const char *idstr, uint32_t instance_id, uint32_t version_id) "%u(%s) %u %u"
|
||||
qemu_savevm_send_packaged(void) ""
|
||||
qemu_savevm_query_pending(bool exact, bool final, uint64_t precopy, uint64_t stopcopy, uint64_t postcopy, uint64_t total) "exact=%d, final=%d, precopy=%"PRIu64", stopcopy=%"PRIu64", postcopy=%"PRIu64", total=%"PRIu64
|
||||
loadvm_state_switchover_ack_needed(unsigned int switchover_ack_pending_num) "Switchover ack pending num=%u"
|
||||
loadvm_state_setup(void) ""
|
||||
loadvm_state_cleanup(void) ""
|
||||
loadvm_handle_cmd_packaged(unsigned int length) "%u"
|
||||
@@ -199,6 +198,7 @@ process_incoming_migration_co_postcopy_end_main(void) ""
|
||||
postcopy_preempt_enabled(bool value) "%d"
|
||||
migration_precopy_complete(void) ""
|
||||
migration_call_notifiers(int type) "type=%d"
|
||||
migration_request_switchover_ack(const char *requester, unsigned int switchover_ack_pending_num) "Requester %s, switchover_ack_pending_num %u"
|
||||
|
||||
# migration-stats
|
||||
migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd, uint64_t rdma) "qemu_file %" PRIu64 " multifd %" PRIu64 " RDMA %" PRIu64
|
||||
|
||||
Reference in New Issue
Block a user