From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com,
famz@redhat.com, stefanha@redhat.com, amit.shah@redhat.com,
quintela@redhat.com, mreitz@redhat.com, kwolf@redhat.com,
peter.maydell@linaro.org, den@openvz.org, jsnow@redhat.com,
lirans@il.ibm.com
Subject: Re: [Qemu-devel] [PATCH v10 05/12] migration: introduce postcopy-only pending
Date: Tue, 13 Mar 2018 15:35:14 +0000 [thread overview]
Message-ID: <20180313153513.GG3545@work-vm> (raw)
In-Reply-To: <9bc43da5-027a-cd11-0c13-b9a9432e0fdb@virtuozzo.com>
* Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) wrote:
> 13.03.2018 13:30, Dr. David Alan Gilbert wrote:
> > * Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) wrote:
> > > 12.03.2018 18:30, Dr. David Alan Gilbert wrote:
> > > > * Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) wrote:
> > > > > There would be savevm states (dirty-bitmap) which can migrate only in
> > > > > postcopy stage. The corresponding pending is introduced here.
> > > > >
> > > > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> > > > > ---
> > > [...]
> > >
> > > > > static MigIterateState migration_iteration_run(MigrationState *s)
> > > > > {
> > > > > - uint64_t pending_size, pend_post, pend_nonpost;
> > > > > + uint64_t pending_size, pend_pre, pend_compat, pend_post;
> > > > > bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
> > > > > - qemu_savevm_state_pending(s->to_dst_file, s->threshold_size,
> > > > > - &pend_nonpost, &pend_post);
> > > > > - pending_size = pend_nonpost + pend_post;
> > > > > + qemu_savevm_state_pending(s->to_dst_file, s->threshold_size, &pend_pre,
> > > > > + &pend_compat, &pend_post);
> > > > > + pending_size = pend_pre + pend_compat + pend_post;
> > > > > trace_migrate_pending(pending_size, s->threshold_size,
> > > > > - pend_post, pend_nonpost);
> > > > > + pend_pre, pend_compat, pend_post);
> > > > > if (pending_size && pending_size >= s->threshold_size) {
> > > > > /* Still a significant amount to transfer */
> > > > > if (migrate_postcopy() && !in_postcopy &&
> > > > > - pend_nonpost <= s->threshold_size &&
> > > > > - atomic_read(&s->start_postcopy)) {
> > > > > + pend_pre <= s->threshold_size &&
> > > > > + (atomic_read(&s->start_postcopy) ||
> > > > > + (pend_pre + pend_compat <= s->threshold_size)))
> > > > This change does something different from the description;
> > > > it causes a postcopy_start even if the user never ran the postcopy-start
> > > > command; so sorry, we can't do that; because postcopy for RAM is
> > > > something that users can enable but only switch into when they've given
> > > > up on it completing normally.
> > > >
> > > > However, I guess that leaves you with a problem; which is what happens
> > > > to the system when you've run out of pend_pre+pend_compat but can't
> > > > complete because pend_post is non-0; so I don't know the answer to that.
> > > >
> > > >
> > > Hmm. Here, we go to postcopy only if "pend_pre + pend_compat <=
> > > s->threshold_size". Pre-patch, in this case we will go to
> > > migration_completion(). So, precopy stage is finishing anyway.
> > Right.
> >
> > > So, we want
> > > in this case to finish ram migration like it was finished by
> > > migration_completion(), and then, run postcopy, which will handle only dirty
> > > bitmaps, yes?
> > It's a bit tricky; the first important thing is that we can't change the
> > semantics of the migration without the 'dirty bitmaps'.
> >
> > So then there's the question of how a migration with both
> > postcopy-ram+dirty bitmaps should work; again I don't think we should
> > enter the postcopy-ram phase until start-postcopy is issued.
> >
> > Then there's the 3rd case; dirty-bitmaps but no postcopy-ram; in that
> > case I worry less about the semantics of how you want to do it.
>
> I have an idea:
>
> in postcopy_start(), in ram_has_postcopy() (and may be some other places?),
> check atomic_read(&s->start_postcopy) instead of migrate_postcopy_ram()
We've got to use migrate_postcopy_ram() to decide whether we should do
ram specific things, e.g. send the ram discard data.
I'm wanting to make sure that if we have another full postcopy device
(like RAM, maybe storage say) that we'll just add that in with
migrate_postcopy_whatever().
> then:
>
> 1. behavior without dirty-bitmaps is not changed, as currently we cant go
> into postcopy_start and ram_has_postcopy without s->start_postcopy
> 2. dirty-bitmaps+ram: if user don't set s->start_postcopy, postcopy_start()
> will operate as if migration capability was not enabled, so ram should
> complete its migration
> 3. only dirty-bitmaps: again, postcopy_start() will operate as if migration
> capability was not enabled, so ram should complete its migration
Why can't we just remove the change to the trigger condition in this
patch? Then I think everything works as long as the management layer
does eventually call migration-start-postcopy ?
(It might waste some bandwidth at the point where there's otherwise
nothing left to send).
Even with the use of migrate-start-postcopy, you're going to need to be
careful about the higher level story; you need to document when to do it
and what the higher levels should do after a migration failure - at the
moment they know that once postcopy starts migration is irrecoverable if
it fails; I suspect that's not true with your dirty bitmaps.
IMHO this still comes back to my original observation from ~18months ago
that in many ways this isn't very postcopy like; in the sense that all
the semantics are quite different from RAM.
Dave
> >
> > > Hmm2. Looked through migration_completion(), I don't understand, how it
> > > finishes ram migration without postcopy. It calls
> > > qemu_savevm_state_complete_precopy(), which skips states with
> > > has_postcopy=true, which is ram...
> > Because savevm_state_complete_precopy only skips has_postcopy=true in
> > the in_postcopy case:
> >
> > (in_postcopy && se->ops->has_postcopy &&
> > se->ops->has_postcopy(se->opaque)) ||
> >
> > so when we call it in migration_completion(), if we've not entered
> > postcopy yet, then that test doesn't trigger.
> >
> > (Apologies for not spotting this earlier; but I thought this patch was
> > a nice easy one just adding the postcopy_only_pending - I didn't realise it changed
> > existing semantics until I spotted that)
>
> oh, yes, I was inattentive :(
>
> >
> > Dave
> >
> > > --
> > > Best regards,
> > > Vladimir
> > >
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
>
> --
> Best regards,
> Vladimir
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2018-03-13 15:35 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 15:58 [Qemu-devel] [PATCH v10 00/12] Dirty bitmaps postcopy migration Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 01/12] block/dirty-bitmap: add bdrv_dirty_bitmap_enable_successor() Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 02/12] block/dirty-bitmap: fix locking in bdrv_reclaim_dirty_bitmap Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 03/12] block/dirty-bitmap: add _locked version of bdrv_reclaim_dirty_bitmap Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 04/12] dirty-bitmap: add locked state Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 05/12] migration: introduce postcopy-only pending Vladimir Sementsov-Ogievskiy
2018-03-12 15:30 ` Dr. David Alan Gilbert
2018-03-13 5:38 ` John Snow
2018-03-13 12:17 ` Dr. David Alan Gilbert
2018-03-13 7:47 ` Vladimir Sementsov-Ogievskiy
2018-03-13 10:30 ` Dr. David Alan Gilbert
2018-03-13 13:11 ` Vladimir Sementsov-Ogievskiy
2018-03-13 13:32 ` Vladimir Sementsov-Ogievskiy
2018-03-13 15:35 ` Dr. David Alan Gilbert [this message]
2018-03-13 16:14 ` Vladimir Sementsov-Ogievskiy
2018-03-13 16:16 ` John Snow
2018-03-13 16:33 ` Vladimir Sementsov-Ogievskiy
2018-03-13 17:10 ` John Snow
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 06/12] qapi: add dirty-bitmaps migration capability Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 07/12] migration: include migrate_dirty_bitmaps in migrate_postcopy Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 08/12] migration/qemu-file: add qemu_put_counted_string() Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 09/12] migration: add is_active_iterate handler Vladimir Sementsov-Ogievskiy
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 10/12] migration: add postcopy migration of dirty bitmaps Vladimir Sementsov-Ogievskiy
2018-03-12 16:09 ` Dr. David Alan Gilbert
2018-03-13 16:59 ` Vladimir Sementsov-Ogievskiy
2018-03-13 18:02 ` Dr. David Alan Gilbert
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 11/12] iotests: add dirty bitmap migration test Vladimir Sementsov-Ogievskiy
2018-03-12 16:19 ` Dr. David Alan Gilbert
2018-02-07 15:58 ` [Qemu-devel] [PATCH v10 12/12] iotests: add dirty bitmap postcopy test Vladimir Sementsov-Ogievskiy
2018-03-12 16:24 ` Dr. David Alan Gilbert
2018-02-15 9:38 ` [Qemu-devel] ping Re: [PATCH v10 00/12] Dirty bitmaps postcopy migration Vladimir Sementsov-Ogievskiy
2018-02-16 15:03 ` [Qemu-devel] " Vladimir Sementsov-Ogievskiy
2018-03-02 13:05 ` [Qemu-devel] ping " Vladimir Sementsov-Ogievskiy
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=20180313153513.GG3545@work-vm \
--to=dgilbert@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=lirans@il.ibm.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).