All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richardw.yang@linux.intel.com>
To: quintela@redhat.com, dgilbert@redhat.com
Cc: qemu-devel@nongnu.org, Wei Yang <richardw.yang@linux.intel.com>
Subject: [PATCH 3/4] migration/multifd: initialize packet->magic/version once at setup stage
Date: Fri, 11 Oct 2019 16:50:49 +0800	[thread overview]
Message-ID: <20191011085050.17622-4-richardw.yang@linux.intel.com> (raw)
In-Reply-To: <20191011085050.17622-1-richardw.yang@linux.intel.com>

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>
---
 migration/ram.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 6a3bef0434..71d845b851 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);
     }
-- 
2.17.1



  parent reply	other threads:[~2019-10-11  8:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  8:50 [PATCH 0/4] migration/multifd: trivial cleanup for multifd Wei Yang
2019-10-11  8:50 ` [PATCH 1/4] migration/multifd: fix a typo in comment of multifd_recv_unfill_packet() Wei Yang
2019-10-11  9:44   ` Juan Quintela
2019-10-11  8:50 ` [PATCH 2/4] migration/multifd: use pages->allocated instead of the static max Wei Yang
2019-10-11 10:31   ` Juan Quintela
2019-10-11  8:50 ` Wei Yang [this message]
2019-10-11 10:20   ` [PATCH 3/4] migration/multifd: initialize packet->magic/version once at setup stage Juan Quintela
2019-10-11 12:17     ` Wei Yang
2019-10-11  8:50 ` [PATCH 4/4] migration/multifd: pages->used would be cleared when attach to multifd_send_state Wei Yang
2019-10-11 10:24   ` Juan Quintela
2019-10-11 14:02 ` [PATCH 0/4] migration/multifd: trivial cleanup for multifd Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191011085050.17622-4-richardw.yang@linux.intel.com \
    --to=richardw.yang@linux.intel.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.