Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Michael S. Tsirkin
On Wed, Oct 06, 2021 at 03:27:59PM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (m...@redhat.com) wrote:
> > On Wed, Oct 06, 2021 at 02:29:37PM +0100, Dr. David Alan Gilbert wrote:
> > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > On Wed, Oct 06, 2021 at 09:43:52AM +0100, Dr. David Alan Gilbert wrote:
> > > > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > > > On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert 
> > > > > > wrote:
> > > > > > > To me it feels the same as the distinction between vhost-kernel 
> > > > > > > and qemu
> > > > > > > backended virtio that we get in net and others - in principal 
> > > > > > > it's just 
> > > > > > > another implementation.
> > > > > > 
> > > > > > In net it's actually like this. Same -device, a different netdev.
> > > > > > 
> > > > > > > A tricky part is guaranteeing the set of visible virtio features 
> > > > > > > between
> > > > > > > implementations; we have that problem when we use vhost-kernel 
> > > > > > > and run
> > > > > > > on a newer/older kernel and gain virtio features; the same will 
> > > > > > > be true
> > > > > > > with vhost-user implementations.
> > > > > > 
> > > > > > That's not new but yes we need to work on this.
> > > > > > 
> > > > > > > But this would make the structure of a vhost-user implementation 
> > > > > > > quite
> > > > > > > different.
> > > > > > > 
> > > > > > > Dave
> > > > > > 
> > > > > > Right. That's why I'm reluctant to just add a new device type that
> > > > > > has special compatibility requirements.
> > > > > 
> > > > > Hmm but there's already another layer of hack^Wabstraction in there 
> > > > > isn't there -
> > > > > there's already:
> > > > > virtio-blk-pci
> > > > > virtio-blk-device
> > > > > 
> > > > > created when the user specifies a virtio-blk device?
> > > > > 
> > > > > Dave
> > > > 
> > > > virtio-*-pci is there because it was felt these devices look
> > > > differently from e.g. virtio-ccw so should have a different name.
> > > > virtio-blk-device is an internal thingy, users and guests have no idea.
> > > 
> > > Right, so to do what we're asking here, should we keep the
> > > virtio-blk-pci and instantiate virtio-blk-vhost-user instead of
> > > virtio-blk-device?
> > > 
> > > Dave
> > 
> > I guess that's possible, but we need to pass a bunch of parameters.
> > -drive is probably the right want to do that, right?
> 
> I'm not sure about -drive - isn't that very tied into the block layer?
> 
> Dave


If not, we'll need to add some other object, and tie it's id to the device.

> > > > 
> > > > > 
> > > > > > > > 
> > > > > > > > > > -- 
> > > > > > > > > > MST
> > > > > > > > > > 
> > > > > > > > > -- 
> > > > > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > > > > 
> > > > > > > -- 
> > > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > > 
> > > > > -- 
> > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > 
> > > -- 
> > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > 
> -- 
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Wed, Oct 06, 2021 at 02:29:37PM +0100, Dr. David Alan Gilbert wrote:
> > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > On Wed, Oct 06, 2021 at 09:43:52AM +0100, Dr. David Alan Gilbert wrote:
> > > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > > On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert 
> > > > > wrote:
> > > > > > To me it feels the same as the distinction between vhost-kernel and 
> > > > > > qemu
> > > > > > backended virtio that we get in net and others - in principal it's 
> > > > > > just 
> > > > > > another implementation.
> > > > > 
> > > > > In net it's actually like this. Same -device, a different netdev.
> > > > > 
> > > > > > A tricky part is guaranteeing the set of visible virtio features 
> > > > > > between
> > > > > > implementations; we have that problem when we use vhost-kernel and 
> > > > > > run
> > > > > > on a newer/older kernel and gain virtio features; the same will be 
> > > > > > true
> > > > > > with vhost-user implementations.
> > > > > 
> > > > > That's not new but yes we need to work on this.
> > > > > 
> > > > > > But this would make the structure of a vhost-user implementation 
> > > > > > quite
> > > > > > different.
> > > > > > 
> > > > > > Dave
> > > > > 
> > > > > Right. That's why I'm reluctant to just add a new device type that
> > > > > has special compatibility requirements.
> > > > 
> > > > Hmm but there's already another layer of hack^Wabstraction in there 
> > > > isn't there -
> > > > there's already:
> > > > virtio-blk-pci
> > > > virtio-blk-device
> > > > 
> > > > created when the user specifies a virtio-blk device?
> > > > 
> > > > Dave
> > > 
> > > virtio-*-pci is there because it was felt these devices look
> > > differently from e.g. virtio-ccw so should have a different name.
> > > virtio-blk-device is an internal thingy, users and guests have no idea.
> > 
> > Right, so to do what we're asking here, should we keep the
> > virtio-blk-pci and instantiate virtio-blk-vhost-user instead of
> > virtio-blk-device?
> > 
> > Dave
> 
> I guess that's possible, but we need to pass a bunch of parameters.
> -drive is probably the right want to do that, right?

I'm not sure about -drive - isn't that very tied into the block layer?

Dave

> > > 
> > > > 
> > > > > > > 
> > > > > > > > > -- 
> > > > > > > > > MST
> > > > > > > > > 
> > > > > > > > -- 
> > > > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > > > 
> > > > > > -- 
> > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > 
> > > > -- 
> > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > 
> > -- 
> > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Michael S. Tsirkin
On Wed, Oct 06, 2021 at 02:29:37PM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (m...@redhat.com) wrote:
> > On Wed, Oct 06, 2021 at 09:43:52AM +0100, Dr. David Alan Gilbert wrote:
> > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert wrote:
> > > > > To me it feels the same as the distinction between vhost-kernel and 
> > > > > qemu
> > > > > backended virtio that we get in net and others - in principal it's 
> > > > > just 
> > > > > another implementation.
> > > > 
> > > > In net it's actually like this. Same -device, a different netdev.
> > > > 
> > > > > A tricky part is guaranteeing the set of visible virtio features 
> > > > > between
> > > > > implementations; we have that problem when we use vhost-kernel and run
> > > > > on a newer/older kernel and gain virtio features; the same will be 
> > > > > true
> > > > > with vhost-user implementations.
> > > > 
> > > > That's not new but yes we need to work on this.
> > > > 
> > > > > But this would make the structure of a vhost-user implementation quite
> > > > > different.
> > > > > 
> > > > > Dave
> > > > 
> > > > Right. That's why I'm reluctant to just add a new device type that
> > > > has special compatibility requirements.
> > > 
> > > Hmm but there's already another layer of hack^Wabstraction in there isn't 
> > > there -
> > > there's already:
> > > virtio-blk-pci
> > > virtio-blk-device
> > > 
> > > created when the user specifies a virtio-blk device?
> > > 
> > > Dave
> > 
> > virtio-*-pci is there because it was felt these devices look
> > differently from e.g. virtio-ccw so should have a different name.
> > virtio-blk-device is an internal thingy, users and guests have no idea.
> 
> Right, so to do what we're asking here, should we keep the
> virtio-blk-pci and instantiate virtio-blk-vhost-user instead of
> virtio-blk-device?
> 
> Dave

I guess that's possible, but we need to pass a bunch of parameters.
-drive is probably the right want to do that, right?

> > 
> > > 
> > > > > > 
> > > > > > > > -- 
> > > > > > > > MST
> > > > > > > > 
> > > > > > > -- 
> > > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > > 
> > > > > -- 
> > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > 
> > > -- 
> > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > 
> -- 
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Wed, Oct 06, 2021 at 09:43:52AM +0100, Dr. David Alan Gilbert wrote:
> > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert wrote:
> > > > To me it feels the same as the distinction between vhost-kernel and qemu
> > > > backended virtio that we get in net and others - in principal it's just 
> > > > another implementation.
> > > 
> > > In net it's actually like this. Same -device, a different netdev.
> > > 
> > > > A tricky part is guaranteeing the set of visible virtio features between
> > > > implementations; we have that problem when we use vhost-kernel and run
> > > > on a newer/older kernel and gain virtio features; the same will be true
> > > > with vhost-user implementations.
> > > 
> > > That's not new but yes we need to work on this.
> > > 
> > > > But this would make the structure of a vhost-user implementation quite
> > > > different.
> > > > 
> > > > Dave
> > > 
> > > Right. That's why I'm reluctant to just add a new device type that
> > > has special compatibility requirements.
> > 
> > Hmm but there's already another layer of hack^Wabstraction in there isn't 
> > there -
> > there's already:
> > virtio-blk-pci
> > virtio-blk-device
> > 
> > created when the user specifies a virtio-blk device?
> > 
> > Dave
> 
> virtio-*-pci is there because it was felt these devices look
> differently from e.g. virtio-ccw so should have a different name.
> virtio-blk-device is an internal thingy, users and guests have no idea.

Right, so to do what we're asking here, should we keep the
virtio-blk-pci and instantiate virtio-blk-vhost-user instead of
virtio-blk-device?

Dave

> 
> > 
> > > > > 
> > > > > > > -- 
> > > > > > > MST
> > > > > > > 
> > > > > > -- 
> > > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > > 
> > > > -- 
> > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > 
> > -- 
> > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Michael S. Tsirkin
On Wed, Oct 06, 2021 at 09:43:52AM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (m...@redhat.com) wrote:
> > On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert wrote:
> > > To me it feels the same as the distinction between vhost-kernel and qemu
> > > backended virtio that we get in net and others - in principal it's just 
> > > another implementation.
> > 
> > In net it's actually like this. Same -device, a different netdev.
> > 
> > > A tricky part is guaranteeing the set of visible virtio features between
> > > implementations; we have that problem when we use vhost-kernel and run
> > > on a newer/older kernel and gain virtio features; the same will be true
> > > with vhost-user implementations.
> > 
> > That's not new but yes we need to work on this.
> > 
> > > But this would make the structure of a vhost-user implementation quite
> > > different.
> > > 
> > > Dave
> > 
> > Right. That's why I'm reluctant to just add a new device type that
> > has special compatibility requirements.
> 
> Hmm but there's already another layer of hack^Wabstraction in there isn't 
> there -
> there's already:
> virtio-blk-pci
> virtio-blk-device
> 
> created when the user specifies a virtio-blk device?
> 
> Dave

virtio-*-pci is there because it was felt these devices look
differently from e.g. virtio-ccw so should have a different name.
virtio-blk-device is an internal thingy, users and guests have no idea.


> 
> > > > 
> > > > > > -- 
> > > > > > MST
> > > > > > 
> > > > > -- 
> > > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > > 
> > > -- 
> > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > 
> -- 
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert wrote:
> > To me it feels the same as the distinction between vhost-kernel and qemu
> > backended virtio that we get in net and others - in principal it's just 
> > another implementation.
> 
> In net it's actually like this. Same -device, a different netdev.
> 
> > A tricky part is guaranteeing the set of visible virtio features between
> > implementations; we have that problem when we use vhost-kernel and run
> > on a newer/older kernel and gain virtio features; the same will be true
> > with vhost-user implementations.
> 
> That's not new but yes we need to work on this.
> 
> > But this would make the structure of a vhost-user implementation quite
> > different.
> > 
> > Dave
> 
> Right. That's why I'm reluctant to just add a new device type that
> has special compatibility requirements.

Hmm but there's already another layer of hack^Wabstraction in there isn't there 
-
there's already:
virtio-blk-pci
virtio-blk-device

created when the user specifies a virtio-blk device?

Dave


> > > 
> > > > > -- 
> > > > > MST
> > > > > 
> > > > -- 
> > > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > > 
> > -- 
> > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Michael S. Tsirkin
On Wed, Oct 06, 2021 at 09:28:50AM +0100, Dr. David Alan Gilbert wrote:
> To me it feels the same as the distinction between vhost-kernel and qemu
> backended virtio that we get in net and others - in principal it's just 
> another implementation.

In net it's actually like this. Same -device, a different netdev.

> A tricky part is guaranteeing the set of visible virtio features between
> implementations; we have that problem when we use vhost-kernel and run
> on a newer/older kernel and gain virtio features; the same will be true
> with vhost-user implementations.

That's not new but yes we need to work on this.

> But this would make the structure of a vhost-user implementation quite
> different.
> 
> Dave

Right. That's why I'm reluctant to just add a new device type that
has special compatibility requirements.

> > 
> > > > -- 
> > > > MST
> > > > 
> > > -- 
> > > Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
> > 
> -- 
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Wed, Oct 06, 2021 at 09:09:30AM +0100, Dr. David Alan Gilbert wrote:
> > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > On Tue, Oct 05, 2021 at 12:10:08PM -0400, Eduardo Habkost wrote:
> > > > On Tue, Oct 05, 2021 at 03:01:05PM +0100, Dr. David Alan Gilbert wrote:
> > > > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > > > On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > > > > > > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin 
> > > > > > > wrote:
> > > > > > > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > > > > > > It might be useful for the cases when a slow block layer 
> > > > > > > > > should be replaced
> > > > > > > > > with a more performant one on running VM without stopping, 
> > > > > > > > > i.e. with very low
> > > > > > > > > downtime comparable with the one on migration.
> > > > > > > > > 
> > > > > > > > > It's possible to achive that for two reasons:
> > > > > > > > > 
> > > > > > > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are 
> > > > > > > > > almost the same.
> > > > > > > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and 
> > > > > > > > > differs from
> > > > > > > > >   each other in the values of migration service fields only.
> > > > > > > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > > > > > > 
> > > > > > > > > In the series cross-migration is achieved by adding a new 
> > > > > > > > > type.
> > > > > > > > > The new type uses virtio-blk VMState instead of 
> > > > > > > > > vhost-user-blk specific
> > > > > > > > > VMstate, also it implements migration save/load callbacks to 
> > > > > > > > > be compatible
> > > > > > > > > with migration stream produced by "virtio-blk" device.
> > > > > > > > > 
> > > > > > > > > Adding the new type instead of modifying the existing one is 
> > > > > > > > > convenent.
> > > > > > > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > > > > > > device from the existing non-compatible one using qemu 
> > > > > > > > > machinery without any
> > > > > > > > > other modifiactions. That gives all the variety of qemu 
> > > > > > > > > device related
> > > > > > > > > constraints out of box.
> > > > > > > > 
> > > > > > > > Hmm I'm not sure I understand. What is the advantage for the 
> > > > > > > > user?
> > > > > > > > What if vhost-user-blk became an alias for 
> > > > > > > > vhost-user-virtio-blk?
> > > > > > > > We could add some hacks to make it compatible for old machine 
> > > > > > > > types.
> > > > > > > 
> > > > > > > The point is that virtio-blk and vhost-user-blk are not
> > > > > > > migration-compatible ATM.  OTOH they are the same device from the 
> > > > > > > guest
> > > > > > > POV so there's nothing fundamentally preventing the migration 
> > > > > > > between
> > > > > > > the two.  In particular, we see it as a means to switch between 
> > > > > > > the
> > > > > > > storage backend transports via live migration without disrupting 
> > > > > > > the
> > > > > > > guest.
> > > > > > > 
> > > > > > > Migration-wise virtio-blk and vhost-user-blk have in common
> > > > > > > 
> > > > > > > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > > > > > > 
> > > > > > > The two differ in
> > > > > > > 
> > > > > > > - the name and the version of the VMStateDescription
> > > > > > > 
> > > > > > > - virtio-blk has an extra migration section (via .save/.load 
> > > > > > > callbacks
> > > > > > >   on VirtioDeviceClass) containing requests in flight
> > > > > > > 
> > > > > > > It looks like to become migration-compatible with virtio-blk,
> > > > > > > vhost-user-blk has to start using VMStateDescription of 
> > > > > > > virtio-blk and
> > > > > > > provide compatible .save/.load callbacks.  It isn't entirely 
> > > > > > > obvious how
> > > > > > > to make this machine-type-dependent, so we came up with a simpler 
> > > > > > > idea
> > > > > > > of defining a new device that shares most of the implementation 
> > > > > > > with the
> > > > > > > original vhost-user-blk except for the migration stuff.  We're 
> > > > > > > certainly
> > > > > > > open to suggestions on how to reconcile this under a single
> > > > > > > vhost-user-blk device, as this would be more user-friendly indeed.
> > > > > > > 
> > > > > > > We considered using a class property for this and defining the
> > > > > > > respective compat clause, but IIUC the class constructors (where 
> > > > > > > .vmsd
> > > > > > > and .save/.load are defined) are not supposed to depend on class
> > > > > > > properties.
> > > > > > > 
> > > > > > > Thanks,
> > > > > > > Roman.
> > > > > > 
> > > > > > So the question is how to make vmsd depend on machine type.
> > > > > > CC Eduardo who poked at this kind of compat stuff recently,
> > > > > > paolo who looked at qom things most recently and dgilbert
> > > > > > for advice on migration.
> > > > > 
> > > > > I don't think 

Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Michael S. Tsirkin
On Wed, Oct 06, 2021 at 09:09:30AM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (m...@redhat.com) wrote:
> > On Tue, Oct 05, 2021 at 12:10:08PM -0400, Eduardo Habkost wrote:
> > > On Tue, Oct 05, 2021 at 03:01:05PM +0100, Dr. David Alan Gilbert wrote:
> > > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > > On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > > > > > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > > > > > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > > > > > It might be useful for the cases when a slow block layer should 
> > > > > > > > be replaced
> > > > > > > > with a more performant one on running VM without stopping, i.e. 
> > > > > > > > with very low
> > > > > > > > downtime comparable with the one on migration.
> > > > > > > > 
> > > > > > > > It's possible to achive that for two reasons:
> > > > > > > > 
> > > > > > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost 
> > > > > > > > the same.
> > > > > > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and 
> > > > > > > > differs from
> > > > > > > >   each other in the values of migration service fields only.
> > > > > > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > > > > > 
> > > > > > > > In the series cross-migration is achieved by adding a new type.
> > > > > > > > The new type uses virtio-blk VMState instead of vhost-user-blk 
> > > > > > > > specific
> > > > > > > > VMstate, also it implements migration save/load callbacks to be 
> > > > > > > > compatible
> > > > > > > > with migration stream produced by "virtio-blk" device.
> > > > > > > > 
> > > > > > > > Adding the new type instead of modifying the existing one is 
> > > > > > > > convenent.
> > > > > > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > > > > > device from the existing non-compatible one using qemu 
> > > > > > > > machinery without any
> > > > > > > > other modifiactions. That gives all the variety of qemu device 
> > > > > > > > related
> > > > > > > > constraints out of box.
> > > > > > > 
> > > > > > > Hmm I'm not sure I understand. What is the advantage for the user?
> > > > > > > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > > > > > > We could add some hacks to make it compatible for old machine 
> > > > > > > types.
> > > > > > 
> > > > > > The point is that virtio-blk and vhost-user-blk are not
> > > > > > migration-compatible ATM.  OTOH they are the same device from the 
> > > > > > guest
> > > > > > POV so there's nothing fundamentally preventing the migration 
> > > > > > between
> > > > > > the two.  In particular, we see it as a means to switch between the
> > > > > > storage backend transports via live migration without disrupting the
> > > > > > guest.
> > > > > > 
> > > > > > Migration-wise virtio-blk and vhost-user-blk have in common
> > > > > > 
> > > > > > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > > > > > 
> > > > > > The two differ in
> > > > > > 
> > > > > > - the name and the version of the VMStateDescription
> > > > > > 
> > > > > > - virtio-blk has an extra migration section (via .save/.load 
> > > > > > callbacks
> > > > > >   on VirtioDeviceClass) containing requests in flight
> > > > > > 
> > > > > > It looks like to become migration-compatible with virtio-blk,
> > > > > > vhost-user-blk has to start using VMStateDescription of virtio-blk 
> > > > > > and
> > > > > > provide compatible .save/.load callbacks.  It isn't entirely 
> > > > > > obvious how
> > > > > > to make this machine-type-dependent, so we came up with a simpler 
> > > > > > idea
> > > > > > of defining a new device that shares most of the implementation 
> > > > > > with the
> > > > > > original vhost-user-blk except for the migration stuff.  We're 
> > > > > > certainly
> > > > > > open to suggestions on how to reconcile this under a single
> > > > > > vhost-user-blk device, as this would be more user-friendly indeed.
> > > > > > 
> > > > > > We considered using a class property for this and defining the
> > > > > > respective compat clause, but IIUC the class constructors (where 
> > > > > > .vmsd
> > > > > > and .save/.load are defined) are not supposed to depend on class
> > > > > > properties.
> > > > > > 
> > > > > > Thanks,
> > > > > > Roman.
> > > > > 
> > > > > So the question is how to make vmsd depend on machine type.
> > > > > CC Eduardo who poked at this kind of compat stuff recently,
> > > > > paolo who looked at qom things most recently and dgilbert
> > > > > for advice on migration.
> > > > 
> > > > I don't think I've seen anyone change vmsd name dependent on machine
> > > > type; making fields appear/disappear is easy - that just ends up as a
> > > > property on the device that's checked;  I guess if that property is
> > > > global (rather than per instance) then you can check it in
> > > > vhost_user_blk_class_init and swing the dc->vmsd 

Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-06 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Tue, Oct 05, 2021 at 12:10:08PM -0400, Eduardo Habkost wrote:
> > On Tue, Oct 05, 2021 at 03:01:05PM +0100, Dr. David Alan Gilbert wrote:
> > > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > > On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > > > > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > > > > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > > > > It might be useful for the cases when a slow block layer should 
> > > > > > > be replaced
> > > > > > > with a more performant one on running VM without stopping, i.e. 
> > > > > > > with very low
> > > > > > > downtime comparable with the one on migration.
> > > > > > > 
> > > > > > > It's possible to achive that for two reasons:
> > > > > > > 
> > > > > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost 
> > > > > > > the same.
> > > > > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs 
> > > > > > > from
> > > > > > >   each other in the values of migration service fields only.
> > > > > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > > > > 
> > > > > > > In the series cross-migration is achieved by adding a new type.
> > > > > > > The new type uses virtio-blk VMState instead of vhost-user-blk 
> > > > > > > specific
> > > > > > > VMstate, also it implements migration save/load callbacks to be 
> > > > > > > compatible
> > > > > > > with migration stream produced by "virtio-blk" device.
> > > > > > > 
> > > > > > > Adding the new type instead of modifying the existing one is 
> > > > > > > convenent.
> > > > > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > > > > device from the existing non-compatible one using qemu machinery 
> > > > > > > without any
> > > > > > > other modifiactions. That gives all the variety of qemu device 
> > > > > > > related
> > > > > > > constraints out of box.
> > > > > > 
> > > > > > Hmm I'm not sure I understand. What is the advantage for the user?
> > > > > > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > > > > > We could add some hacks to make it compatible for old machine types.
> > > > > 
> > > > > The point is that virtio-blk and vhost-user-blk are not
> > > > > migration-compatible ATM.  OTOH they are the same device from the 
> > > > > guest
> > > > > POV so there's nothing fundamentally preventing the migration between
> > > > > the two.  In particular, we see it as a means to switch between the
> > > > > storage backend transports via live migration without disrupting the
> > > > > guest.
> > > > > 
> > > > > Migration-wise virtio-blk and vhost-user-blk have in common
> > > > > 
> > > > > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > > > > 
> > > > > The two differ in
> > > > > 
> > > > > - the name and the version of the VMStateDescription
> > > > > 
> > > > > - virtio-blk has an extra migration section (via .save/.load callbacks
> > > > >   on VirtioDeviceClass) containing requests in flight
> > > > > 
> > > > > It looks like to become migration-compatible with virtio-blk,
> > > > > vhost-user-blk has to start using VMStateDescription of virtio-blk and
> > > > > provide compatible .save/.load callbacks.  It isn't entirely obvious 
> > > > > how
> > > > > to make this machine-type-dependent, so we came up with a simpler idea
> > > > > of defining a new device that shares most of the implementation with 
> > > > > the
> > > > > original vhost-user-blk except for the migration stuff.  We're 
> > > > > certainly
> > > > > open to suggestions on how to reconcile this under a single
> > > > > vhost-user-blk device, as this would be more user-friendly indeed.
> > > > > 
> > > > > We considered using a class property for this and defining the
> > > > > respective compat clause, but IIUC the class constructors (where .vmsd
> > > > > and .save/.load are defined) are not supposed to depend on class
> > > > > properties.
> > > > > 
> > > > > Thanks,
> > > > > Roman.
> > > > 
> > > > So the question is how to make vmsd depend on machine type.
> > > > CC Eduardo who poked at this kind of compat stuff recently,
> > > > paolo who looked at qom things most recently and dgilbert
> > > > for advice on migration.
> > > 
> > > I don't think I've seen anyone change vmsd name dependent on machine
> > > type; making fields appear/disappear is easy - that just ends up as a
> > > property on the device that's checked;  I guess if that property is
> > > global (rather than per instance) then you can check it in
> > > vhost_user_blk_class_init and swing the dc->vmsd pointer?
> > 
> > class_init can be called very early during QEMU initialization,
> > so it's too early to make decisions based on machine type.
> > 
> > Making a specific vmsd appear/disappear based on machine
> > configuration or state is "easy", by implementing
> > VMStateDescription.needed.  But this would require registering
> > 

Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-05 Thread Michael S. Tsirkin
On Tue, Oct 05, 2021 at 12:10:08PM -0400, Eduardo Habkost wrote:
> On Tue, Oct 05, 2021 at 03:01:05PM +0100, Dr. David Alan Gilbert wrote:
> > * Michael S. Tsirkin (m...@redhat.com) wrote:
> > > On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > > > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > > > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > > > It might be useful for the cases when a slow block layer should be 
> > > > > > replaced
> > > > > > with a more performant one on running VM without stopping, i.e. 
> > > > > > with very low
> > > > > > downtime comparable with the one on migration.
> > > > > > 
> > > > > > It's possible to achive that for two reasons:
> > > > > > 
> > > > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the 
> > > > > > same.
> > > > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs 
> > > > > > from
> > > > > >   each other in the values of migration service fields only.
> > > > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > > > 
> > > > > > In the series cross-migration is achieved by adding a new type.
> > > > > > The new type uses virtio-blk VMState instead of vhost-user-blk 
> > > > > > specific
> > > > > > VMstate, also it implements migration save/load callbacks to be 
> > > > > > compatible
> > > > > > with migration stream produced by "virtio-blk" device.
> > > > > > 
> > > > > > Adding the new type instead of modifying the existing one is 
> > > > > > convenent.
> > > > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > > > device from the existing non-compatible one using qemu machinery 
> > > > > > without any
> > > > > > other modifiactions. That gives all the variety of qemu device 
> > > > > > related
> > > > > > constraints out of box.
> > > > > 
> > > > > Hmm I'm not sure I understand. What is the advantage for the user?
> > > > > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > > > > We could add some hacks to make it compatible for old machine types.
> > > > 
> > > > The point is that virtio-blk and vhost-user-blk are not
> > > > migration-compatible ATM.  OTOH they are the same device from the guest
> > > > POV so there's nothing fundamentally preventing the migration between
> > > > the two.  In particular, we see it as a means to switch between the
> > > > storage backend transports via live migration without disrupting the
> > > > guest.
> > > > 
> > > > Migration-wise virtio-blk and vhost-user-blk have in common
> > > > 
> > > > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > > > 
> > > > The two differ in
> > > > 
> > > > - the name and the version of the VMStateDescription
> > > > 
> > > > - virtio-blk has an extra migration section (via .save/.load callbacks
> > > >   on VirtioDeviceClass) containing requests in flight
> > > > 
> > > > It looks like to become migration-compatible with virtio-blk,
> > > > vhost-user-blk has to start using VMStateDescription of virtio-blk and
> > > > provide compatible .save/.load callbacks.  It isn't entirely obvious how
> > > > to make this machine-type-dependent, so we came up with a simpler idea
> > > > of defining a new device that shares most of the implementation with the
> > > > original vhost-user-blk except for the migration stuff.  We're certainly
> > > > open to suggestions on how to reconcile this under a single
> > > > vhost-user-blk device, as this would be more user-friendly indeed.
> > > > 
> > > > We considered using a class property for this and defining the
> > > > respective compat clause, but IIUC the class constructors (where .vmsd
> > > > and .save/.load are defined) are not supposed to depend on class
> > > > properties.
> > > > 
> > > > Thanks,
> > > > Roman.
> > > 
> > > So the question is how to make vmsd depend on machine type.
> > > CC Eduardo who poked at this kind of compat stuff recently,
> > > paolo who looked at qom things most recently and dgilbert
> > > for advice on migration.
> > 
> > I don't think I've seen anyone change vmsd name dependent on machine
> > type; making fields appear/disappear is easy - that just ends up as a
> > property on the device that's checked;  I guess if that property is
> > global (rather than per instance) then you can check it in
> > vhost_user_blk_class_init and swing the dc->vmsd pointer?
> 
> class_init can be called very early during QEMU initialization,
> so it's too early to make decisions based on machine type.
> 
> Making a specific vmsd appear/disappear based on machine
> configuration or state is "easy", by implementing
> VMStateDescription.needed.  But this would require registering
> both vmsds (one of them would need to be registered manually
> instead of using DeviceClass.vmsd).
> 
> I don't remember what are the consequences of not using
> DeviceClass.vmsd to register a vmsd, I only remember it was
> subtle.  See commit b170fce3dd06 ("cpu: Register
> 

Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-05 Thread Eduardo Habkost
On Tue, Oct 05, 2021 at 03:01:05PM +0100, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (m...@redhat.com) wrote:
> > On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > > It might be useful for the cases when a slow block layer should be 
> > > > > replaced
> > > > > with a more performant one on running VM without stopping, i.e. with 
> > > > > very low
> > > > > downtime comparable with the one on migration.
> > > > > 
> > > > > It's possible to achive that for two reasons:
> > > > > 
> > > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the 
> > > > > same.
> > > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
> > > > >   each other in the values of migration service fields only.
> > > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > > 
> > > > > In the series cross-migration is achieved by adding a new type.
> > > > > The new type uses virtio-blk VMState instead of vhost-user-blk 
> > > > > specific
> > > > > VMstate, also it implements migration save/load callbacks to be 
> > > > > compatible
> > > > > with migration stream produced by "virtio-blk" device.
> > > > > 
> > > > > Adding the new type instead of modifying the existing one is 
> > > > > convenent.
> > > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > > device from the existing non-compatible one using qemu machinery 
> > > > > without any
> > > > > other modifiactions. That gives all the variety of qemu device related
> > > > > constraints out of box.
> > > > 
> > > > Hmm I'm not sure I understand. What is the advantage for the user?
> > > > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > > > We could add some hacks to make it compatible for old machine types.
> > > 
> > > The point is that virtio-blk and vhost-user-blk are not
> > > migration-compatible ATM.  OTOH they are the same device from the guest
> > > POV so there's nothing fundamentally preventing the migration between
> > > the two.  In particular, we see it as a means to switch between the
> > > storage backend transports via live migration without disrupting the
> > > guest.
> > > 
> > > Migration-wise virtio-blk and vhost-user-blk have in common
> > > 
> > > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > > 
> > > The two differ in
> > > 
> > > - the name and the version of the VMStateDescription
> > > 
> > > - virtio-blk has an extra migration section (via .save/.load callbacks
> > >   on VirtioDeviceClass) containing requests in flight
> > > 
> > > It looks like to become migration-compatible with virtio-blk,
> > > vhost-user-blk has to start using VMStateDescription of virtio-blk and
> > > provide compatible .save/.load callbacks.  It isn't entirely obvious how
> > > to make this machine-type-dependent, so we came up with a simpler idea
> > > of defining a new device that shares most of the implementation with the
> > > original vhost-user-blk except for the migration stuff.  We're certainly
> > > open to suggestions on how to reconcile this under a single
> > > vhost-user-blk device, as this would be more user-friendly indeed.
> > > 
> > > We considered using a class property for this and defining the
> > > respective compat clause, but IIUC the class constructors (where .vmsd
> > > and .save/.load are defined) are not supposed to depend on class
> > > properties.
> > > 
> > > Thanks,
> > > Roman.
> > 
> > So the question is how to make vmsd depend on machine type.
> > CC Eduardo who poked at this kind of compat stuff recently,
> > paolo who looked at qom things most recently and dgilbert
> > for advice on migration.
> 
> I don't think I've seen anyone change vmsd name dependent on machine
> type; making fields appear/disappear is easy - that just ends up as a
> property on the device that's checked;  I guess if that property is
> global (rather than per instance) then you can check it in
> vhost_user_blk_class_init and swing the dc->vmsd pointer?

class_init can be called very early during QEMU initialization,
so it's too early to make decisions based on machine type.

Making a specific vmsd appear/disappear based on machine
configuration or state is "easy", by implementing
VMStateDescription.needed.  But this would require registering
both vmsds (one of them would need to be registered manually
instead of using DeviceClass.vmsd).

I don't remember what are the consequences of not using
DeviceClass.vmsd to register a vmsd, I only remember it was
subtle.  See commit b170fce3dd06 ("cpu: Register
VMStateDescription through CPUState") and related threads.  CCing
Philippe, who might remember the details here.

If that's an important use case, I would suggest allowing devices
to implement a DeviceClass.get_vmsd method, which would override
DeviceClass.vmsd if necessary.  Is the 

Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-05 Thread Dr. David Alan Gilbert
* Michael S. Tsirkin (m...@redhat.com) wrote:
> On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> > On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > > It might be useful for the cases when a slow block layer should be 
> > > > replaced
> > > > with a more performant one on running VM without stopping, i.e. with 
> > > > very low
> > > > downtime comparable with the one on migration.
> > > > 
> > > > It's possible to achive that for two reasons:
> > > > 
> > > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the same.
> > > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
> > > >   each other in the values of migration service fields only.
> > > > 2.The device driver used in the guest is the same: virtio-blk
> > > > 
> > > > In the series cross-migration is achieved by adding a new type.
> > > > The new type uses virtio-blk VMState instead of vhost-user-blk specific
> > > > VMstate, also it implements migration save/load callbacks to be 
> > > > compatible
> > > > with migration stream produced by "virtio-blk" device.
> > > > 
> > > > Adding the new type instead of modifying the existing one is convenent.
> > > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > > device from the existing non-compatible one using qemu machinery 
> > > > without any
> > > > other modifiactions. That gives all the variety of qemu device related
> > > > constraints out of box.
> > > 
> > > Hmm I'm not sure I understand. What is the advantage for the user?
> > > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > > We could add some hacks to make it compatible for old machine types.
> > 
> > The point is that virtio-blk and vhost-user-blk are not
> > migration-compatible ATM.  OTOH they are the same device from the guest
> > POV so there's nothing fundamentally preventing the migration between
> > the two.  In particular, we see it as a means to switch between the
> > storage backend transports via live migration without disrupting the
> > guest.
> > 
> > Migration-wise virtio-blk and vhost-user-blk have in common
> > 
> > - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> > 
> > The two differ in
> > 
> > - the name and the version of the VMStateDescription
> > 
> > - virtio-blk has an extra migration section (via .save/.load callbacks
> >   on VirtioDeviceClass) containing requests in flight
> > 
> > It looks like to become migration-compatible with virtio-blk,
> > vhost-user-blk has to start using VMStateDescription of virtio-blk and
> > provide compatible .save/.load callbacks.  It isn't entirely obvious how
> > to make this machine-type-dependent, so we came up with a simpler idea
> > of defining a new device that shares most of the implementation with the
> > original vhost-user-blk except for the migration stuff.  We're certainly
> > open to suggestions on how to reconcile this under a single
> > vhost-user-blk device, as this would be more user-friendly indeed.
> > 
> > We considered using a class property for this and defining the
> > respective compat clause, but IIUC the class constructors (where .vmsd
> > and .save/.load are defined) are not supposed to depend on class
> > properties.
> > 
> > Thanks,
> > Roman.
> 
> So the question is how to make vmsd depend on machine type.
> CC Eduardo who poked at this kind of compat stuff recently,
> paolo who looked at qom things most recently and dgilbert
> for advice on migration.

I don't think I've seen anyone change vmsd name dependent on machine
type; making fields appear/disappear is easy - that just ends up as a
property on the device that's checked;  I guess if that property is
global (rather than per instance) then you can check it in
vhost_user_blk_class_init and swing the dc->vmsd pointer?

Dave


> -- 
> MST
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-05 Thread Michael S. Tsirkin
On Tue, Oct 05, 2021 at 02:18:40AM +0300, Roman Kagan wrote:
> On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> > On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > > It might be useful for the cases when a slow block layer should be 
> > > replaced
> > > with a more performant one on running VM without stopping, i.e. with very 
> > > low
> > > downtime comparable with the one on migration.
> > > 
> > > It's possible to achive that for two reasons:
> > > 
> > > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the same.
> > >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
> > >   each other in the values of migration service fields only.
> > > 2.The device driver used in the guest is the same: virtio-blk
> > > 
> > > In the series cross-migration is achieved by adding a new type.
> > > The new type uses virtio-blk VMState instead of vhost-user-blk specific
> > > VMstate, also it implements migration save/load callbacks to be compatible
> > > with migration stream produced by "virtio-blk" device.
> > > 
> > > Adding the new type instead of modifying the existing one is convenent.
> > > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > > device from the existing non-compatible one using qemu machinery without 
> > > any
> > > other modifiactions. That gives all the variety of qemu device related
> > > constraints out of box.
> > 
> > Hmm I'm not sure I understand. What is the advantage for the user?
> > What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> > We could add some hacks to make it compatible for old machine types.
> 
> The point is that virtio-blk and vhost-user-blk are not
> migration-compatible ATM.  OTOH they are the same device from the guest
> POV so there's nothing fundamentally preventing the migration between
> the two.  In particular, we see it as a means to switch between the
> storage backend transports via live migration without disrupting the
> guest.
> 
> Migration-wise virtio-blk and vhost-user-blk have in common
> 
> - the content of the VMState -- VMSTATE_VIRTIO_DEVICE
> 
> The two differ in
> 
> - the name and the version of the VMStateDescription
> 
> - virtio-blk has an extra migration section (via .save/.load callbacks
>   on VirtioDeviceClass) containing requests in flight
> 
> It looks like to become migration-compatible with virtio-blk,
> vhost-user-blk has to start using VMStateDescription of virtio-blk and
> provide compatible .save/.load callbacks.  It isn't entirely obvious how
> to make this machine-type-dependent, so we came up with a simpler idea
> of defining a new device that shares most of the implementation with the
> original vhost-user-blk except for the migration stuff.  We're certainly
> open to suggestions on how to reconcile this under a single
> vhost-user-blk device, as this would be more user-friendly indeed.
> 
> We considered using a class property for this and defining the
> respective compat clause, but IIUC the class constructors (where .vmsd
> and .save/.load are defined) are not supposed to depend on class
> properties.
> 
> Thanks,
> Roman.

So the question is how to make vmsd depend on machine type.
CC Eduardo who poked at this kind of compat stuff recently,
paolo who looked at qom things most recently and dgilbert
for advice on migration.

-- 
MST




Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-04 Thread Roman Kagan
On Mon, Oct 04, 2021 at 11:11:00AM -0400, Michael S. Tsirkin wrote:
> On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> > It might be useful for the cases when a slow block layer should be replaced
> > with a more performant one on running VM without stopping, i.e. with very 
> > low
> > downtime comparable with the one on migration.
> > 
> > It's possible to achive that for two reasons:
> > 
> > 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the same.
> >   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
> >   each other in the values of migration service fields only.
> > 2.The device driver used in the guest is the same: virtio-blk
> > 
> > In the series cross-migration is achieved by adding a new type.
> > The new type uses virtio-blk VMState instead of vhost-user-blk specific
> > VMstate, also it implements migration save/load callbacks to be compatible
> > with migration stream produced by "virtio-blk" device.
> > 
> > Adding the new type instead of modifying the existing one is convenent.
> > It ease to differ the new virtio-blk-compatible vhost-user-blk
> > device from the existing non-compatible one using qemu machinery without any
> > other modifiactions. That gives all the variety of qemu device related
> > constraints out of box.
> 
> Hmm I'm not sure I understand. What is the advantage for the user?
> What if vhost-user-blk became an alias for vhost-user-virtio-blk?
> We could add some hacks to make it compatible for old machine types.

The point is that virtio-blk and vhost-user-blk are not
migration-compatible ATM.  OTOH they are the same device from the guest
POV so there's nothing fundamentally preventing the migration between
the two.  In particular, we see it as a means to switch between the
storage backend transports via live migration without disrupting the
guest.

Migration-wise virtio-blk and vhost-user-blk have in common

- the content of the VMState -- VMSTATE_VIRTIO_DEVICE

The two differ in

- the name and the version of the VMStateDescription

- virtio-blk has an extra migration section (via .save/.load callbacks
  on VirtioDeviceClass) containing requests in flight

It looks like to become migration-compatible with virtio-blk,
vhost-user-blk has to start using VMStateDescription of virtio-blk and
provide compatible .save/.load callbacks.  It isn't entirely obvious how
to make this machine-type-dependent, so we came up with a simpler idea
of defining a new device that shares most of the implementation with the
original vhost-user-blk except for the migration stuff.  We're certainly
open to suggestions on how to reconcile this under a single
vhost-user-blk device, as this would be more user-friendly indeed.

We considered using a class property for this and defining the
respective compat clause, but IIUC the class constructors (where .vmsd
and .save/.load are defined) are not supposed to depend on class
properties.

Thanks,
Roman.



Re: [PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-04 Thread Michael S. Tsirkin
On Mon, Oct 04, 2021 at 06:07:29PM +0300, Denis Plotnikov wrote:
> It might be useful for the cases when a slow block layer should be replaced
> with a more performant one on running VM without stopping, i.e. with very low
> downtime comparable with the one on migration.
> 
> It's possible to achive that for two reasons:
> 
> 1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the same.
>   They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
>   each other in the values of migration service fields only.
> 2.The device driver used in the guest is the same: virtio-blk
> 
> In the series cross-migration is achieved by adding a new type.
> The new type uses virtio-blk VMState instead of vhost-user-blk specific
> VMstate, also it implements migration save/load callbacks to be compatible
> with migration stream produced by "virtio-blk" device.
> 
> Adding the new type instead of modifying the existing one is convenent.
> It ease to differ the new virtio-blk-compatible vhost-user-blk
> device from the existing non-compatible one using qemu machinery without any
> other modifiactions. That gives all the variety of qemu device related
> constraints out of box.

Hmm I'm not sure I understand. What is the advantage for the user?
What if vhost-user-blk became an alias for vhost-user-virtio-blk?
We could add some hacks to make it compatible for old machine types.

> 0001: adds new type "vhost-user-virtio-blk"
> 0002: add new type "vhost-user-virtio-blk-pci"
> 
> Denis Plotnikov (2):
>   vhost-user-blk: add a new vhost-user-virtio-blk type
>   vhost-user-blk-pci: add new pci device type to support
> vhost-user-virtio-blk
> 
>  hw/block/vhost-user-blk.c  | 63 ++
>  hw/virtio/vhost-user-blk-pci.c | 43 ++--
>  include/hw/virtio/vhost-user-blk.h |  2 +
>  3 files changed, 105 insertions(+), 3 deletions(-)
> 
> -- 
> 2.25.1




[PATCH v0 0/2] virtio-blk and vhost-user-blk cross-device migration

2021-10-04 Thread Denis Plotnikov
It might be useful for the cases when a slow block layer should be replaced
with a more performant one on running VM without stopping, i.e. with very low
downtime comparable with the one on migration.

It's possible to achive that for two reasons:

1.The VMStates of "virtio-blk" and "vhost-user-blk" are almost the same.
  They consist of the identical VMSTATE_VIRTIO_DEVICE and differs from
  each other in the values of migration service fields only.
2.The device driver used in the guest is the same: virtio-blk

In the series cross-migration is achieved by adding a new type.
The new type uses virtio-blk VMState instead of vhost-user-blk specific
VMstate, also it implements migration save/load callbacks to be compatible
with migration stream produced by "virtio-blk" device.

Adding the new type instead of modifying the existing one is convenent.
It ease to differ the new virtio-blk-compatible vhost-user-blk
device from the existing non-compatible one using qemu machinery without any
other modifiactions. That gives all the variety of qemu device related
constraints out of box.

0001: adds new type "vhost-user-virtio-blk"
0002: add new type "vhost-user-virtio-blk-pci"

Denis Plotnikov (2):
  vhost-user-blk: add a new vhost-user-virtio-blk type
  vhost-user-blk-pci: add new pci device type to support
vhost-user-virtio-blk

 hw/block/vhost-user-blk.c  | 63 ++
 hw/virtio/vhost-user-blk-pci.c | 43 ++--
 include/hw/virtio/vhost-user-blk.h |  2 +
 3 files changed, 105 insertions(+), 3 deletions(-)

-- 
2.25.1