All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] migrate -b problems
@ 2017-04-12  9:18 Kevin Wolf
  2017-04-12  9:51 ` 858585 jemmy
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Kevin Wolf @ 2017-04-12  9:18 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, stefanha, famz, quintela, dgilbert

Hi all,

after getting assertion failure reports for block migration in the last
minute, we just hacked around it by commenting out op blocker assertions
for the 2.9 release, but now we need to see how to fix things properly.
Luckily, get_maintainer.pl doesn't report me, but only you. :-)

The main problem I see with the block migration code (on the
destination) is that it abuses the BlockBackend that belongs to the
guest device to make its own writes to the image file. If the guest
isn't allowed to write to the image (which it now isn't during incoming
migration since it would conflict with the newer style of block
migration using an NBD server), writing to this BlockBackend doesn't
work any more.

So what should really happen is that incoming block migration creates
its own BlockBackend for writing to the image. Now we don't want to do
this anew for every incoming block, but ideally we'd just create all
necessary BlockBackends upfront and then keep using them throughout the
whole migration. Is there a way to get some setup/teardown callbacks
at the start/end of the migration that could initialise and free such
global data?

The other problem with block migration is that is uses a BlockBackend
name to identify which device is migrated. However, there can be images
that are not attached to any BlockBackend, or if it is, the BlockBackend
might be anonymous, so this doesn't work. I suppose changing the field
to "device name if available, node-name otherwise" would solve this.

Kevin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] migrate -b problems
  2017-04-12  9:18 [Qemu-devel] migrate -b problems Kevin Wolf
@ 2017-04-12  9:51 ` 858585 jemmy
  2017-04-18 14:40   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  2017-04-18 12:22 ` [Qemu-devel] " Juan Quintela
  2017-04-18 14:47 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  2 siblings, 1 reply; 12+ messages in thread
From: 858585 jemmy @ 2017-04-12  9:51 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: qemu-block, dgilbert, Fam Zheng, qemu-devel, Stefan Hajnoczi, quintela

it this bug?
https://bugs.launchpad.net/qemu/+bug/1681688

On Wed, Apr 12, 2017 at 5:18 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Hi all,
>
> after getting assertion failure reports for block migration in the last
> minute, we just hacked around it by commenting out op blocker assertions
> for the 2.9 release, but now we need to see how to fix things properly.
> Luckily, get_maintainer.pl doesn't report me, but only you. :-)
>
> The main problem I see with the block migration code (on the
> destination) is that it abuses the BlockBackend that belongs to the
> guest device to make its own writes to the image file. If the guest
> isn't allowed to write to the image (which it now isn't during incoming
> migration since it would conflict with the newer style of block
> migration using an NBD server), writing to this BlockBackend doesn't
> work any more.
>
> So what should really happen is that incoming block migration creates
> its own BlockBackend for writing to the image. Now we don't want to do
> this anew for every incoming block, but ideally we'd just create all
> necessary BlockBackends upfront and then keep using them throughout the
> whole migration. Is there a way to get some setup/teardown callbacks
> at the start/end of the migration that could initialise and free such
> global data?
>
> The other problem with block migration is that is uses a BlockBackend
> name to identify which device is migrated. However, there can be images
> that are not attached to any BlockBackend, or if it is, the BlockBackend
> might be anonymous, so this doesn't work. I suppose changing the field
> to "device name if available, node-name otherwise" would solve this.
>
> Kevin
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] migrate -b problems
  2017-04-12  9:18 [Qemu-devel] migrate -b problems Kevin Wolf
  2017-04-12  9:51 ` 858585 jemmy
@ 2017-04-18 12:22 ` Juan Quintela
  2017-04-18 14:47 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
  2 siblings, 0 replies; 12+ messages in thread
From: Juan Quintela @ 2017-04-18 12:22 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, qemu-devel, stefanha, famz, dgilbert

Kevin Wolf <kwolf@redhat.com> wrote:
> Hi all,

Hi

> after getting assertion failure reports for block migration in the last
> minute, we just hacked around it by commenting out op blocker assertions
> for the 2.9 release, but now we need to see how to fix things properly.
> Luckily, get_maintainer.pl doesn't report me, but only you. :-)

migration/block.c  is a classic.  Anyone that touches it last is the
maintainer.


> The main problem I see with the block migration code (on the
> destination) is that it abuses the BlockBackend that belongs to the
> guest device to make its own writes to the image file. If the guest
> isn't allowed to write to the image (which it now isn't during incoming
> migration since it would conflict with the newer style of block
> migration using an NBD server), writing to this BlockBackend doesn't
> work any more.
>
> So what should really happen is that incoming block migration creates
> its own BlockBackend for writing to the image. Now we don't want to do
> this anew for every incoming block, but ideally we'd just create all
> necessary BlockBackends upfront and then keep using them throughout the
> whole migration. Is there a way to get some setup/teardown callbacks
> at the start/end of the migration that could initialise and free such
> global data?

Two answers:

- Easy one (for me).  look at how spice/qxl use migration notifiers (no,
  it is not pretty, but its what is already done).

- More difficult
  I am trying to get an easier to use way migration notifiers.  What we
  need is to be able to schedule:
     - when we start a migration
        * this thing that you need
     - when we finish a migration (either complete, error or cancel)
        * basically to do a free
        * or spice to handle the screen seamlesly to the new client
     - when we are about to start last stage of migration
        * so devices can write things to memory
          Look at new arm GIC (or PIC) or whatever on the list

And probably something more that I haven't yet think about.

> The other problem with block migration is that is uses a BlockBackend
> name to identify which device is migrated. However, there can be images
> that are not attached to any BlockBackend, or if it is, the BlockBackend
> might be anonymous, so this doesn't work. I suppose changing the field
> to "device name if available, node-name otherwise" would solve this.

That is above my knowledge.

Later, Juan.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block]  migrate -b problems
  2017-04-12  9:51 ` 858585 jemmy
@ 2017-04-18 14:40   ` Stefan Hajnoczi
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2017-04-18 14:40 UTC (permalink / raw)
  To: 858585 jemmy
  Cc: Kevin Wolf, Fam Zheng, qemu-block, quintela, dgilbert,
	qemu-devel, Stefan Hajnoczi

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

On Wed, Apr 12, 2017 at 05:51:23PM +0800, 858585 jemmy wrote:
> it this bug?
> https://bugs.launchpad.net/qemu/+bug/1681688

Yes.  This discussion is about the long-term fix instead of a short-term
hack for QEMU 2.9.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-12  9:18 [Qemu-devel] migrate -b problems Kevin Wolf
  2017-04-12  9:51 ` 858585 jemmy
  2017-04-18 12:22 ` [Qemu-devel] " Juan Quintela
@ 2017-04-18 14:47 ` Stefan Hajnoczi
  2017-04-18 15:32   ` Kevin Wolf
  2 siblings, 1 reply; 12+ messages in thread
From: Stefan Hajnoczi @ 2017-04-18 14:47 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-block, dgilbert, famz, qemu-devel, stefanha, quintela

[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]

On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> after getting assertion failure reports for block migration in the last
> minute, we just hacked around it by commenting out op blocker assertions
> for the 2.9 release, but now we need to see how to fix things properly.
> Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> 
> The main problem I see with the block migration code (on the
> destination) is that it abuses the BlockBackend that belongs to the
> guest device to make its own writes to the image file. If the guest
> isn't allowed to write to the image (which it now isn't during incoming
> migration since it would conflict with the newer style of block
> migration using an NBD server), writing to this BlockBackend doesn't
> work any more.
> 
> So what should really happen is that incoming block migration creates
> its own BlockBackend for writing to the image. Now we don't want to do
> this anew for every incoming block, but ideally we'd just create all
> necessary BlockBackends upfront and then keep using them throughout the
> whole migration. Is there a way to get some setup/teardown callbacks
> at the start/end of the migration that could initialise and free such
> global data?

It can be done in the beginning of block_load() similar to
block_mig_state.bmds_list, which is created in init_blk_migration() at
save time.

We can also move the if (blk != blk_prev) blk_invalidate_cache() code
out of the load loop.  It should be done once when setting up
BlockBackends.

> The other problem with block migration is that is uses a BlockBackend
> name to identify which device is migrated. However, there can be images
> that are not attached to any BlockBackend, or if it is, the BlockBackend
> might be anonymous, so this doesn't work. I suppose changing the field
> to "device name if available, node-name otherwise" would solve this.

Yes, that sounds good and is backwards compatible.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-18 14:47 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
@ 2017-04-18 15:32   ` Kevin Wolf
  2017-04-19  9:14     ` Stefan Hajnoczi
  2017-04-19 11:13     ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 12+ messages in thread
From: Kevin Wolf @ 2017-04-18 15:32 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-block, dgilbert, famz, qemu-devel, stefanha, quintela

[-- Attachment #1: Type: text/plain, Size: 3032 bytes --]

Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> > after getting assertion failure reports for block migration in the last
> > minute, we just hacked around it by commenting out op blocker assertions
> > for the 2.9 release, but now we need to see how to fix things properly.
> > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> > 
> > The main problem I see with the block migration code (on the
> > destination) is that it abuses the BlockBackend that belongs to the
> > guest device to make its own writes to the image file. If the guest
> > isn't allowed to write to the image (which it now isn't during incoming
> > migration since it would conflict with the newer style of block
> > migration using an NBD server), writing to this BlockBackend doesn't
> > work any more.
> > 
> > So what should really happen is that incoming block migration creates
> > its own BlockBackend for writing to the image. Now we don't want to do
> > this anew for every incoming block, but ideally we'd just create all
> > necessary BlockBackends upfront and then keep using them throughout the
> > whole migration. Is there a way to get some setup/teardown callbacks
> > at the start/end of the migration that could initialise and free such
> > global data?
> 
> It can be done in the beginning of block_load() similar to
> block_mig_state.bmds_list, which is created in init_blk_migration() at
> save time.

The difference is that block_load() is the counterpart for
block_save_iterate(), not for init_blk_migration(). That is, it is
called for each chunk of block migration data, which is interleaved with
normal RAM migration chunks.

So we can either create each BlockBackend the first time we need it in
block_load(), or create BlockBackends for all existing device BBs and
BDSes the first time block_load() is called. We still need some place
to actually free the BlockBackends again when the migration completes.

Dave suggested migration state notifiers, which looked like an option,
but at least the existing migration states aren't enough, because the
BlockBackends need to go away before blk_resume_after_migration() is
called, but MIGRATION_STATUS_COMPLETED is set only afterwards.

> We can also move the if (blk != blk_prev) blk_invalidate_cache() code
> out of the load loop.  It should be done once when setting up
> BlockBackends.

Same problem as above, while saving has setup/cleanup callbacks, we only
have the iterate callback for loading.

> > The other problem with block migration is that is uses a BlockBackend
> > name to identify which device is migrated. However, there can be images
> > that are not attached to any BlockBackend, or if it is, the BlockBackend
> > might be anonymous, so this doesn't work. I suppose changing the field
> > to "device name if available, node-name otherwise" would solve this.
> 
> Yes, that sounds good and is backwards compatible.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-18 15:32   ` Kevin Wolf
@ 2017-04-19  9:14     ` Stefan Hajnoczi
  2017-04-19 11:13     ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2017-04-19  9:14 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Stefan Hajnoczi, qemu-block, dgilbert, famz, qemu-devel, quintela

[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]

On Tue, Apr 18, 2017 at 05:32:56PM +0200, Kevin Wolf wrote:
> Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> > > after getting assertion failure reports for block migration in the last
> > > minute, we just hacked around it by commenting out op blocker assertions
> > > for the 2.9 release, but now we need to see how to fix things properly.
> > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> > > 
> > > The main problem I see with the block migration code (on the
> > > destination) is that it abuses the BlockBackend that belongs to the
> > > guest device to make its own writes to the image file. If the guest
> > > isn't allowed to write to the image (which it now isn't during incoming
> > > migration since it would conflict with the newer style of block
> > > migration using an NBD server), writing to this BlockBackend doesn't
> > > work any more.
> > > 
> > > So what should really happen is that incoming block migration creates
> > > its own BlockBackend for writing to the image. Now we don't want to do
> > > this anew for every incoming block, but ideally we'd just create all
> > > necessary BlockBackends upfront and then keep using them throughout the
> > > whole migration. Is there a way to get some setup/teardown callbacks
> > > at the start/end of the migration that could initialise and free such
> > > global data?
> > 
> > It can be done in the beginning of block_load() similar to
> > block_mig_state.bmds_list, which is created in init_blk_migration() at
> > save time.
> 
> The difference is that block_load() is the counterpart for
> block_save_iterate(), not for init_blk_migration(). That is, it is
> called for each chunk of block migration data, which is interleaved with
> normal RAM migration chunks.
> 
> So we can either create each BlockBackend the first time we need it in
> block_load(), or create BlockBackends for all existing device BBs and
> BDSes the first time block_load() is called. We still need some place
> to actually free the BlockBackends again when the migration completes.
> 
> Dave suggested migration state notifiers, which looked like an option,
> but at least the existing migration states aren't enough, because the
> BlockBackends need to go away before blk_resume_after_migration() is
> called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
> 
> > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
> > out of the load loop.  It should be done once when setting up
> > BlockBackends.
> 
> Same problem as above, while saving has setup/cleanup callbacks, we only
> have the iterate callback for loading.

I see what you are saying.  setup/cleanups need to be added to
SaveVMHandlers.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-18 15:32   ` Kevin Wolf
  2017-04-19  9:14     ` Stefan Hajnoczi
@ 2017-04-19 11:13     ` Dr. David Alan Gilbert
  2017-04-19 11:18       ` Juan Quintela
  2017-04-19 12:32       ` Kevin Wolf
  1 sibling, 2 replies; 12+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 11:13 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Stefan Hajnoczi, qemu-block, famz, qemu-devel, stefanha, quintela

* Kevin Wolf (kwolf@redhat.com) wrote:
> Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> > > after getting assertion failure reports for block migration in the last
> > > minute, we just hacked around it by commenting out op blocker assertions
> > > for the 2.9 release, but now we need to see how to fix things properly.
> > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> > > 
> > > The main problem I see with the block migration code (on the
> > > destination) is that it abuses the BlockBackend that belongs to the
> > > guest device to make its own writes to the image file. If the guest
> > > isn't allowed to write to the image (which it now isn't during incoming
> > > migration since it would conflict with the newer style of block
> > > migration using an NBD server), writing to this BlockBackend doesn't
> > > work any more.
> > > 
> > > So what should really happen is that incoming block migration creates
> > > its own BlockBackend for writing to the image. Now we don't want to do
> > > this anew for every incoming block, but ideally we'd just create all
> > > necessary BlockBackends upfront and then keep using them throughout the
> > > whole migration. Is there a way to get some setup/teardown callbacks
> > > at the start/end of the migration that could initialise and free such
> > > global data?
> > 
> > It can be done in the beginning of block_load() similar to
> > block_mig_state.bmds_list, which is created in init_blk_migration() at
> > save time.
> 
> The difference is that block_load() is the counterpart for
> block_save_iterate(), not for init_blk_migration(). That is, it is
> called for each chunk of block migration data, which is interleaved with
> normal RAM migration chunks.
> 
> So we can either create each BlockBackend the first time we need it in
> block_load(), or create BlockBackends for all existing device BBs and
> BDSes the first time block_load() is called. We still need some place
> to actually free the BlockBackends again when the migration completes.
> 
> Dave suggested migration state notifiers, which looked like an option,
> but at least the existing migration states aren't enough, because the
> BlockBackends need to go away before blk_resume_after_migration() is
> called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
> 
> > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
> > out of the load loop.  It should be done once when setting up
> > BlockBackends.
> 
> Same problem as above, while saving has setup/cleanup callbacks, we only
> have the iterate callback for loading.


Yes, and while we have the notifier chain for the source on migration state
changes we don't have the notifier on the destination.

If we just add a load_cleanup  member to SaveVMHandlers and call all of them
at the end of an inbound migration would that be enough?
(And define 'end')

Dave

> > > The other problem with block migration is that is uses a BlockBackend
> > > name to identify which device is migrated. However, there can be images
> > > that are not attached to any BlockBackend, or if it is, the BlockBackend
> > > might be anonymous, so this doesn't work. I suppose changing the field
> > > to "device name if available, node-name otherwise" would solve this.
> > 
> > Yes, that sounds good and is backwards compatible.
> 
> Kevin


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-19 11:13     ` Dr. David Alan Gilbert
@ 2017-04-19 11:18       ` Juan Quintela
  2017-04-19 11:20         ` Dr. David Alan Gilbert
  2017-04-19 12:32       ` Kevin Wolf
  1 sibling, 1 reply; 12+ messages in thread
From: Juan Quintela @ 2017-04-19 11:18 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Kevin Wolf, Stefan Hajnoczi, qemu-block, famz, qemu-devel, stefanha

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Kevin Wolf (kwolf@redhat.com) wrote:
>> Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
>> > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
>> > > after getting assertion failure reports for block migration in the last
>> > > minute, we just hacked around it by commenting out op blocker assertions
>> > > for the 2.9 release, but now we need to see how to fix things properly.
>> > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
>> > > 
>> > > The main problem I see with the block migration code (on the
>> > > destination) is that it abuses the BlockBackend that belongs to the
>> > > guest device to make its own writes to the image file. If the guest
>> > > isn't allowed to write to the image (which it now isn't during incoming
>> > > migration since it would conflict with the newer style of block
>> > > migration using an NBD server), writing to this BlockBackend doesn't
>> > > work any more.
>> > > 
>> > > So what should really happen is that incoming block migration creates
>> > > its own BlockBackend for writing to the image. Now we don't want to do
>> > > this anew for every incoming block, but ideally we'd just create all
>> > > necessary BlockBackends upfront and then keep using them throughout the
>> > > whole migration. Is there a way to get some setup/teardown callbacks
>> > > at the start/end of the migration that could initialise and free such
>> > > global data?
>> > 
>> > It can be done in the beginning of block_load() similar to
>> > block_mig_state.bmds_list, which is created in init_blk_migration() at
>> > save time.
>> 
>> The difference is that block_load() is the counterpart for
>> block_save_iterate(), not for init_blk_migration(). That is, it is
>> called for each chunk of block migration data, which is interleaved with
>> normal RAM migration chunks.
>> 
>> So we can either create each BlockBackend the first time we need it in
>> block_load(), or create BlockBackends for all existing device BBs and
>> BDSes the first time block_load() is called. We still need some place
>> to actually free the BlockBackends again when the migration completes.
>> 
>> Dave suggested migration state notifiers, which looked like an option,
>> but at least the existing migration states aren't enough, because the
>> BlockBackends need to go away before blk_resume_after_migration() is
>> called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
>> 
>> > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
>> > out of the load loop.  It should be done once when setting up
>> > BlockBackends.
>> 
>> Same problem as above, while saving has setup/cleanup callbacks, we only
>> have the iterate callback for loading.
>
>
> Yes, and while we have the notifier chain for the source on migration state
> changes we don't have the notifier on the destination.
>
> If we just add a load_cleanup  member to SaveVMHandlers and call all of them
> at the end of an inbound migration would that be enough?
> (And define 'end')

We already have a setup() one, that should be enough, no?
We also need a cleanup() one, that is what I am going to add.

Anything else that is needed for this particular problem?

Thanks, Juan.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-19 11:18       ` Juan Quintela
@ 2017-04-19 11:20         ` Dr. David Alan Gilbert
  2017-04-19 11:55           ` Juan Quintela
  0 siblings, 1 reply; 12+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 11:20 UTC (permalink / raw)
  To: Juan Quintela
  Cc: Kevin Wolf, Stefan Hajnoczi, qemu-block, famz, qemu-devel, stefanha

* Juan Quintela (quintela@redhat.com) wrote:
> "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> > * Kevin Wolf (kwolf@redhat.com) wrote:
> >> Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> >> > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> >> > > after getting assertion failure reports for block migration in the last
> >> > > minute, we just hacked around it by commenting out op blocker assertions
> >> > > for the 2.9 release, but now we need to see how to fix things properly.
> >> > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> >> > > 
> >> > > The main problem I see with the block migration code (on the
> >> > > destination) is that it abuses the BlockBackend that belongs to the
> >> > > guest device to make its own writes to the image file. If the guest
> >> > > isn't allowed to write to the image (which it now isn't during incoming
> >> > > migration since it would conflict with the newer style of block
> >> > > migration using an NBD server), writing to this BlockBackend doesn't
> >> > > work any more.
> >> > > 
> >> > > So what should really happen is that incoming block migration creates
> >> > > its own BlockBackend for writing to the image. Now we don't want to do
> >> > > this anew for every incoming block, but ideally we'd just create all
> >> > > necessary BlockBackends upfront and then keep using them throughout the
> >> > > whole migration. Is there a way to get some setup/teardown callbacks
> >> > > at the start/end of the migration that could initialise and free such
> >> > > global data?
> >> > 
> >> > It can be done in the beginning of block_load() similar to
> >> > block_mig_state.bmds_list, which is created in init_blk_migration() at
> >> > save time.
> >> 
> >> The difference is that block_load() is the counterpart for
> >> block_save_iterate(), not for init_blk_migration(). That is, it is
> >> called for each chunk of block migration data, which is interleaved with
> >> normal RAM migration chunks.
> >> 
> >> So we can either create each BlockBackend the first time we need it in
> >> block_load(), or create BlockBackends for all existing device BBs and
> >> BDSes the first time block_load() is called. We still need some place
> >> to actually free the BlockBackends again when the migration completes.
> >> 
> >> Dave suggested migration state notifiers, which looked like an option,
> >> but at least the existing migration states aren't enough, because the
> >> BlockBackends need to go away before blk_resume_after_migration() is
> >> called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
> >> 
> >> > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
> >> > out of the load loop.  It should be done once when setting up
> >> > BlockBackends.
> >> 
> >> Same problem as above, while saving has setup/cleanup callbacks, we only
> >> have the iterate callback for loading.
> >
> >
> > Yes, and while we have the notifier chain for the source on migration state
> > changes we don't have the notifier on the destination.
> >
> > If we just add a load_cleanup  member to SaveVMHandlers and call all of them
> > at the end of an inbound migration would that be enough?
> > (And define 'end')
> 
> We already have a setup() one, that should be enough, no?
> We also need a cleanup() one, that is what I am going to add.

We need it on the *destination* there's no setup call on the destination is there?

Dave

> Anything else that is needed for this particular problem?
> 
> Thanks, Juan.
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-19 11:20         ` Dr. David Alan Gilbert
@ 2017-04-19 11:55           ` Juan Quintela
  0 siblings, 0 replies; 12+ messages in thread
From: Juan Quintela @ 2017-04-19 11:55 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Kevin Wolf, Stefan Hajnoczi, qemu-block, famz, qemu-devel, stefanha

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> "Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
>> > * Kevin Wolf (kwolf@redhat.com) wrote:
>> >> Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
>> >> > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
>> >> > > after getting assertion failure reports for block migration in the last
>> >> > > minute, we just hacked around it by commenting out op blocker assertions
>> >> > > for the 2.9 release, but now we need to see how to fix things properly.
>> >> > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
>> >> > > 
>> >> > > The main problem I see with the block migration code (on the
>> >> > > destination) is that it abuses the BlockBackend that belongs to the
>> >> > > guest device to make its own writes to the image file. If the guest
>> >> > > isn't allowed to write to the image (which it now isn't during incoming
>> >> > > migration since it would conflict with the newer style of block
>> >> > > migration using an NBD server), writing to this BlockBackend doesn't
>> >> > > work any more.
>> >> > > 
>> >> > > So what should really happen is that incoming block migration creates
>> >> > > its own BlockBackend for writing to the image. Now we don't want to do
>> >> > > this anew for every incoming block, but ideally we'd just create all
>> >> > > necessary BlockBackends upfront and then keep using them throughout the
>> >> > > whole migration. Is there a way to get some setup/teardown callbacks
>> >> > > at the start/end of the migration that could initialise and free such
>> >> > > global data?
>> >> > 
>> >> > It can be done in the beginning of block_load() similar to
>> >> > block_mig_state.bmds_list, which is created in init_blk_migration() at
>> >> > save time.
>> >> 
>> >> The difference is that block_load() is the counterpart for
>> >> block_save_iterate(), not for init_blk_migration(). That is, it is
>> >> called for each chunk of block migration data, which is interleaved with
>> >> normal RAM migration chunks.
>> >> 
>> >> So we can either create each BlockBackend the first time we need it in
>> >> block_load(), or create BlockBackends for all existing device BBs and
>> >> BDSes the first time block_load() is called. We still need some place
>> >> to actually free the BlockBackends again when the migration completes.
>> >> 
>> >> Dave suggested migration state notifiers, which looked like an option,
>> >> but at least the existing migration states aren't enough, because the
>> >> BlockBackends need to go away before blk_resume_after_migration() is
>> >> called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
>> >> 
>> >> > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
>> >> > out of the load loop.  It should be done once when setting up
>> >> > BlockBackends.
>> >> 
>> >> Same problem as above, while saving has setup/cleanup callbacks, we only
>> >> have the iterate callback for loading.
>> >
>> >
>> > Yes, and while we have the notifier chain for the source on migration state
>> > changes we don't have the notifier on the destination.
>> >
>> > If we just add a load_cleanup  member to SaveVMHandlers and call all of them
>> > at the end of an inbound migration would that be enough?
>> > (And define 'end')
>> 
>> We already have a setup() one, that should be enough, no?
>> We also need a cleanup() one, that is what I am going to add.
>
> We need it on the *destination* there's no setup call on the destination is there?

Ouch.

Ok.  Looking at that then.

Thanks, Juan.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [Qemu-block] migrate -b problems
  2017-04-19 11:13     ` Dr. David Alan Gilbert
  2017-04-19 11:18       ` Juan Quintela
@ 2017-04-19 12:32       ` Kevin Wolf
  1 sibling, 0 replies; 12+ messages in thread
From: Kevin Wolf @ 2017-04-19 12:32 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Stefan Hajnoczi, qemu-block, famz, qemu-devel, stefanha, quintela

Am 19.04.2017 um 13:13 hat Dr. David Alan Gilbert geschrieben:
> * Kevin Wolf (kwolf@redhat.com) wrote:
> > Am 18.04.2017 um 16:47 hat Stefan Hajnoczi geschrieben:
> > > On Wed, Apr 12, 2017 at 11:18:19AM +0200, Kevin Wolf wrote:
> > > > after getting assertion failure reports for block migration in the last
> > > > minute, we just hacked around it by commenting out op blocker assertions
> > > > for the 2.9 release, but now we need to see how to fix things properly.
> > > > Luckily, get_maintainer.pl doesn't report me, but only you. :-)
> > > > 
> > > > The main problem I see with the block migration code (on the
> > > > destination) is that it abuses the BlockBackend that belongs to the
> > > > guest device to make its own writes to the image file. If the guest
> > > > isn't allowed to write to the image (which it now isn't during incoming
> > > > migration since it would conflict with the newer style of block
> > > > migration using an NBD server), writing to this BlockBackend doesn't
> > > > work any more.
> > > > 
> > > > So what should really happen is that incoming block migration creates
> > > > its own BlockBackend for writing to the image. Now we don't want to do
> > > > this anew for every incoming block, but ideally we'd just create all
> > > > necessary BlockBackends upfront and then keep using them throughout the
> > > > whole migration. Is there a way to get some setup/teardown callbacks
> > > > at the start/end of the migration that could initialise and free such
> > > > global data?
> > > 
> > > It can be done in the beginning of block_load() similar to
> > > block_mig_state.bmds_list, which is created in init_blk_migration() at
> > > save time.
> > 
> > The difference is that block_load() is the counterpart for
> > block_save_iterate(), not for init_blk_migration(). That is, it is
> > called for each chunk of block migration data, which is interleaved with
> > normal RAM migration chunks.
> > 
> > So we can either create each BlockBackend the first time we need it in
> > block_load(), or create BlockBackends for all existing device BBs and
> > BDSes the first time block_load() is called. We still need some place
> > to actually free the BlockBackends again when the migration completes.
> > 
> > Dave suggested migration state notifiers, which looked like an option,
> > but at least the existing migration states aren't enough, because the
> > BlockBackends need to go away before blk_resume_after_migration() is
> > called, but MIGRATION_STATUS_COMPLETED is set only afterwards.
> > 
> > > We can also move the if (blk != blk_prev) blk_invalidate_cache() code
> > > out of the load loop.  It should be done once when setting up
> > > BlockBackends.
> > 
> > Same problem as above, while saving has setup/cleanup callbacks, we only
> > have the iterate callback for loading.
> 
> Yes, and while we have the notifier chain for the source on migration state
> changes we don't have the notifier on the destination.
> 
> If we just add a load_cleanup  member to SaveVMHandlers and call all of them
> at the end of an inbound migration would that be enough?
> (And define 'end')

Ideally both setup and cleanup, but yes, cleanup is the one that we
definitely need if we don't want hardcoded calls into block migration
code.

As for the place where to call it, I'd say at the very beginning of
process_incoming_migration_bh(), before bdrv_invalidate_cache_all() (and
at the corresponding place for postcopy, because this is duplicated
code).

Kevin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-04-19 12:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12  9:18 [Qemu-devel] migrate -b problems Kevin Wolf
2017-04-12  9:51 ` 858585 jemmy
2017-04-18 14:40   ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-04-18 12:22 ` [Qemu-devel] " Juan Quintela
2017-04-18 14:47 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-04-18 15:32   ` Kevin Wolf
2017-04-19  9:14     ` Stefan Hajnoczi
2017-04-19 11:13     ` Dr. David Alan Gilbert
2017-04-19 11:18       ` Juan Quintela
2017-04-19 11:20         ` Dr. David Alan Gilbert
2017-04-19 11:55           ` Juan Quintela
2017-04-19 12:32       ` Kevin Wolf

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.