failover: unregister ram on unplug
PATCH 1/1 failover: unregister ram on unplug
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
--- hw/net/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+)
hw/net/virtio-net.c +3 -0
@@ -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) { +vmstate_unregister_ram (&PCI_DEVICE (dev)->rom , dev); + }qapi_event_send_unplug_primary (dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {
Signature · 1 line
2.31.1
Quoted 8 lines · On Tue, 20 Jul 2021 20:16:44 +0200 Laurent Vivier <[email protected]> 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.
Quoted 8 lines
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
0x0of device 'ram' load of migration failed: Invalid argumentSigned-off-by Laurent Vivier <[email protected]>
Quoted 18 lines
--- hw/net/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+)hw/net/virtio-net.c +3
-0@@ -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) { +vmstate_unregister_ram (&PCI_DEVICE (dev)->rom , dev); + }qapi_event_send_unplug_primary (dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {
Quoted 14 lines · Igor Mammedov
Quoted 11 lines · On Tue, 20 Jul 2021 20:16:44 +0200 Laurent Vivier <[email protected]> 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:
Quoted 8 lines
Quoted 5 lines
Unknown ramblock "0000:00:01.1:00.0/e1000e.rom", cannot accept migration error while loading state for instance
0x0of device 'ram' load of migration failed: Invalid argumentSigned-off-by Laurent Vivier <[email protected]>Reviewed-by Igor Mammedov <[email protected]>
I've sent a v2 of this patch to reset has_rom to false.
I've updated the commit log message and the subject of the email to "failover: unregister ROM on unplug" (that is more correct).
Thanks,
Laurent
Quoted 26 lines · Igor Mammedov
Quoted 8 lines · On Tue, 20 Jul 2021 20:16:44 +0200 Laurent Vivier <[email protected]> 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.
Quoted 8 lines
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
0x0of device 'ram' load of migration failed: Invalid argumentSigned-off-by Laurent Vivier <[email protected]>Reviewed-by Igor Mammedov <[email protected]>Quoted 4 lines
--- hw/net/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 9 lines
hw/net/virtio-net.c static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s) · line 3259
Quoted 9 lines
hw/net/virtio-net.c +1
-0@@ -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?
Quoted 5 lines
Quoted 5 lines
hw/net/virtio-net.c +2
-0+vmstate_unregister_ram (&PCI_DEVICE (dev)->rom , dev); + }qapi_event_send_unplug_primary (dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Igor Mammedov
Quoted 8 lines · On Tue, 20 Jul 2021 20:16:44 +0200 Laurent Vivier <[email protected]> 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.
Quoted 8 lines
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
0x0of device 'ram' load of migration failed: Invalid argumentSigned-off-by Laurent Vivier <[email protected]>Reviewed-by Igor Mammedov <[email protected]>Quoted 4 lines
--- hw/net/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 13 lines
Quoted 9 lines
hw/net/virtio-net.c static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s) · line 3259
Quoted 9 lines
hw/net/virtio-net.c +1
-0@@ -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?
There is the pci_del_option_rom() but it's not exported.
Do you want I export and use it?
Thanks,
Laurent
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
hw/net/virtio-net.c +2
-0+vmstate_unregister_ram (&PCI_DEVICE (dev)->rom , dev); + }qapi_event_send_unplug_primary (dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {
Quoted 42 lines · Laurent Vivier
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Igor Mammedov
Quoted 8 lines · On Tue, 20 Jul 2021 20:16:44 +0200 Laurent Vivier <[email protected]> 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.
Quoted 8 lines
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
0x0of device 'ram' load of migration failed: Invalid argumentSigned-off-by Laurent Vivier <[email protected]>Reviewed-by Igor Mammedov <[email protected]>Quoted 4 lines
--- hw/net/virtio-net.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 13 lines
Quoted 9 lines
hw/net/virtio-net.c static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s) · line 3259
Quoted 9 lines
hw/net/virtio-net.c +1
-0@@ -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?
Quoted 3 lines
There is the
pci_del_option_rom()but it's not exported.Do you want I export and use it?
Looks cleaner indeed.