On 2.03.2025 13:42, Avihai Horon wrote:
Hi Maciej,

Sorry for the long delay, I have been busy with other tasks.
I got some small comments for the series.

On 19/02/2025 22:33, Maciej S. Szmigiero wrote:
External email: Use caution opening links or attachments


From: "Maciej S. Szmigiero" <maciej.szmigi...@oracle.com>

Add a basic support for receiving device state via multifd channels -
channels that are shared with RAM transfers.

Depending whether MULTIFD_FLAG_DEVICE_STATE flag is present or not in the
packet header either device state (MultiFDPacketDeviceState_t) or RAM
data (existing MultiFDPacket_t) is read.

The received device state data is provided to
qemu_loadvm_load_state_buffer() function for processing in the
device's load_state_buffer handler.

Reviewed-by: Peter Xu <pet...@redhat.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigi...@oracle.com>
---
  migration/multifd.c | 99 ++++++++++++++++++++++++++++++++++++++++-----
  migration/multifd.h | 26 +++++++++++-
  2 files changed, 113 insertions(+), 12 deletions(-)

(..)
index f7156f66c0f6..c2ebef2d319e 100644
--- a/migration/multifd.h
+++ b/migration/multifd.h
@@ -62,6 +62,12 @@ MultiFDRecvData *multifd_get_recv_data(void);
  #define MULTIFD_FLAG_UADK (8 << 1)
  #define MULTIFD_FLAG_QATZIP (16 << 1)

+/*
+ * If set it means that this packet contains device state
+ * (MultiFDPacketDeviceState_t), not RAM data (MultiFDPacket_t).
+ */
+#define MULTIFD_FLAG_DEVICE_STATE (32 << 1)
+
  /* This value needs to be a multiple of qemu_target_page_size() */
  #define MULTIFD_PACKET_SIZE (512 * 1024)

@@ -94,6 +100,16 @@ typedef struct {
      uint64_t offset[];
  } __attribute__((packed)) MultiFDPacket_t;

+typedef struct {
+    MultiFDPacketHdr_t hdr;
+
+    char idstr[256] QEMU_NONSTRING;
+    uint32_t instance_id;
+
+    /* size of the next packet that contains the actual data */
+    uint32_t next_packet_size;
+} __attribute__((packed)) MultiFDPacketDeviceState_t;
+
  typedef struct {
      /* number of used pages */
      uint32_t num;
@@ -111,6 +127,13 @@ struct MultiFDRecvData {
      off_t file_offset;
  };

+typedef struct {
+    char *idstr;
+    uint32_t instance_id;
+    char *buf;
+    size_t buf_len;
+} MultiFDDeviceState_t;

This is only used in patch #14. Maybe move it there?

Moved it to "send side" patch.

Thanks.


Thanks,
Maciej


Reply via email to