Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: Log reset and restore of resources

PCI resource fitting and assignment is complicated to track because it
performs many actions without any logging. One of these is resource reset
(zeroing the resource) and the restore during the multi-pass resource
fitting algorithm.

Resource reset does not play well with the other PCI code if the code later
wants to reattempt assignment of that resource. Knowing that a resource was
left in the reset state without a pairing restore is useful for
understanding issues that show up as resource assignment failures.

Add pci_dbg() to both reset and restore to be better able to track what's
going on within the resource fitting algorithm.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20251219174036.16738-12-ilpo.jarvinen@linux.intel.com

authored by

Ilpo Järvinen and committed by
Bjorn Helgaas
9629f717 5fa2f9fb

+9 -1
+9 -1
drivers/pci/setup-bus.c
··· 136 136 static void restore_dev_resource(struct pci_dev_resource *dev_res) 137 137 { 138 138 struct resource *res = dev_res->res; 139 + struct pci_dev *dev = dev_res->dev; 140 + int idx = pci_resource_num(dev, res); 141 + const char *res_name = pci_resource_name(dev, idx); 139 142 140 143 if (WARN_ON_ONCE(res->parent)) 141 144 return; ··· 146 143 res->start = dev_res->start; 147 144 res->end = dev_res->end; 148 145 res->flags = dev_res->flags; 146 + 147 + pci_dbg(dev, "%s %pR: resource restored\n", res_name, res); 149 148 } 150 149 151 150 /* ··· 389 384 return false; 390 385 } 391 386 392 - static inline void reset_resource(struct pci_dev *dev, struct resource *res) 387 + static void reset_resource(struct pci_dev *dev, struct resource *res) 393 388 { 394 389 int idx = pci_resource_num(dev, res); 390 + const char *res_name = pci_resource_name(dev, idx); 395 391 396 392 if (pci_resource_is_bridge_win(idx)) { 397 393 res->flags |= IORESOURCE_UNSET; 398 394 return; 399 395 } 396 + 397 + pci_dbg(dev, "%s %pR: resetting resource\n", res_name, res); 400 398 401 399 res->start = 0; 402 400 res->end = 0;