All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: kwolf@redhat.com,
	"juan quin >> Juan Jose Quintela Carreira" <quintela@redhat.com>,
	qemu-devel@nongnu.org,
	Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com>,
	stefanha@redhat.com, amit Shah <amit.shah@redhat.com>,
	den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 2/9] block-migration: fix pending() return value
Date: Fri, 9 Jan 2015 19:01:35 +0000	[thread overview]
Message-ID: <20150109190135.GB4309@work-vm> (raw)
In-Reply-To: <54AEF48F.6010405@redhat.com>

* John Snow (jsnow@redhat.com) wrote:
> 
> 
> On 12/11/2014 09:17 AM, Vladimir Sementsov-Ogievskiy wrote:
> >Because of wrong return value of .save_live_pending() in
> >block-migration, migration finishes before the whole disk
> >is transferred. Such situation occures when the migration
> (occurs)
> >process is fast enouth, for example when source and dest
> (enough)
> >are on the same host.
> >
> >If in the bulk phase we return something < max_size, we will skip
> >transferring the tail of the device. Currently we have "set pending to
> >BLOCK_SIZE if it is zero" for bulk phase, but there no guarantee, that
> >it will be < max_size.
> >
> >True approach is to return, for example, max_size+1 when we are in the
> >bulk phase.
> >
> >Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@parallels.com>
> >---
> >  block-migration.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/block-migration.c b/block-migration.c
> >index 6f3aa18..8df30d9 100644
> >--- a/block-migration.c
> >+++ b/block-migration.c
> >@@ -757,8 +757,8 @@ static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
> >                         block_mig_state.read_done * BLOCK_SIZE;
> >
> >      /* Report at least one block pending during bulk phase */
> >-    if (pending == 0 && !block_mig_state.bulk_completed) {
> >-        pending = BLOCK_SIZE;
> >+    if (pending <= max_size && !block_mig_state.bulk_completed) {
> >+        pending = max_size + BLOCK_SIZE;
> >      }
> >      blk_mig_unlock();
> >      qemu_mutex_unlock_iothread();
> >
> 
> This looks sane to me, but I am CC'ing the Migration maintainers to give it
> a proper look.
> 
> Looks to me like this is to prevent this from happening, in
> migration/migration.c:
> 
>             pending_size = qemu_savevm_state_pending(s->file, max_size);
>             trace_migrate_pending(pending_size, max_size);
>             if (pending_size && pending_size >= max_size) {
> 
> If we fail that condition, we omit data because we do not call
> qemu_savevm_state_iterate.

Yes, I think this is safe, it doesn't feel nice, but it's safe, and I don't
know of a nicer way unless that is it could calculate the actual amount of
pending data.
The other thing that would feel safe would be to make the _complete handler
check to see if the bulk stage has completed and if it hasn't complete it.

Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-01-09 19:01 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 14:17 [Qemu-devel] [PATCH 0/8] Dirty bitmaps migration Vladimir Sementsov-Ogievskiy
2014-12-11 14:17 ` [Qemu-devel] [PATCH 1/9] block: rename bdrv_reset_dirty_bitmap Vladimir Sementsov-Ogievskiy
2015-01-08 21:19   ` John Snow
2014-12-11 14:17 ` [Qemu-devel] [PATCH 2/9] block-migration: fix pending() return value Vladimir Sementsov-Ogievskiy
2015-01-08 21:20   ` John Snow
2015-01-09 19:01     ` Dr. David Alan Gilbert [this message]
2014-12-11 14:17 ` [Qemu-devel] [PATCH 3/9] block: fix spoiling all dirty bitmaps by mirror and migration Vladimir Sementsov-Ogievskiy
2015-01-08 21:20   ` John Snow
2014-12-11 14:17 ` [Qemu-devel] [PATCH 4/9] hbitmap: store / restore Vladimir Sementsov-Ogievskiy
2015-01-08 21:21   ` John Snow
2015-01-08 21:37     ` Paolo Bonzini
2015-01-13 12:59     ` Vladimir Sementsov-Ogievskiy
2015-01-13 17:08       ` John Snow
2015-01-14 10:29         ` Vladimir Sementsov-Ogievskiy
2014-12-11 14:17 ` [Qemu-devel] [PATCH 5/9] block: BdrvDirtyBitmap store/restore interface Vladimir Sementsov-Ogievskiy
2015-01-08 21:22   ` John Snow
2015-01-14 11:27   ` Vladimir Sementsov-Ogievskiy
2014-12-11 14:17 ` [Qemu-devel] [PATCH 6/9] block-migration: tiny refactoring Vladimir Sementsov-Ogievskiy
2015-01-08 21:23   ` John Snow
2015-01-14 12:26     ` Vladimir Sementsov-Ogievskiy
2015-01-14 16:53       ` John Snow
2014-12-11 14:17 ` [Qemu-devel] [PATCH 7/9] block-migration: remove not needed iothread lock Vladimir Sementsov-Ogievskiy
2015-01-08 21:24   ` John Snow
2015-01-16 12:54     ` Vladimir Sementsov-Ogievskiy
2015-01-08 22:28   ` Paolo Bonzini
2015-01-16 13:03     ` Vladimir Sementsov-Ogievskiy
2014-12-11 14:17 ` [Qemu-devel] [PATCH 8/9] migration: add dirty parameter Vladimir Sementsov-Ogievskiy
2014-12-11 15:18   ` Eric Blake
2014-12-15  8:33     ` Vladimir Sementsov-Ogievskiy
2015-01-08 21:51   ` John Snow
2015-01-08 22:29     ` Eric Blake
2015-01-08 22:31       ` John Snow
2015-01-08 22:37     ` Paolo Bonzini
2014-12-11 14:17 ` [Qemu-devel] [PATCH 9/9] block-migration: add named dirty bitmaps migration Vladimir Sementsov-Ogievskiy
2015-01-08 22:05   ` John Snow
2015-01-17 17:17     ` Vladimir Sementsov-Ogievskiy
2015-01-20 17:25       ` John Snow
2015-01-08 22:36   ` Paolo Bonzini
2015-01-08 22:45     ` Eric Blake
2015-01-08 22:49       ` Paolo Bonzini
2015-01-12 14:20     ` Vladimir Sementsov-Ogievskiy
2015-01-12 14:42       ` Paolo Bonzini
2015-01-12 16:48   ` Paolo Bonzini
2015-01-12 17:31     ` John Snow
2015-01-12 19:09       ` Paolo Bonzini
2015-01-13  9:16         ` Vladimir Sementsov-Ogievskiy
2015-01-13 16:35           ` John Snow

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=20150109190135.GB4309@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@parallels.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.