From bbe7c4fa450bf2f3f4f0296c819bfe33b667dc5a Mon Sep 17 00:00:00 2001 From: Adttil <2429917001@qq.com> Date: Thu, 28 Nov 2024 00:34:01 +0800 Subject: [PATCH] libvirt update to version 9.10.0-13 --- Revert-node_device-fix-leak-of-DIR.patch | 39 +++++ libvirt.spec | 7 +- ...-hotplug-unplug-bugfix-and-support-v.patch | 142 ++++++++++++++++++ 3 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 Revert-node_device-fix-leak-of-DIR.patch create mode 100644 vdpa-vdpa-device-hotplug-unplug-bugfix-and-support-v.patch diff --git a/Revert-node_device-fix-leak-of-DIR.patch b/Revert-node_device-fix-leak-of-DIR.patch new file mode 100644 index 0000000..790deca --- /dev/null +++ b/Revert-node_device-fix-leak-of-DIR.patch @@ -0,0 +1,39 @@ +From 27cb1a66b291d3493c12a8ebc90c28f7b1fe67b0 Mon Sep 17 00:00:00 2001 +From: Adttil <2429917001@qq.com> +Date: Sat, 23 Nov 2024 18:15:26 +0800 +Subject: [PATCH 2/2] Revert "node_device: fix leak of DIR*" + +This reverts commit 3cd86072fd6725178b669174eb99ab24a0bcee6c. +Updating the dir variable in the udevGetVDPACharDev function +to a smart pointer fixed a bug where dir was not freeing, +but a previous incorrect commit resulted in a double free +of the pointer, and the patch is now rolled back +--- + src/node_device/node_device_udev.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c +index aa2781db34..6c5b788279 100644 +--- a/src/node_device/node_device_udev.c ++++ b/src/node_device/node_device_udev.c +@@ -1198,7 +1198,6 @@ udevGetVDPACharDev(const char *sysfs_path, + virReportError(VIR_ERR_INTERNAL_ERROR, + _("vDPA chardev path '%1$s' does not exist"), + chardev); +- virDirClose(dir); + return -1; + } + VIR_DEBUG("vDPA chardev is at '%s'", chardev); +@@ -1207,9 +1206,6 @@ udevGetVDPACharDev(const char *sysfs_path, + break; + } + } +- +- virDirClose(dir); +- + if (direrr < 0) + return -1; + +-- +2.43.0 + diff --git a/libvirt.spec b/libvirt.spec index a4330ee..03e6621 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -262,7 +262,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 12 +Release: 13 License: LGPLv2+ URL: https://libvirt.org/ @@ -319,6 +319,8 @@ Patch0045: Add-loongarch-cpu-support.patch Patch0046: Support-for-loongarch64-in-the-QEMU-driver.patch Patch0047: Implement-the-method-of-getting-host-info-for-loonga.patch Patch0048: rpc-ensure-temporary-GSource-is-removed-from-client-.patch +Patch0049: vdpa-vdpa-device-hotplug-unplug-bugfix-and-support-v.patch +Patch0050: Revert-node_device-fix-leak-of-DIR.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2610,6 +2612,9 @@ exit 0 %endif %changelog +* Thu Nov 28 2024 Adttil <2429917001@qq.com> 9.10.0-13 +- vdpa: support vdpa device boot index and fix hotplug/unplug bug + * Fri May 31 2024 LiXiangLai 9.10.0-12 - spec: add numa support for loongarch64 diff --git a/vdpa-vdpa-device-hotplug-unplug-bugfix-and-support-v.patch b/vdpa-vdpa-device-hotplug-unplug-bugfix-and-support-v.patch new file mode 100644 index 0000000..58e5fc4 --- /dev/null +++ b/vdpa-vdpa-device-hotplug-unplug-bugfix-and-support-v.patch @@ -0,0 +1,142 @@ +From a588417aec2a5e3da333e89254448ee5944c35e4 Mon Sep 17 00:00:00 2001 +From: Adttil <2429917001@qq.com> +Date: Sat, 23 Nov 2024 18:09:39 +0800 +Subject: [PATCH 1/2] vdpa: vdpa device hotplug/unplug bugfix and support vdpa + device boot index + +--- + src/qemu/qemu_command.c | 11 +++++++++-- + src/qemu/qemu_command.h | 3 ++- + src/qemu/qemu_domain_address.c | 13 +++++++++++-- + src/qemu/qemu_hotplug.c | 12 +++++++++++- + 4 files changed, 33 insertions(+), 6 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index 0c47f019f2..7ca4397dfe 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -5018,15 +5018,22 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def, + } + + virJSONValue * +-qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev) ++qemuBuildHostdevVDPADevProps(const virDomainDef *def, ++ virDomainHostdevDef *dev) + { + g_autoptr(virJSONValue) props = NULL; + virDomainHostdevSubsysVDPA *vdpasrc = &dev->source.subsys.u.vdpa; + if (virJSONValueObjectAdd(&props, + "s:driver", "vhost-vdpa-device-pci", ++ "s:id", dev->info->alias, + "s:vhostdev", vdpasrc->devpath, ++ "p:bootindex", dev->info->bootIndex, + NULL) < 0) + return NULL; ++ ++ if (qemuBuildDeviceAddressProps(props, def, dev->info) < 0) ++ return NULL; ++ + return g_steal_pointer(&props); + } + +@@ -5225,7 +5232,7 @@ qemuBuildHostdevCommandLine(virCommand *cmd, + break; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: +- if (!(devprops = qemuBuildHostdevVDPADevProps(hostdev))) ++ if (!(devprops = qemuBuildHostdevVDPADevProps(def, hostdev))) + return -1; + if (qemuBuildDeviceCommandlineFromJSON(cmd, devprops, def, qemuCaps) < 0) + return -1; +diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h +index 432ea59310..273c084322 100644 +--- a/src/qemu/qemu_command.h ++++ b/src/qemu/qemu_command.h +@@ -199,7 +199,8 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def, + virDomainHostdevDef *dev); + + virJSONValue * +-qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev); ++qemuBuildHostdevVDPADevProps(const virDomainDef *def, ++ virDomainHostdevDef *dev); + + virJSONValue * + qemuBuildRedirdevDevProps(const virDomainDef *def, +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index 099778b2a8..1f8eee8d61 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -828,7 +828,8 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, + if (!virHostdevIsMdevDevice(hostdev) && + (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && +- hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST))) { ++ hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && ++ hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA))) { + return 0; + } + +@@ -860,6 +861,13 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev, + if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) + return pcieFlags; + ++ /* ++ * if pcieFlags not equal to pciFlags, domain has pcie root port. ++ * Thus, we just return pcieFlags. ++ */ ++ if (hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA) ++ return pcieFlags; ++ + /* according to pbonzini, from the guest PoV vhost-scsi devices + * are the same as virtio-scsi, so they should follow virtio logic + */ +@@ -2333,7 +2341,8 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def, + if (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && + subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && + !(subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && +- subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_PCI)) { ++ subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_PCI) && ++ subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA) { + continue; + } + +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index 87353d2149..907971b41f 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -2800,7 +2800,7 @@ qemuDomainAttachVDPADevice(virQEMUDriver *driver, + goto cleanup; + } + +- if (!(devprops = qemuBuildHostdevVDPADevProps(hostdev))) ++ if (!(devprops = qemuBuildHostdevVDPADevProps(vm->def, hostdev))) + goto cleanup; + + VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1); +@@ -4726,6 +4726,14 @@ qemuDomainRemoveMediatedDevice(virQEMUDriver *driver, + } + + ++static void ++qemuDomainRemoveVDPADevice(virDomainObj *vm, ++ virDomainHostdevDef *hostdev) ++{ ++ qemuDomainReleaseDeviceAddress(vm, hostdev->info); ++} ++ ++ + static int + qemuDomainRemoveHostDevice(virQEMUDriver *driver, + virDomainObj *vm, +@@ -4798,6 +4806,8 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver, + qemuDomainRemoveMediatedDevice(driver, vm, hostdev); + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA: ++ qemuDomainRemoveVDPADevice(vm, hostdev); ++ break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; + } +-- +2.43.0 + -- Gitee