qemu-kvm/kvm-virtio-net-failover-add-missing-remove_migration_sta.patch
Miroslav Rezanina 7b74d99404 * Tue Jun 08 2021 Miroslav Rezanina <mrezanin@redhat.com> - 6.0.0-5
- kvm-arm-virt-Register-highmem-and-gic-version-as-class-p.patch [bz#1952449]
- kvm-hw-arm-virt-Add-8.5-and-9.0-machine-types-and-remove.patch [bz#1952449]
- kvm-aarch64-rh-devices-add-CONFIG_PVPANIC_PCI.patch [bz#1747467]
- kvm-spec-Do-not-build-qemu-kvm-block-gluster.patch [bz#1964795]
- kvm-spec-Do-not-link-pcnet-and-ne2k_pci-roms.patch [bz#1965961]
- kvm-redhat-s390x-add-rhel-8.5.0-compat-machine.patch [bz#1957194]
- kvm-redhat-add-missing-entries-in-hw_compat_rhel_8_4.patch [bz#1957194]
- kvm-redhat-Define-pseries-rhel8.5.0-machine-type.patch [bz#1957194]
- kvm-virtio-net-failover-add-missing-remove_migration_sta.patch [bz#1957194]
- kvm-hw-arm-virt-Disable-PL011-clock-migration-through-hw.patch [bz#1957194]
- kvm-virtio-blk-Fix-rollback-path-in-virtio_blk_data_plan.patch [bz#1957194]
- kvm-virtio-blk-Configure-all-host-notifiers-in-a-single-.patch [bz#1957194]
- kvm-virtio-scsi-Set-host-notifiers-and-callbacks-separat.patch [bz#1957194]
- kvm-virtio-scsi-Configure-all-host-notifiers-in-a-single.patch [bz#1957194]
- kvm-hw-arm-smmuv3-Another-range-invalidation-fix.patch [bz#1957194]
- Resolves: bz#1952449
  ([aarch64] define RHEL9 machine types)
- Resolves: bz#1747467
  ([aarch64] [qemu] PVPANIC support)
- Resolves: bz#1964795
  (Remove qemu-kvm-block-gluster package)
- Resolves: bz#1965961
  (Remove links to not build roms)
- Resolves: bz#1957194
  (Synchronize RHEL-AV 8.5.0 changes to RHEL 9.0.0 Beta)
2021-06-08 02:47:19 -04:00

78 lines
3.0 KiB
Diff

From 21027e308bf410293a745d4358a848e9aa037df1 Mon Sep 17 00:00:00 2001
From: Laurent Vivier <lvivier@redhat.com>
Date: Mon, 10 May 2021 13:08:20 -0400
Subject: [PATCH 09/15] virtio-net: failover: add missing
remove_migration_state_change_notifier()
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
RH-MergeRequest: 5: Synchronize RHEL-AV 8.5 release 18 to RHEL 9 Beta
RH-Commit: [4/12] 884f0f99fbbba4312663ec6232b1d8c9576df84e (mrezanin/centos-src-qemu-kvm)
RH-Bugzilla: 1957194
RH-Acked-by: Danilo Cesar Lemes de Paula <ddepaula@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Acked-by: Greg Kurz <gkurz@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
In the failover case configuration, virtio_net_device_realize() uses an
add_migration_state_change_notifier() to add a state notifier, but this
notifier is not removed by the unrealize function when the virtio-net
card is unplugged.
If the card is unplugged and a migration is started, the notifier is
called and as it is not valid anymore QEMU crashes.
This patch fixes the problem by adding the
remove_migration_state_change_notifier() in virtio_net_device_unrealize().
The problem can be reproduced with:
$ qemu-system-x86_64 -enable-kvm -m 1g -M q35 \
-device pcie-root-port,slot=4,id=root1 \
-device pcie-root-port,slot=5,id=root2 \
-device virtio-net-pci,id=net1,mac=52:54:00:6f:55:cc,failover=on,bus=root1 \
-monitor stdio disk.qcow2
(qemu) device_del net1
(qemu) migrate "exec:gzip -c > STATEFILE.gz"
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ()
#1 0x0000555555d726d7 in notifier_list_notify (...)
at .../util/notify.c:39
#2 0x0000555555842c1a in migrate_fd_connect (...)
at .../migration/migration.c:3975
#3 0x0000555555950f7d in migration_channel_connect (...)
error@entry=0x0) at .../migration/channel.c:107
#4 0x0000555555910922 in exec_start_outgoing_migration (...)
at .../migration/exec.c:42
Reported-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit a7eca58380f9589bb1bb6333ccfb58869734edb6)
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
hw/net/virtio-net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 66b9ff4511..914051feb7 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3373,6 +3373,7 @@ static void virtio_net_device_unrealize(DeviceState *dev)
if (n->failover) {
device_listener_unregister(&n->primary_listener);
+ remove_migration_state_change_notifier(&n->migration_state);
}
max_queues = n->multiqueue ? n->max_queues : 1;
--
2.27.0