[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/46] Return path: Control commands
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[Qemu-devel] [PATCH 10/46] Return path: Control commands |
Date: |
Fri, 4 Jul 2014 18:41:21 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
Add two src->dest commands:
* OPENRP - To request that the destination open the return path
* REQACK - Request an acknowledge from the destination
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
include/migration/migration.h | 2 ++
include/sysemu/sysemu.h | 2 ++
savevm.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 728b93e..0e21c5d 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -45,6 +45,8 @@ typedef struct MigrationState MigrationState;
/* State for the incoming migration */
struct MigrationIncomingState {
QEMUFile *file;
+
+ QEMUFile *return_path;
};
MigrationIncomingState *migration_incoming_state_init(QEMUFile *f);
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 66821eb..b25e938 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -84,6 +84,8 @@ void qemu_announce_self(void);
/* Subcommands for QEMU_VM_COMMAND */
enum qemu_vm_cmd {
QEMU_VM_CMD_INVALID = 0, /* Must be 0 */
+ QEMU_VM_CMD_OPENRP, /* Tell the dest to open the Return path */
+ QEMU_VM_CMD_REQACK, /* Request an ACK on the RP */
QEMU_VM_CMD_AFTERLASTVALID
};
diff --git a/savevm.c b/savevm.c
index 0c7d537..16b672b 100644
--- a/savevm.c
+++ b/savevm.c
@@ -611,6 +611,19 @@ void qemu_savevm_command_send(QEMUFile *f,
qemu_fflush(f);
}
+void qemu_savevm_send_reqack(QEMUFile *f, uint32_t value)
+{
+ uint32_t buf;
+
+ DPRINTF("send_reqack %d", value);
+ buf = cpu_to_be32(value);
+ qemu_savevm_command_send(f, QEMU_VM_CMD_REQACK, 4, (uint8_t *)&buf);
+}
+
+void qemu_savevm_send_openrp(QEMUFile *f)
+{
+ qemu_savevm_command_send(f, QEMU_VM_CMD_OPENRP, 0, NULL);
+}
bool qemu_savevm_state_blocked(Error **errp)
{
SaveStateEntry *se;
@@ -918,6 +931,7 @@ static int loadvm_process_command_simple_lencheck(const
char *name,
*/
static int loadvm_process_command(QEMUFile *f)
{
+ MigrationIncomingState *mis = f->mis;
uint16_t com;
uint16_t len;
uint32_t tmp32;
@@ -927,6 +941,35 @@ static int loadvm_process_command(QEMUFile *f)
/* fprintf(stderr,"loadvm_process_command: com=0x%x len=%d\n", com,len); */
switch (com) {
+ case QEMU_VM_CMD_OPENRP:
+ if (loadvm_process_command_simple_lencheck("CMD_OPENRP", len, 0)) {
+ return -1;
+ }
+ if (mis->return_path) {
+ error_report("CMD_OPENRP called when RP already open");
+ /* Not really a problem, so don't give up */
+ return 0;
+ }
+ mis->return_path = qemu_file_get_return_path(f);
+ if (!mis->return_path) {
+ error_report("CMD_OPENRP failed - could not open return path");
+ return -1;
+ }
+ break;
+
+ case QEMU_VM_CMD_REQACK:
+ if (loadvm_process_command_simple_lencheck("CMD_REQACK", len, 4)) {
+ return -1;
+ }
+ tmp32 = qemu_get_be32(f);
+ DPRINTF("Received REQACK 0x%x", tmp32);
+ if (!mis->return_path) {
+ error_report("CMD_REQACK (0x%x) received with no open return path",
+ tmp32);
+ return -1;
+ }
+ migrate_send_rp_ack(mis, tmp32);
+ break;
default:
error_report("VM_COMMAND 0x%x unknown (len 0x%x)", com, len);
--
1.9.3
- [Qemu-devel] [PATCH 01/46] qemu_ram_foreach_block: pass up error value, and down the ramblock name, (continued)
- [Qemu-devel] [PATCH 01/46] qemu_ram_foreach_block: pass up error value, and down the ramblock name, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 03/46] QEMUSizedBuffer/QEMUFile, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 04/46] improve DPRINTF macros, add to savevm, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 06/46] Create MigrationIncomingState, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 05/46] Add qemu_get_counted_string to read a string prefixed by a count byte, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 07/46] Return path: Open a return path on QEMUFile for sockets, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 09/46] Migration commands, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 08/46] Return path: socket_writev_buffer: Block even on non-blocking fd's, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 10/46] Return path: Control commands,
Dr. David Alan Gilbert (git) <=
- [Qemu-devel] [PATCH 12/46] Return path: Source handling of return path, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 11/46] Return path: Send responses from destination to source, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 23/46] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 24/46] qemu_savevm_state_complete: Postcopy changes, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 25/46] Postcopy: Maintain sentmap during postcopy pre phase, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 26/46] Postcopy page-map-incoming (PMI) structure, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 27/46] postcopy: Add incoming_init/cleanup functions, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 29/46] postcopy: ram_enable_notify to switch on userfault, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 28/46] postcopy: Incoming initialisation, Dr. David Alan Gilbert (git), 2014/07/04
- [Qemu-devel] [PATCH 30/46] Postcopy: postcopy_start, Dr. David Alan Gilbert (git), 2014/07/04