aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorWei Yang <richardw.yang@linux.intel.com>2019-10-11 16:50:49 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2019-10-11 15:02:00 +0100
commit9985e1f48db7449421dafdc22d275551072f0a06 (patch)
tree71df476d1b132acf75fe32ef565d1720a9b47929 /migration
parentf2148c4c793f67e24ff97ddf12c8eeccdba9fb8e (diff)
downloadqemu-9985e1f48db7449421dafdc22d275551072f0a06.zip
qemu-9985e1f48db7449421dafdc22d275551072f0a06.tar.gz
qemu-9985e1f48db7449421dafdc22d275551072f0a06.tar.bz2
migration/multifd: initialize packet->magic/version once at setup stage
MultiFDPacket_t's magic and version field never changes during migration, so move these two fields in setup stage. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Message-Id: <20191011085050.17622-4-richardw.yang@linux.intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 84c5953..963e795 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -793,8 +793,6 @@ static void multifd_send_fill_packet(MultiFDSendParams *p)
MultiFDPacket_t *packet = p->packet;
int i;
- packet->magic = cpu_to_be32(MULTIFD_MAGIC);
- packet->version = cpu_to_be32(MULTIFD_VERSION);
packet->flags = cpu_to_be32(p->flags);
packet->pages_alloc = cpu_to_be32(p->pages->allocated);
packet->pages_used = cpu_to_be32(p->pages->used);
@@ -1240,6 +1238,8 @@ int multifd_save_setup(void)
p->packet_len = sizeof(MultiFDPacket_t)
+ sizeof(ram_addr_t) * page_count;
p->packet = g_malloc0(p->packet_len);
+ p->packet->magic = cpu_to_be32(MULTIFD_MAGIC);
+ p->packet->version = cpu_to_be32(MULTIFD_VERSION);
p->name = g_strdup_printf("multifdsend_%d", i);
socket_send_channel_create(multifd_new_send_channel_async, p);
}