[libvirt] [PATCH] 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. --- src/qemu/qemu_hostdev.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index c65f6f5..1fb373e 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -322,19 +322,20 @@ void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver) { 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); } } -- 1.7.6

On 10/17/2011 04:58 AM, Osier Yang wrote:
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. --- src/qemu/qemu_hostdev.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

于 2011年10月18日 01:47, Eric Blake 写道:
On 10/17/2011 04:58 AM, Osier Yang wrote:
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. --- src/qemu/qemu_hostdev.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
ACK.
Pushed.
participants (2)
-
Eric Blake
-
Osier Yang