]> xenbits.xensource.com Git - libvirt.git/commitdiff
pci: Add debug messages when unbinding from stub driver
authorAndrea Bolognani <abologna@redhat.com>
Fri, 15 Jan 2016 10:57:26 +0000 (11:57 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 28 Jan 2016 11:20:53 +0000 (12:20 +0100)
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.

src/util/virpci.c

index f56dbe66b499183559c8c0ad984a4bab6afb4860..3420cf4240bd503348fd8df4c029e3c42cbf3641 100644 (file)
@@ -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