Skip to content

Commit

Permalink
PCI: Add debug print when releasing resources before retry
Browse files Browse the repository at this point in the history
PCI resource fitting is somewhat hard to track because it performs many
actions without logging them. In the case inside
__assign_resources_sorted(), the resources are released before resource
assignment is going to be retried in a different order. That is just one
level of retries the resource fitting performs overall so tracking it
through repeated assignments or failures of a resource gets messy rather
quickly.

Simply announce the release explicitly using pci_dbg() so it is clear what
is going on with each resource.

Link: https://lore.kernel.org/r/20241216175632.4175-23-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Xiaochun Lee <lixc17@lenovo.com>
  • Loading branch information
Ilpo Järvinen authored and Bjorn Helgaas committed Feb 18, 2025

Unverified

No user is associated with the committer email.
1 parent 07854e0 commit 8884b56
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
@@ -408,6 +408,9 @@ static void __assign_resources_sorted(struct list_head *head,
struct pci_dev_resource *save_res;
struct pci_dev_resource *dev_res, *tmp_res, *dev_res2;
struct resource *res;
struct pci_dev *dev;
const char *res_name;
int idx;
unsigned long fail_type;
resource_size_t add_align, align;

@@ -497,9 +500,16 @@ static void __assign_resources_sorted(struct list_head *head,
/* Release assigned resource */
list_for_each_entry(dev_res, head, list) {
res = dev_res->res;
dev = dev_res->dev;

if (!res->parent)
continue;

idx = pci_resource_num(dev, res);
res_name = pci_resource_name(dev, idx);
pci_dbg(dev, "%s %pR: releasing\n", res_name, res);

if (res->parent)
release_resource(res);
release_resource(res);
}
/* Restore start/end/flags from saved list */
list_for_each_entry(save_res, &save_head, list)

0 comments on commit 8884b56

Please sign in to comment.