[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ra
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c |
Date: |
Wed, 26 Apr 2017 00:04:41 +0200 |
Yes, we don't have a good place to put that stuff.
Signed-off-by: Juan Quintela <address@hidden>
---
include/migration/migration.h | 25 -------------------------
migration/migration.c | 18 ------------------
migration/postcopy-ram.c | 18 ++++++++++++++++++
migration/postcopy-ram.h | 26 ++++++++++++++++++++++++++
4 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9063c32..5c27fe7 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -54,28 +54,6 @@ enum mig_rp_message_type {
typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
-/* 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;
-
/* State for the incoming migration */
struct MigrationIncomingState {
QEMUFile *from_src_file;
@@ -253,7 +231,4 @@ void savevm_skip_configuration(void);
int global_state_store(void);
void global_state_store_running(void);
-PostcopyState postcopy_state_get(void);
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state);
#endif
diff --git a/migration/migration.c b/migration/migration.c
index ff32086..d2f3c5e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -85,13 +85,6 @@ static NotifierList migration_state_notifiers =
static bool deferred_incoming;
-/*
- * Current state of incoming postcopy; note this is not part of
- * MigrationIncomingState since it's state is used during cleanup
- * at the end as MIS is being freed.
- */
-static PostcopyState incoming_postcopy_state;
-
/* When we add fault tolerance, we could have several
migrations at once. For now we don't need to add
dynamic creation of migration */
@@ -2085,14 +2078,3 @@ void migrate_fd_connect(MigrationState *s)
s->migration_thread_running = true;
}
-PostcopyState postcopy_state_get(void)
-{
- return atomic_mb_read(&incoming_postcopy_state);
-}
-
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state)
-{
- return atomic_xchg(&incoming_postcopy_state, new_state);
-}
-
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 3359224..cae5d48 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -787,3 +787,21 @@ void postcopy_discard_send_finish(MigrationState *ms,
PostcopyDiscardState *pds)
g_free(pds);
}
+
+/*
+ * Current state of incoming postcopy; note this is not part of
+ * MigrationIncomingState since it's state is used during cleanup
+ * at the end as MIS is being freed.
+ */
+static PostcopyState incoming_postcopy_state;
+
+PostcopyState postcopy_state_get(void)
+{
+ return atomic_mb_read(&incoming_postcopy_state);
+}
+
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state)
+{
+ return atomic_xchg(&incoming_postcopy_state, new_state);
+}
diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h
index 4c25f03..52d51e8 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
--
2.9.3
- [Qemu-devel] [PATCH 23/41] migration: Export tls.c functions in its own file, (continued)
- [Qemu-devel] [PATCH 23/41] migration: Export tls.c functions in its own file, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 24/41] migration: Export ram.c functions in its own file, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 25/41] migration: Export rdma.c functions in its own file, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c,
Juan Quintela <=
- [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 35/41] migration: create global_state.c, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size(), Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent, Juan Quintela, 2017/04/25
- [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes, Juan Quintela, 2017/04/25