diff --git a/kvm-net-Fix-announce_self.patch b/kvm-net-Fix-announce_self.patch new file mode 100644 index 0000000..b288d44 --- /dev/null +++ b/kvm-net-Fix-announce_self.patch @@ -0,0 +1,82 @@ +From 6b03a9c09340ee9d9f4dfda204832858057892ae Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Fri, 17 Jan 2025 12:17:08 +0100 +Subject: [PATCH 1/3] net: Fix announce_self +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Laurent Vivier +RH-MergeRequest: 335: net: Fix announce_self +RH-Jira: RHEL-73894 +RH-Acked-by: Eugenio PĂ©rez +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/1] f50da0292fdbfbdf20782b5a75cac2c362b8e472 (lvivier/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-73894 + +b9ad513e1876 ("net: Remove receive_raw()") adds an iovec entry +in qemu_deliver_packet_iov() to add the virtio-net header +in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets +to increase the number of iovec entries in the array, so +receive_iov() will only send the first entry (the virtio-net +entry, full of 0) and no data. The packet will be discarded. + +The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self. + +We can see the problem with tcpdump: + +- QEMU parameters: + + .. -monitor stdio \ + -netdev bridge,id=netdev0,br=virbr0 \ + -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \ + +- HMP command: + + (qemu) announce_self + +- TCP dump: + + $ sudo tcpdump -nxi virbr0 + + without the fix: + + + + with the fix: + + ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46 + 0x0000: 0001 0800 0604 0003 9a2b 2c2d 2e2f 0000 + 0x0010: 0000 9a2b 2c2d 2e2f 0000 0000 0000 0000 + 0x0020: 0000 0000 0000 0000 0000 0000 0000 + +Reported-by: Xiaohui Li +Bug: https://issues.redhat.com/browse/RHEL-73891 +Fixes: b9ad513e1876 ("net: Remove receive_raw()") +Cc: akihiko.odaki@daynix.com +Signed-off-by: Laurent Vivier +Reviewed-by: Akihiko Odaki +Reviewed-by: Michael Tokarev +Signed-off-by: Michael Tokarev +(cherry picked from commit 84dfdcbff33fff185528501be408c25c44499f32) +Signed-off-by: Laurent Vivier +--- + net/net.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/net.c b/net/net.c +index fc1125111c..94f51b6e5f 100644 +--- a/net/net.c ++++ b/net/net.c +@@ -828,6 +828,7 @@ static ssize_t qemu_deliver_packet_iov(NetClientState *sender, + iov_copy[0].iov_len = nc->vnet_hdr_len; + memcpy(&iov_copy[1], iov, iovcnt * sizeof(*iov)); + iov = iov_copy; ++ iovcnt++; + } + + if (nc->info->receive_iov) { +-- +2.39.3 + diff --git a/kvm-vhost-Add-stubs-for-the-migration-state-transfer-int.patch b/kvm-vhost-Add-stubs-for-the-migration-state-transfer-int.patch new file mode 100644 index 0000000..427e75e --- /dev/null +++ b/kvm-vhost-Add-stubs-for-the-migration-state-transfer-int.patch @@ -0,0 +1,87 @@ +From dcf22c934f3c3672d4a4b58a74b1f99619da1d3d Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Wed, 15 Jan 2025 14:50:43 +0100 +Subject: [PATCH 2/3] vhost: Add stubs for the migration state transfer + interface + +RH-Author: Laurent Vivier +RH-MergeRequest: 336: virtio-net: vhost-user: Implement internal migration +RH-Jira: RHEL-78370 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/2] 4afc9b5f73e5ef2941bcf36e31c4771d2b3ab3ba (lvivier/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-78370 + +Migration state transfer interface is only used by vhost-user-fs, +so the interface needs to be defined only when vhost is built. + +But I need to use this interface with virtio-net and vhost is not always +enabled, and to avoid undefined reference error during build, define stub +functions for vhost_supports_device_state(), vhost_save_backend_state() and +vhost_load_backend_state(). + +Cc: Hanna Czenczek +Signed-off-by: Laurent Vivier +Message-Id: <20250115135044.799698-2-lvivier@redhat.com> +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +(cherry picked from commit 3f65357313e0f928e0bd3ff868b705855d0405bc) +Signed-off-by: Laurent Vivier +--- + include/hw/virtio/vhost.h | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h +index d75faf46e9..1d524f85b9 100644 +--- a/include/hw/virtio/vhost.h ++++ b/include/hw/virtio/vhost.h +@@ -363,7 +363,14 @@ static inline int vhost_reset_device(struct vhost_dev *hdev) + * Returns true if the device supports these commands, and false if it + * does not. + */ ++#ifdef CONFIG_VHOST + bool vhost_supports_device_state(struct vhost_dev *dev); ++#else ++static inline bool vhost_supports_device_state(struct vhost_dev *dev) ++{ ++ return false; ++} ++#endif + + /** + * vhost_set_device_state_fd(): Begin transfer of internal state from/to +@@ -446,7 +453,15 @@ int vhost_check_device_state(struct vhost_dev *dev, Error **errp); + * + * Returns 0 on success, and -errno otherwise. + */ ++#ifdef CONFIG_VHOST + int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); ++#else ++static inline int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, ++ Error **errp) ++{ ++ return -ENOSYS; ++} ++#endif + + /** + * vhost_load_backend_state(): High-level function to load a vhost +@@ -463,6 +478,14 @@ int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); + * + * Returns 0 on success, and -errno otherwise. + */ ++#ifdef CONFIG_VHOST + int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); ++#else ++static inline int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, ++ Error **errp) ++{ ++ return -ENOSYS; ++} ++#endif + + #endif +-- +2.39.3 + diff --git a/kvm-virtio-net-vhost-user-Implement-internal-migration.patch b/kvm-virtio-net-vhost-user-Implement-internal-migration.patch new file mode 100644 index 0000000..8f70917 --- /dev/null +++ b/kvm-virtio-net-vhost-user-Implement-internal-migration.patch @@ -0,0 +1,161 @@ +From bb1d7e0dd85a37912540c173f573e40dd1425e72 Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Wed, 15 Jan 2025 14:50:44 +0100 +Subject: [PATCH 3/3] virtio-net: vhost-user: Implement internal migration + +RH-Author: Laurent Vivier +RH-MergeRequest: 336: virtio-net: vhost-user: Implement internal migration +RH-Jira: RHEL-78370 +RH-Acked-by: Hanna Czenczek +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/2] b7a9c887c47cea1a38ae8aee8901b74c84a6cd0d (lvivier/qemu-kvm-centos) + +JIRA: https://issues.redhat.com/browse/RHEL-78370 + +Add support of VHOST_USER_PROTOCOL_F_DEVICE_STATE in virtio-net +with vhost-user backend. + +Cc: Hanna Czenczek +Signed-off-by: Laurent Vivier +Message-Id: <20250115135044.799698-3-lvivier@redhat.com> +Reviewed-by: Michael S. Tsirkin +Signed-off-by: Michael S. Tsirkin +(cherry picked from commit 60f543ad917fad731e39ff8ce2ca83b9a9cc9d90) +Signed-off-by: Laurent Vivier +--- + hw/net/virtio-net.c | 105 ++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 97 insertions(+), 8 deletions(-) + +diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c +index 90d05f94d4..3d2b2460ad 100644 +--- a/hw/net/virtio-net.c ++++ b/hw/net/virtio-net.c +@@ -3305,6 +3305,102 @@ static const VMStateDescription vmstate_virtio_net_rss = { + }, + }; + ++static struct vhost_dev *virtio_net_get_vhost(VirtIODevice *vdev) ++{ ++ VirtIONet *n = VIRTIO_NET(vdev); ++ NetClientState *nc = qemu_get_queue(n->nic); ++ struct vhost_net *net = get_vhost_net(nc->peer); ++ return &net->dev; ++} ++ ++static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, ++ const VMStateField *field, ++ JSONWriter *vmdesc) ++{ ++ VirtIONet *n = pv; ++ VirtIODevice *vdev = VIRTIO_DEVICE(n); ++ struct vhost_dev *vhdev; ++ Error *local_error = NULL; ++ int ret; ++ ++ vhdev = virtio_net_get_vhost(vdev); ++ if (vhdev == NULL) { ++ error_reportf_err(local_error, ++ "Error getting vhost back-end of %s device %s: ", ++ vdev->name, vdev->parent_obj.canonical_path); ++ return -1; ++ } ++ ++ ret = vhost_save_backend_state(vhdev, f, &local_error); ++ if (ret < 0) { ++ error_reportf_err(local_error, ++ "Error saving back-end state of %s device %s: ", ++ vdev->name, vdev->parent_obj.canonical_path); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int vhost_user_net_load_state(QEMUFile *f, void *pv, size_t size, ++ const VMStateField *field) ++{ ++ VirtIONet *n = pv; ++ VirtIODevice *vdev = VIRTIO_DEVICE(n); ++ struct vhost_dev *vhdev; ++ Error *local_error = NULL; ++ int ret; ++ ++ vhdev = virtio_net_get_vhost(vdev); ++ if (vhdev == NULL) { ++ error_reportf_err(local_error, ++ "Error getting vhost back-end of %s device %s: ", ++ vdev->name, vdev->parent_obj.canonical_path); ++ return -1; ++ } ++ ++ ret = vhost_load_backend_state(vhdev, f, &local_error); ++ if (ret < 0) { ++ error_reportf_err(local_error, ++ "Error loading back-end state of %s device %s: ", ++ vdev->name, vdev->parent_obj.canonical_path); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static bool vhost_user_net_is_internal_migration(void *opaque) ++{ ++ VirtIONet *n = opaque; ++ VirtIODevice *vdev = VIRTIO_DEVICE(n); ++ struct vhost_dev *vhdev; ++ ++ vhdev = virtio_net_get_vhost(vdev); ++ if (vhdev == NULL) { ++ return false; ++ } ++ ++ return vhost_supports_device_state(vhdev); ++} ++ ++static const VMStateDescription vhost_user_net_backend_state = { ++ .name = "virtio-net-device/backend", ++ .version_id = 0, ++ .needed = vhost_user_net_is_internal_migration, ++ .fields = (const VMStateField[]) { ++ { ++ .name = "backend", ++ .info = &(const VMStateInfo) { ++ .name = "virtio-net vhost-user backend state", ++ .get = vhost_user_net_load_state, ++ .put = vhost_user_net_save_state, ++ }, ++ }, ++ VMSTATE_END_OF_LIST() ++ } ++}; ++ + static const VMStateDescription vmstate_virtio_net_device = { + .name = "virtio-net-device", + .version_id = VIRTIO_NET_VM_VERSION, +@@ -3357,6 +3453,7 @@ static const VMStateDescription vmstate_virtio_net_device = { + }, + .subsections = (const VMStateDescription * const []) { + &vmstate_virtio_net_rss, ++ &vhost_user_net_backend_state, + NULL + } + }; +@@ -3902,14 +3999,6 @@ static bool dev_unplug_pending(void *opaque) + return vdc->primary_unplug_pending(dev); + } + +-static struct vhost_dev *virtio_net_get_vhost(VirtIODevice *vdev) +-{ +- VirtIONet *n = VIRTIO_NET(vdev); +- NetClientState *nc = qemu_get_queue(n->nic); +- struct vhost_net *net = get_vhost_net(nc->peer); +- return &net->dev; +-} +- + static const VMStateDescription vmstate_virtio_net = { + .name = "virtio-net", + .minimum_version_id = VIRTIO_NET_VM_VERSION, +-- +2.39.3 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index 2f44053..13d250a 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -158,7 +158,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version} \ Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 9.1.0 -Release: 13%{?rcrel}%{?dist}%{?cc_suffix}.alma.1 +Release: 14%{?rcrel}%{?dist}%{?cc_suffix}.alma.1 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped # Epoch 15 used for RHEL 8 # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) @@ -447,6 +447,12 @@ Patch127: kvm-pc-bios-s390-ccw-netmain-Fix-error-messages-with-reg.patch Patch128: kvm-arm-disable-pauth-for-virt-rhel9-in-RHEL10.patch # For RHEL-76908 - Ensure qemu as NBD server does not flood logs [rhel-10] Patch129: kvm-nbd-server-Silence-server-warnings-on-port-probes.patch +# For RHEL-73894 - No RARP packets on the destination after migration [rhel-10] +Patch130: kvm-net-Fix-announce_self.patch +# For RHEL-78370 - Add vhost-user internal migration for passt +Patch131: kvm-vhost-Add-stubs-for-the-migration-state-transfer-int.patch +# For RHEL-78370 - Add vhost-user internal migration for passt +Patch132: kvm-virtio-net-vhost-user-Implement-internal-migration.patch # AlmaLinux Patch Patch2001: 2001-Add-ppc64-support.patch @@ -1563,12 +1569,21 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %endif %changelog -* Tue Feb 11 2025 Eduard Abdullin - 18:9.1.0-13.alma.1 +* Wed Feb 12 2025 Eduard Abdullin - 18:9.1.0-14.alma.1 - Enable QXL device build - Enable building for ppc64le - Re-added Spice support - Don't remove slof.bin for ppc64le +* Mon Feb 10 2025 Miroslav Rezanina - 9.1.0-14 +- kvm-net-Fix-announce_self.patch [RHEL-73894] +- kvm-vhost-Add-stubs-for-the-migration-state-transfer-int.patch [RHEL-78370] +- kvm-virtio-net-vhost-user-Implement-internal-migration.patch [RHEL-78370] +- Resolves: RHEL-73894 + (No RARP packets on the destination after migration [rhel-10]) +- Resolves: RHEL-78370 + (Add vhost-user internal migration for passt) + * Mon Feb 03 2025 Miroslav Rezanina - 9.1.0-13 - kvm-nbd-server-Silence-server-warnings-on-port-probes.patch [RHEL-76908] - Resolves: RHEL-76908