[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] failover: unregister ram on unplug
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH] failover: unregister ram on unplug |
Date: |
Wed, 21 Jul 2021 06:41:20 -0400 |
On Wed, Jul 21, 2021 at 10:58:17AM +0200, Igor Mammedov wrote:
> On Tue, 20 Jul 2021 20:16:44 +0200
> Laurent Vivier <lvivier@redhat.com> wrote:
>
> > This simple change allows to test failover with a simulated device
> > like e1000e rather than a vfio device.
> >
> > This is interesting to developers that want to test failover on
> > a system with no vfio device. Moreover it simplifies host networking
> > configuration as we can use the same bridge for virtio-net and
> > the other failover networking device.
> >
> > Without this change the migration of a system configured with failover
> > fails with:
> >
> > Unknown ramblock "0000:00:01.1:00.0/e1000e.rom", cannot accept migration
> > error while loading state for instance 0x0 of device 'ram'
> > load of migration failed: Invalid argument
> >
> > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>
> > ---
> > hw/net/virtio-net.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index 16d20cdee52a..8f7735bad4f2 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -3256,6 +3256,9 @@ static void
> > virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s)
> > if (migration_in_setup(s) && !should_be_hidden) {
> > if (failover_unplug_primary(n, dev)) {
> > vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev);
> > + if (PCI_DEVICE(dev)->has_rom) {
Hmm. Any way to hide this behind an interface so
we don't need to poke at pci device internals?
> > + vmstate_unregister_ram(&PCI_DEVICE(dev)->rom , dev);
> > + }
> > qapi_event_send_unplug_primary(dev->id);
> > qatomic_set(&n->failover_primary_hidden, true);
> > } else {