aboutsummaryrefslogtreecommitdiff
path: root/migration/postcopy-ram.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2017-05-18 10:05:50 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-05-18 10:05:52 +0100
commit2ccbd47c1def618b31af1d88b550f6d2bdd15b0f (patch)
tree9944ab67319550408e114c6842722e326df7c172 /migration/postcopy-ram.h
parentadb354dd1e00aa6b8bd674f0e1f70008badded0f (diff)
parent1bfe5f0586083747f1602931713111673849cd9d (diff)
Merge remote-tracking branch 'quintela/tags/migration/20170517' into staging
migration/next for 20170517 # gpg: Signature made Wed 17 May 2017 11:46:36 AM BST # gpg: using RSA key 0xF487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * quintela/tags/migration/20170517: migration: Move check_migratable() into qdev.c migration: Move postcopy stuff to postcopy-ram.c migration: Move page_cache.c to migration/ migration: Create migration/blocker.h ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO migration: Pass Error ** argument to {save,load}_vmstate migration: Fix regression with compression threads Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'migration/postcopy-ram.h')
-rw-r--r--migration/postcopy-ram.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h
index 4c25f03be2..52d51e8007 100644
--- a/migration/postcopy-ram.h
+++ b/migration/postcopy-ram.h
@@ -81,6 +81,28 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from,
int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
size_t pagesize);
+/* The current postcopy state is read/set by postcopy_state_get/set
+ * which update it atomically.
+ * The state is updated as postcopy messages are received, and
+ * in general only one thread should be writing to the state at any one
+ * time, initially the main thread and then the listen thread;
+ * Corner cases are where either thread finishes early and/or errors.
+ * The state is checked as messages are received to ensure that
+ * the source is sending us messages in the correct order.
+ * The state is also used by the RAM reception code to know if it
+ * has to place pages atomically, and the cleanup code at the end of
+ * the main thread to know if it has to delay cleanup until the end
+ * of postcopy.
+ */
+typedef enum {
+ POSTCOPY_INCOMING_NONE = 0, /* Initial state - no postcopy */
+ POSTCOPY_INCOMING_ADVISE,
+ POSTCOPY_INCOMING_DISCARD,
+ POSTCOPY_INCOMING_LISTENING,
+ POSTCOPY_INCOMING_RUNNING,
+ POSTCOPY_INCOMING_END
+} PostcopyState;
+
/*
* Allocate a page of memory that can be mapped at a later point in time
* using postcopy_place_page
@@ -88,4 +110,8 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
*/
void *postcopy_get_tmp_page(MigrationIncomingState *mis);
+PostcopyState postcopy_state_get(void);
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state);
+
#endif