From: Peter Xu <peterx@redhat.com>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH] migratioin/ram.c: reset complete_round when we gets a queued page
Date: Wed, 5 Jun 2019 17:38:19 +0800 [thread overview]
Message-ID: <20190605093819.GL15459@xz-x1> (raw)
In-Reply-To: <20190605085207.GA1804@richard>
On Wed, Jun 05, 2019 at 04:52:07PM +0800, Wei Yang wrote:
> On Wed, Jun 05, 2019 at 02:41:08PM +0800, Peter Xu wrote:
> >On Wed, Jun 05, 2019 at 09:08:28AM +0800, Wei Yang wrote:
> >> In case we gets a queued page, the order of block is interrupted. We may
> >> not rely on the complete_round flag to say we have already searched the
> >> whole blocks on the list.
> >>
> >> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> >> ---
> >> migration/ram.c | 6 ++++++
> >> 1 file changed, 6 insertions(+)
> >>
> >> diff --git a/migration/ram.c b/migration/ram.c
> >> index d881981876..e9b40d636d 100644
> >> --- a/migration/ram.c
> >> +++ b/migration/ram.c
> >> @@ -2290,6 +2290,12 @@ static bool get_queued_page(RAMState *rs, PageSearchStatus *pss)
> >> */
> >> pss->block = block;
> >> pss->page = offset >> TARGET_PAGE_BITS;
> >> +
> >> + /*
> >> + * This unqueued page would break the "one round" check, even is
> >> + * really rare.
> >
> >Why this is needed? Could you help explain the problem first?
>
> Peter, Thanks for your question.
>
> I found this issue during code review and I believe this is a corner case.
>
> Below is a draft chart for ram_find_and_save_block:
>
> ram_find_and_save_block
> do
> get_queued_page()
> find_dirty_block()
> ram_save_host_page()
> while
>
> The basic logic here is : get a page need to migrate and migrate it.
>
> In case we don't have get_queued_page(), find_dirty_block() will search the
> whole ram_list.blocks by order. pss->complete_round is used to indicate
> whether this search has looped.
>
> Everything works fine after get_queued_page() involved. The block unqueued in
> get_queued_page() could be any block in the ram_list.blocks. This means we
> have very little chance to break the looped indicator.
>
> unqueue_page() last_seen_block
> | |
> ram_list.blocks v v
> ---------------------------------+=====+---
>
>
> Just draw a raw picture to demonstrate a corner case.
>
> For example, we start from last_seen_block and search till the end of
> ram_list.blocks. At this moment, pss->complete_round is set to true. Then we
> get a queued page from unqueue_page() at the point I pointed. So the loop
> continues may just continue the range as I marked as "=". We will skip all the
> other ranges.
Ah I see your point, but I don't think there is a problem - note that
complete_round will be reset for each ram_find_and_save_block(), so
even if we have that iteration of ram_find_and_save_block() to return
we'll still know we have dirty pages to migrate and in the next call
we'll be fine, no?
--
Peter Xu
next prev parent reply other threads:[~2019-06-05 9:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 1:08 [Qemu-devel] [PATCH] migratioin/ram.c: reset complete_round when we gets a queued page Wei Yang
2019-06-05 6:41 ` Peter Xu
2019-06-05 8:52 ` Wei Yang
2019-06-05 9:38 ` Peter Xu [this message]
2019-06-05 10:33 ` Juan Quintela
2019-06-05 13:39 ` Wei Yang
2019-06-05 13:41 ` Wei Yang
2019-06-05 12:27 ` Philippe Mathieu-Daudé
2019-06-05 13:39 ` Wei Yang
2019-06-05 14:11 ` Philippe Mathieu-Daudé
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=20190605093819.GL15459@xz-x1 \
--to=peterx@redhat.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richardw.yang@linux.intel.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).