From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org
Cc: aarcange@redhat.com, yamahata@private.email.ne.jp,
amit.shah@redhat.com, lilei@linux.vnet.ibm.com,
quintela@redhat.com
Subject: [Qemu-devel] [PATCH v3 12/47] Return path: Control commands
Date: Thu, 28 Aug 2014 16:03:29 +0100 [thread overview]
Message-ID: <1409238244-31720-13-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1409238244-31720-1-git-send-email-dgilbert@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
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 <dgilbert@redhat.com>
---
include/migration/migration.h | 2 ++
include/sysemu/sysemu.h | 4 +++
savevm.c | 57 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index e23947a..173775b 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_get_current(void);
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index a0a91e3..4dd6ba0 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
};
@@ -97,6 +99,8 @@ void qemu_savevm_state_cancel(void);
uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
void qemu_savevm_command_send(QEMUFile *f, enum qemu_vm_cmd command,
uint16_t len, uint8_t *data);
+void qemu_savevm_send_reqack(QEMUFile *f, uint32_t value);
+void qemu_savevm_send_openrp(QEMUFile *f);
int qemu_loadvm_state(QEMUFile *f);
/* SLIRP */
diff --git a/savevm.c b/savevm.c
index 3cae292..793384a 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;
@@ -900,20 +913,64 @@ static SaveStateEntry *find_se(const char *idstr, int instance_id)
return NULL;
}
+static int loadvm_process_command_simple_lencheck(const char *name,
+ unsigned int actual,
+ unsigned int expected)
+{
+ if (actual != expected) {
+ error_report("%s received with bad length - expecting %d, got %d",
+ name, expected, actual);
+ return -1;
+ }
+
+ return 0;
+}
+
/*
* Process an incoming 'QEMU_VM_COMMAND'
* negative return on error (will issue error message)
*/
static int loadvm_process_command(QEMUFile *f)
{
+ MigrationIncomingState *mis = migration_incoming_get_current();
uint16_t com;
uint16_t len;
+ uint32_t tmp32;
com = qemu_get_be16(f);
len = qemu_get_be16(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); TODO: gets added later */
+ break;
default:
error_report("VM_COMMAND 0x%x unknown (len 0x%x)", com, len);
--
1.9.3
next prev parent reply other threads:[~2014-08-28 15:04 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 15:03 [Qemu-devel] [PATCH v3 00/47] Postcopy implementation Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 01/47] QEMUSizedBuffer/QEMUFile Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 02/47] Tests: QEMUSizedBuffer/QEMUBuffer Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 03/47] Start documenting how postcopy works Dr. David Alan Gilbert (git)
2014-09-09 3:34 ` Hongyang Yang
2014-09-09 3:46 ` Hongyang Yang
2014-09-09 3:39 ` Hongyang Yang
2014-09-12 11:23 ` Dr. David Alan Gilbert
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 04/47] qemu_ram_foreach_block: pass up error value, and down the ramblock name Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 05/47] improve DPRINTF macros, add to savevm Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 06/47] Add qemu_get_counted_string to read a string prefixed by a count byte Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 07/47] Create MigrationIncomingState Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 08/47] socket shutdown Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 09/47] Return path: Open a return path on QEMUFile for sockets Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 10/47] Return path: socket_writev_buffer: Block even on non-blocking fd's Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 11/47] Migration commands Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` Dr. David Alan Gilbert (git) [this message]
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 13/47] Return path: Send responses from destination to source Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 14/47] Return path: Source handling of return path Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 15/47] qemu_loadvm errors and debug Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 16/47] ram_debug_dump_bitmap: Dump a migration bitmap as text Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 17/47] Rework loadvm path for subloops Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 18/47] Add migration-capability boolean for postcopy-ram Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 19/47] Add wrappers and handlers for sending/receiving the postcopy-ram migration messages Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 20/47] QEMU_VM_CMD_PACKAGED: Send a packaged chunk of migration stream Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 21/47] migrate_init: Call from savevm Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 22/47] Allow savevm handlers to state whether they could go into postcopy Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 23/47] postcopy: OS support test Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 24/47] migrate_start_postcopy: Command to trigger transition to postcopy Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 25/47] MIG_STATE_POSTCOPY_ACTIVE: Add new migration state Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 26/47] qemu_savevm_state_complete: Postcopy changes Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 27/47] Postcopy: Maintain sentmap during postcopy pre phase Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 28/47] Postcopy page-map-incoming (PMI) structure Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 29/47] postcopy: Add incoming_init/cleanup functions Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 30/47] postcopy: Incoming initialisation Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 31/47] postcopy: ram_enable_notify to switch on userfault Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 32/47] Postcopy: postcopy_start Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 33/47] Postcopy: Rework migration thread for postcopy mode Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 34/47] mig fd_connect: open return path Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 35/47] Postcopy: Create a fault handler thread before marking the ram as userfault Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 36/47] Page request: Add MIG_RPCOMM_REQPAGES reverse command Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 37/47] Page request: Process incoming page request Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 38/47] Page request: Consume pages off the post-copy queue Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 39/47] Add assertion to check migration_dirty_pages Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 40/47] postcopy_ram.c: place_page and helpers Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 41/47] Postcopy: Use helpers to map pages during migration Dr. David Alan Gilbert (git)
2014-08-28 15:03 ` [Qemu-devel] [PATCH v3 42/47] qemu_ram_block_from_host Dr. David Alan Gilbert (git)
2014-08-28 15:04 ` [Qemu-devel] [PATCH v3 43/47] Don't sync dirty bitmaps in postcopy Dr. David Alan Gilbert (git)
2014-08-28 15:04 ` [Qemu-devel] [PATCH v3 44/47] Postcopy; Handle userfault requests Dr. David Alan Gilbert (git)
2014-08-28 15:04 ` [Qemu-devel] [PATCH v3 45/47] Start up a postcopy/listener thread ready for incoming page data Dr. David Alan Gilbert (git)
2014-08-28 15:04 ` [Qemu-devel] [PATCH v3 46/47] postcopy: Wire up loadvm_postcopy_ram_handle_{run, end} commands Dr. David Alan Gilbert (git)
2014-08-28 15:04 ` [Qemu-devel] [PATCH v3 47/47] End of migration for postcopy Dr. David Alan Gilbert (git)
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=1409238244-31720-13-git-send-email-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=aarcange@redhat.com \
--cc=amit.shah@redhat.com \
--cc=lilei@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=yamahata@private.email.ne.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).