From: Wei Yang <richard.weiyang@gmail.com>
To: Juan Quintela <quintela@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Wei Yang <richardw.yang@linux.intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PULL 5/5] migratioin/ram: leave RAMBlock->bmap blank on allocating
Date: Wed, 5 Jun 2019 13:37:22 +0000 [thread overview]
Message-ID: <20190605133722.gjgqraifq53pdv6s@master> (raw)
In-Reply-To: <20190605115318.9972-6-quintela@redhat.com>
On Wed, Jun 05, 2019 at 01:53:18PM +0200, Juan Quintela wrote:
>From: Wei Yang <richardw.yang@linux.intel.com>
>
>During migration, we would sync bitmap from ram_list.dirty_memory to
>RAMBlock.bmap in cpu_physical_memory_sync_dirty_bitmap().
>
>Since we set RAMBlock.bmap and ram_list.dirty_memory both to all 1, this
>means at the first round this sync is meaningless and is a duplicated
>work.
>
>Leaving RAMBlock->bmap blank on allocating would have a side effect on
>migration_dirty_pages, since it is calculated from the result of
>cpu_physical_memory_sync_dirty_bitmap(). To keep it right, we need to
>set migration_dirty_pages to 0 in ram_state_init().
>
>Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>Reviewed-by: Juan Quintela <quintela@redhat.com>
>Signed-off-by: Juan Quintela <quintela@redhat.com>
I think Peter acked this and gave some suggestions.
>---
> migration/ram.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
>diff --git a/migration/ram.c b/migration/ram.c
>index 03a9cce9f9..082aea9d23 100644
>--- a/migration/ram.c
>+++ b/migration/ram.c
>@@ -3173,11 +3173,11 @@ static int ram_state_init(RAMState **rsp)
> QSIMPLEQ_INIT(&(*rsp)->src_page_requests);
>
> /*
>- * Count the total number of pages used by ram blocks not including any
>- * gaps due to alignment or unplugs.
>+ * This must match with the initial values of dirty bitmap.
>+ * Currently we initialize the dirty bitmap to all zeros so
>+ * here the total dirty page count is zero.
> */
>- (*rsp)->migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS;
>-
>+ (*rsp)->migration_dirty_pages = 0;
> ram_state_reset(*rsp);
>
> return 0;
>@@ -3192,8 +3192,16 @@ static void ram_list_init_bitmaps(void)
> if (ram_bytes_total()) {
> RAMBLOCK_FOREACH_NOT_IGNORED(block) {
> pages = block->max_length >> TARGET_PAGE_BITS;
>+ /*
>+ * The initial dirty bitmap for migration must be set with all
>+ * ones to make sure we'll migrate every guest RAM page to
>+ * destination.
>+ * Here we didn't set RAMBlock.bmap simply because it is already
>+ * set in ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION] in
>+ * ram_block_add, and that's where we'll sync the dirty bitmaps.
>+ * Here setting RAMBlock.bmap would be fine too but not necessary.
>+ */
> block->bmap = bitmap_new(pages);
>- bitmap_set(block->bmap, 0, pages);
> if (migrate_postcopy_ram()) {
> block->unsentmap = bitmap_new(pages);
> bitmap_set(block->unsentmap, 0, pages);
>--
>2.21.0
>
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2019-06-05 13:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 11:53 [Qemu-devel] [PULL 0/5] Migration patches Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 1/5] migration/ram.c: MultiFDSendParams.sem_sync is not really used Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 2/5] migration/ram.c: multifd_send_state->count " Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 3/5] migration: Fix fd protocol for incoming defer Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 4/5] migration-test: Add a test for fd protocol Juan Quintela
2019-06-05 11:53 ` [Qemu-devel] [PULL 5/5] migratioin/ram: leave RAMBlock->bmap blank on allocating Juan Quintela
2019-06-05 12:26 ` Philippe Mathieu-Daudé
2019-06-05 13:36 ` Wei Yang
2019-06-05 13:37 ` Wei Yang [this message]
2019-06-06 10:32 ` [Qemu-devel] [PULL 0/5] Migration patches Peter Maydell
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=20190605133722.gjgqraifq53pdv6s@master \
--to=richard.weiyang@gmail.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richardw.yang@linux.intel.com \
--cc=thuth@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
/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).