From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 06/54] ram: Move bitmap_sync_count into RAMState
Date: Thu, 6 Apr 2017 15:08:25 +0200 [thread overview]
Message-ID: <20170406130913.2232-7-quintela@redhat.com> (raw)
In-Reply-To: <20170406130913.2232-1-quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
migration/ram.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index a59140b..935311d 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -45,8 +45,6 @@
#include "qemu/rcu_queue.h"
#include "migration/colo.h"
-static uint64_t bitmap_sync_count;
-
/***********************************************************/
/* ram save/restore */
@@ -154,6 +152,8 @@ struct RAMState {
bool ram_bulk_stage;
/* How many times we have dirty too many pages */
int dirty_rate_high_cnt;
+ /* How many times we have synchronized the bitmap */
+ uint64_t bitmap_sync_count;
};
typedef struct RAMState RAMState;
@@ -471,7 +471,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_addr_t current_addr)
/* We don't care if this fails to allocate a new cache page
* as long as it updated an old one */
cache_insert(XBZRLE.cache, current_addr, ZERO_TARGET_PAGE,
- bitmap_sync_count);
+ rs->bitmap_sync_count);
}
#define ENCODING_FLAG_XBZRLE 0x1
@@ -483,6 +483,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_addr_t current_addr)
* 0 means that page is identical to the one already sent
* -1 means that xbzrle would be longer than normal
*
+ * @rs: current RAM state
* @f: QEMUFile where to send the data
* @current_data: pointer to the address of the page contents
* @current_addr: addr of the page
@@ -491,7 +492,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_addr_t current_addr)
* @last_stage: if we are at the completion stage
* @bytes_transferred: increase it with the number of transferred bytes
*/
-static int save_xbzrle_page(QEMUFile *f, uint8_t **current_data,
+static int save_xbzrle_page(RAMState *rs, QEMUFile *f, uint8_t **current_data,
ram_addr_t current_addr, RAMBlock *block,
ram_addr_t offset, bool last_stage,
uint64_t *bytes_transferred)
@@ -499,11 +500,11 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t **current_data,
int encoded_len = 0, bytes_xbzrle;
uint8_t *prev_cached_page;
- if (!cache_is_cached(XBZRLE.cache, current_addr, bitmap_sync_count)) {
+ if (!cache_is_cached(XBZRLE.cache, current_addr, rs->bitmap_sync_count)) {
acct_info.xbzrle_cache_miss++;
if (!last_stage) {
if (cache_insert(XBZRLE.cache, current_addr, *current_data,
- bitmap_sync_count) == -1) {
+ rs->bitmap_sync_count) == -1) {
return -1;
} else {
/* update *current_data when the page has been
@@ -658,7 +659,7 @@ static void migration_bitmap_sync(RAMState *rs)
int64_t end_time;
int64_t bytes_xfer_now;
- bitmap_sync_count++;
+ rs->bitmap_sync_count++;
if (!bytes_xfer_prev) {
bytes_xfer_prev = ram_bytes_transferred();
@@ -720,9 +721,9 @@ static void migration_bitmap_sync(RAMState *rs)
start_time = end_time;
num_dirty_pages_period = 0;
}
- s->dirty_sync_count = bitmap_sync_count;
+ s->dirty_sync_count = rs->bitmap_sync_count;
if (migrate_use_events()) {
- qapi_event_send_migration_pass(bitmap_sync_count, NULL);
+ qapi_event_send_migration_pass(rs->bitmap_sync_count, NULL);
}
}
@@ -829,7 +830,7 @@ static int ram_save_page(RAMState *rs, MigrationState *ms, QEMUFile *f,
ram_release_pages(ms, block->idstr, pss->offset, pages);
} else if (!rs->ram_bulk_stage &&
!migration_in_postcopy(ms) && migrate_use_xbzrle()) {
- pages = save_xbzrle_page(f, &p, current_addr, block,
+ pages = save_xbzrle_page(rs, f, &p, current_addr, block,
offset, last_stage, bytes_transferred);
if (!last_stage) {
/* Can't send this cached data async, since the cache page
@@ -1999,7 +2000,7 @@ static int ram_save_init_globals(RAMState *rs)
int64_t ram_bitmap_pages; /* Size of bitmap in pages, including gaps */
rs->dirty_rate_high_cnt = 0;
- bitmap_sync_count = 0;
+ rs->bitmap_sync_count = 0;
migration_bitmap_sync_init();
qemu_mutex_init(&migration_bitmap_mutex);
--
2.9.3
next prev parent reply other threads:[~2017-04-06 13:09 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 13:08 [Qemu-devel] [PATCH v3 00/54] Creating RAMState for migration Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 01/54] ram: Update all functions comments Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 02/54] ram: Rename flush_page_queue() to migration_page_queue_free() Juan Quintela
2017-04-07 9:25 ` Dr. David Alan Gilbert
2017-04-11 3:44 ` Peter Xu
2017-04-06 13:08 ` [Qemu-devel] [PATCH 03/54] ram: Rename block_name to rbname Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 04/54] ram: Create RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 05/54] ram: Add dirty_rate_high_cnt to RAMState Juan Quintela
2017-04-06 13:08 ` Juan Quintela [this message]
2017-04-06 13:08 ` [Qemu-devel] [PATCH 07/54] ram: Move start time into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 08/54] ram: Move bytes_xfer_prev " Juan Quintela
2017-04-11 3:47 ` Peter Xu
2017-04-06 13:08 ` [Qemu-devel] [PATCH 09/54] ram: Change byte_xfer_now type to uint64_t Juan Quintela
2017-04-07 9:39 ` Dr. David Alan Gilbert
2017-04-11 3:49 ` Peter Xu
2017-04-06 13:08 ` [Qemu-devel] [PATCH 10/54] ram: Move num_dirty_pages_period into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 11/54] ram: Change num_dirty_pages_period type to uint64_t Juan Quintela
2017-04-07 9:44 ` Dr. David Alan Gilbert
2017-04-11 4:08 ` Peter Xu
2017-04-06 13:08 ` [Qemu-devel] [PATCH 12/54] ram: Move xbzrle_cache_miss_prev into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 13/54] ram: Move iterations_prev " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 14/54] ram: Move dup_pages " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 15/54] ram: Remove unused dup_mig_bytes_transferred() Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 16/54] ram: Remove unused pages_skipped variable Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 17/54] ram: Move norm_pages to RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 18/54] ram: Remove norm_mig_bytes_transferred Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 19/54] ram: Move iterations into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 20/54] ram: Move xbzrle_bytes " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 21/54] ram: Move xbzrle_pages " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 22/54] ram: Move xbzrle_cache_miss " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 23/54] ram: Move xbzrle_cache_miss_rate " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 24/54] ram: Move xbzrle_overflows " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 25/54] ram: Move migration_dirty_pages to RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 26/54] ram: Everything was init to zero, so use memset Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 27/54] ram: Move migration_bitmap_mutex into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 28/54] ram: Move migration_bitmap_rcu " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 29/54] ram: Move bytes_transferred " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 30/54] ram: Use the RAMState bytes_transferred parameter Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 31/54] ram: Remove ram_save_remaining Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 32/54] ram: Move last_req_rb to RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 33/54] ram: Move src_page_req* " Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 34/54] ram: Create ram_dirty_sync_count() Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 35/54] ram: Remove dirty_bytes_rate Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 36/54] ram: Move dirty_pages_rate to RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 37/54] ram: Move postcopy_requests into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 38/54] ram: Add QEMUFile to RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 39/54] ram: Move QEMUFile into RAMState Juan Quintela
2017-04-06 13:08 ` [Qemu-devel] [PATCH 40/54] ram: Remove compression_switch and inline its logic Juan Quintela
2017-04-07 9:46 ` Dr. David Alan Gilbert
2017-04-11 4:14 ` Peter Xu
2017-04-18 18:17 ` Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 41/54] migration: Remove MigrationState from migration_in_postcopy Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 42/54] ram: We don't need MigrationState parameter anymore Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 43/54] ram: Rename qemu_target_page_bits() to qemu_target_page_size() Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 44/54] ram: Add page-size to output in 'info migrate' Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 45/54] ram: Pass RAMBlock to bitmap_sync Juan Quintela
2017-04-07 10:01 ` Dr. David Alan Gilbert
2017-04-06 13:09 ` [Qemu-devel] [PATCH 46/54] ram: ram_discard_range() don't use the mis parameter Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 47/54] ram: reorganize last_sent_block Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 48/54] ram: Use page number instead of an address for the bitmap operations Juan Quintela
2017-04-07 10:26 ` Dr. David Alan Gilbert
2017-04-18 19:18 ` Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 49/54] ram: Remember last_page instead of last_offset Juan Quintela
2017-04-07 10:39 ` Dr. David Alan Gilbert
2017-04-06 13:09 ` [Qemu-devel] [PATCH 50/54] ram: Change offset field in PageSearchStatus to page Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 51/54] ram: Use ramblock and page offset instead of absolute offset Juan Quintela
2017-04-07 10:53 ` Dr. David Alan Gilbert
2017-04-06 13:09 ` [Qemu-devel] [PATCH 52/54] ram: rename last_ram_offset() last_ram_pages() Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 53/54] ram: Use RAMBitmap type for coherence Juan Quintela
2017-04-06 13:09 ` [Qemu-devel] [PATCH 54/54] migration: Remove MigrationState parameter from migration_is_idle() Juan Quintela
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=20170406130913.2232-7-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).