[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 37/59] ram: Move postcopy_requests into RAMState
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 37/59] ram: Move postcopy_requests into RAMState |
Date: |
Wed, 19 Apr 2017 22:59:01 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Peter Xu <address@hidden>
---
include/migration/migration.h | 6 ++----
migration/migration.c | 5 ++---
migration/ram.c | 13 +++++++++----
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/include/migration/migration.h b/include/migration/migration.h
index c4e3d42..357eaa0 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -157,8 +157,6 @@ struct MigrationState
bool enabled_capabilities[MIGRATION_CAPABILITY__MAX];
int64_t xbzrle_cache_size;
int64_t setup_time;
- /* Count of requests incoming from destination */
- int64_t postcopy_requests;
/* Flag set once the migration has been asked to enter postcopy */
bool start_postcopy;
@@ -254,6 +252,7 @@ uint64_t ram_bytes_transferred(void);
uint64_t ram_bytes_total(void);
uint64_t ram_dirty_sync_count(void);
uint64_t ram_dirty_pages_rate(void);
+uint64_t ram_postcopy_requests(void);
void free_xbzrle_decoded_buf(void);
void acct_update_position(QEMUFile *f, size_t size, bool zero);
@@ -356,8 +355,7 @@ int global_state_store(void);
void global_state_store_running(void);
void migration_page_queue_free(void);
-int ram_save_queue_pages(MigrationState *ms, const char *rbname,
- ram_addr_t start, ram_addr_t len);
+int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
uint64_t ram_pagesize_summary(void);
PostcopyState postcopy_state_get(void);
diff --git a/migration/migration.c b/migration/migration.c
index e430aec..2990c40 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -657,7 +657,7 @@ static void populate_ram_info(MigrationInfo *info,
MigrationState *s)
(1ul << qemu_target_page_bits());
info->ram->mbps = s->mbps;
info->ram->dirty_sync_count = ram_dirty_sync_count();
- info->ram->postcopy_requests = s->postcopy_requests;
+ info->ram->postcopy_requests = ram_postcopy_requests();
if (s->state != MIGRATION_STATUS_COMPLETED) {
info->ram->remaining = ram_bytes_remaining();
@@ -1120,7 +1120,6 @@ MigrationState *migrate_init(const MigrationParams
*params)
s->setup_time = 0;
s->start_postcopy = false;
s->postcopy_after_devices = false;
- s->postcopy_requests = 0;
s->migration_thread_running = false;
error_free(s->error);
s->error = NULL;
@@ -1480,7 +1479,7 @@ static void migrate_handle_rp_req_pages(MigrationState
*ms, const char* rbname,
return;
}
- if (ram_save_queue_pages(ms, rbname, start, len)) {
+ if (ram_save_queue_pages(rbname, start, len)) {
mark_source_rp_bad(ms);
}
}
diff --git a/migration/ram.c b/migration/ram.c
index c5240eb..b9f415c 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -214,6 +214,8 @@ struct RAMState {
uint64_t bytes_transferred;
/* number of dirtied pages in the last second */
uint64_t dirty_pages_rate;
+ /* Count of requests incoming from destination */
+ uint64_t postcopy_requests;
/* protects modification of the bitmap */
QemuMutex bitmap_mutex;
/* Ram Bitmap protected by RCU */
@@ -283,6 +285,11 @@ uint64_t ram_dirty_pages_rate(void)
return ram_state.dirty_pages_rate;
}
+uint64_t ram_postcopy_requests(void)
+{
+ return ram_state.postcopy_requests;
+}
+
/* used by the search for pages to send */
struct PageSearchStatus {
/* Current block being searched */
@@ -1240,19 +1247,17 @@ void migration_page_queue_free(void)
*
* Returns zero on success or negative on error
*
- * @ms: current migration state
* @rbname: Name of the RAMBLock of the request. NULL means the
* same that last one.
* @start: starting address from the start of the RAMBlock
* @len: length (in bytes) to send
*/
-int ram_save_queue_pages(MigrationState *ms, const char *rbname,
- ram_addr_t start, ram_addr_t len)
+int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len)
{
RAMBlock *ramblock;
RAMState *rs = &ram_state;
- ms->postcopy_requests++;
+ rs->postcopy_requests++;
rcu_read_lock();
if (!rbname) {
/* Reuse last RAMBlock */
--
2.9.3
- [Qemu-devel] [PATCH 24/59] ram: Move xbzrle_overflows into RAMState, (continued)
- [Qemu-devel] [PATCH 24/59] ram: Move xbzrle_overflows into RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 29/59] ram: Move bytes_transferred into RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 28/59] ram: Move migration_bitmap_rcu into RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 25/59] ram: Move migration_dirty_pages to RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 30/59] ram: Use the RAMState bytes_transferred parameter, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 31/59] ram: Remove ram_save_remaining, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 32/59] ram: Move last_req_rb to RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 34/59] ram: Create ram_dirty_sync_count(), Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 33/59] ram: Move src_page_req* to RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 35/59] ram: Remove dirty_bytes_rate, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 37/59] ram: Move postcopy_requests into RAMState,
Juan Quintela <=
- [Qemu-devel] [PATCH 36/59] ram: Move dirty_pages_rate to RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 38/59] ram: Add QEMUFile to RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 40/59] ram: Remove compression_switch and inline its logic, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 39/59] ram: Move QEMUFile into RAMState, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 41/59] migration: Remove MigrationState from migration_in_postcopy, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 42/59] ram: We don't need MigrationState parameter anymore, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 43/59] ram: Rename qemu_target_page_bits() to qemu_target_page_size(), Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 44/59] ram: Add page-size to output in 'info migrate', Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 45/59] ram: Pass RAMBlock to bitmap_sync, Juan Quintela, 2017/04/19
- [Qemu-devel] [PATCH 46/59] ram: ram_discard_range() don't use the mis parameter, Juan Quintela, 2017/04/19