#include "exec/cpu-common.h"
#include "qemu/coroutine_int.h"
-/* Messages sent on the return path from destination to source */
-enum mig_rp_message_type {
- MIG_RP_MSG_INVALID = 0, /* Must be 0 */
- MIG_RP_MSG_SHUT, /* sibling will not send any more RP messages */
- MIG_RP_MSG_PONG, /* Response to a PING; data (seq: be32 ) */
-
- MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
- MIG_RP_MSG_REQ_PAGES, /* data (start: be64, len: be32) */
-
- MIG_RP_MSG_MAX
-};
-
/* State for the incoming migration */
struct MigrationIncomingState {
QEMUFile *from_src_file;
bool migrate_use_events(void);
/* Sending on the return path - generic and then for each message type */
-void migrate_send_rp_message(MigrationIncomingState *mis,
- enum mig_rp_message_type message_type,
- uint16_t len, void *data);
void migrate_send_rp_shut(MigrationIncomingState *mis,
uint32_t value);
void migrate_send_rp_pong(MigrationIncomingState *mis,
static bool deferred_incoming;
+/* Messages sent on the return path from destination to source */
+enum mig_rp_message_type {
+ MIG_RP_MSG_INVALID = 0, /* Must be 0 */
+ MIG_RP_MSG_SHUT, /* sibling will not send any more RP messages */
+ MIG_RP_MSG_PONG, /* Response to a PING; data (seq: be32 ) */
+
+ MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
+ MIG_RP_MSG_REQ_PAGES, /* data (start: be64, len: be32) */
+
+ MIG_RP_MSG_MAX
+};
+
/* When we add fault tolerance, we could have several
migrations at once. For now we don't need to add
dynamic creation of migration */
deferred_incoming = true;
}
+/*
+ * Send a message on the return channel back to the source
+ * of the migration.
+ */
+static void migrate_send_rp_message(MigrationIncomingState *mis,
+ enum mig_rp_message_type message_type,
+ uint16_t len, void *data)
+{
+ trace_migrate_send_rp_message((int)message_type, len);
+ qemu_mutex_lock(&mis->rp_mutex);
+ qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
+ qemu_put_be16(mis->to_src_file, len);
+ qemu_put_buffer(mis->to_src_file, data, len);
+ qemu_fflush(mis->to_src_file);
+ qemu_mutex_unlock(&mis->rp_mutex);
+}
+
/* Request a range of pages from the source VM at the given
* start address.
* rbname: Name of the RAMBlock to request the page in, if NULL it's the same
qemu_coroutine_enter(co);
}
-/*
- * Send a message on the return channel back to the source
- * of the migration.
- */
-void migrate_send_rp_message(MigrationIncomingState *mis,
- enum mig_rp_message_type message_type,
- uint16_t len, void *data)
-{
- trace_migrate_send_rp_message((int)message_type, len);
- qemu_mutex_lock(&mis->rp_mutex);
- qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
- qemu_put_be16(mis->to_src_file, len);
- qemu_put_buffer(mis->to_src_file, data, len);
- qemu_fflush(mis->to_src_file);
- qemu_mutex_unlock(&mis->rp_mutex);
-}
-
/*
* Send a 'SHUT' message on the return channel with the given value
* to indicate that we've finished with the RP. Non-0 value indicates