File 7fb50e30-pcidev3.patch of Package libvirt.1301
commit 7fb50e300c8c37643bc6d035279d9d538be4adcc
Author: Osier Yang <jyang@redhat.com>
Date: Mon Oct 17 18:19:58 2011 +0800
qemu: Do not wait if the PCI device is not managed when reattaching
Waiting for qemu-kvm cleaning up the PCI bar(s) mapping with long time
while the device is not managed is just waste of time.
Index: libvirt-0.9.6/src/qemu/qemu_hostdev.c
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu_hostdev.c
+++ libvirt-0.9.6/src/qemu/qemu_hostdev.c
@@ -322,19 +322,20 @@ void qemuReattachPciDevice(pciDevice *de
{
int retries = 100;
+ if (!pciDeviceGetManaged(dev))
+ return;
+
while (pciWaitForDeviceCleanup(dev, "kvm_assigned_device")
&& retries) {
usleep(100*1000);
retries--;
}
- if (pciDeviceGetManaged(dev)) {
- if (pciReAttachDevice(dev, driver->activePciHostdevs) < 0) {
- virErrorPtr err = virGetLastError();
- VIR_ERROR(_("Failed to re-attach PCI device: %s"),
- err ? err->message : _("unknown error"));
- virResetError(err);
- }
+ if (pciReAttachDevice(dev, driver->activePciHostdevs) < 0) {
+ virErrorPtr err = virGetLastError();
+ VIR_ERROR(_("Failed to re-attach PCI device: %s"),
+ err ? err->message : _("unknown error"));
+ virResetError(err);
}
}