提交 17160729 编写于 作者: A Andrea Bolognani

pci: Add debug messages when unbinding from stub driver

Unbinding a PCI device from the stub driver can require several steps,
and it can be useful for debugging to be able to trace which of these
steps are performed and which are skipped for each device.
上级 771eaeb2
......@@ -1106,26 +1106,37 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev)
if (!driver) {
/* The device is not bound to any driver and we are almost done. */
VIR_DEBUG("PCI device %s is not bound to any driver", dev->name);
goto reprobe;
}
if (!dev->unbind_from_stub)
if (!dev->unbind_from_stub) {
VIR_DEBUG("Unbind from stub skipped for PCI device %s", dev->name);
goto remove_slot;
}
/* If the device isn't bound to a known stub, skip the unbind. */
if (virPCIStubDriverTypeFromString(driver) < 0 ||
virPCIStubDriverTypeFromString(driver) == VIR_PCI_STUB_DRIVER_NONE)
virPCIStubDriverTypeFromString(driver) == VIR_PCI_STUB_DRIVER_NONE) {
VIR_DEBUG("Unbind from stub skipped for PCI device %s because of "
"unknown stub driver", dev->name);
goto remove_slot;
}
VIR_DEBUG("Found stub driver %s", driver);
VIR_DEBUG("Unbinding PCI device %s from stub driver %s",
dev->name, driver);
if (virPCIDeviceUnbind(dev) < 0)
goto cleanup;
dev->unbind_from_stub = false;
remove_slot:
if (!dev->remove_slot)
if (!dev->remove_slot) {
VIR_DEBUG("Slot removal skipped for PCI device %s", dev->name);
goto reprobe;
}
VIR_DEBUG("Removing slot for PCI device %s", dev->name);
/* Xen's pciback.ko wants you to use remove_slot on the specific device */
if (!(path = virPCIDriverFile(driver, "remove_slot")))
......@@ -1141,10 +1152,13 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev)
reprobe:
if (!dev->reprobe) {
VIR_DEBUG("Reprobe skipped for PCI device %s", dev->name);
result = 0;
goto cleanup;
}
VIR_DEBUG("Reprobing for PCI device %s", dev->name);
/* Trigger a re-probe of the device is not in the stub's dynamic
* ID table. If the stub is available, but 'remove_id' isn't
* available, then re-probing would just cause the device to be
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册