linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Print a debug message on PCI device release
@ 2021-03-11 13:23 Niklas Schnelle
  2021-05-27 23:58 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Schnelle @ 2021-03-11 13:23 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-kernel

Commit 62795041418d ("PCI: enhance physical slot debug information")
added a debug print on releasing the PCI slot and another message on
destroying it. There is however no debug print on releasing the PCI
device structure itself and even with closely looking at the kernel log
during hotplug testing, I overlooked several missing pci_dev_put() calls
for way too long. So let's add a debug print in pci_release_dev() making
it much easier to spot when the PCI device structure is not released
when it is supposed to.

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/probe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 953f15abc850..3e3669a00a2f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2226,6 +2226,7 @@ static void pci_release_dev(struct device *dev)
 	pci_bus_put(pci_dev->bus);
 	kfree(pci_dev->driver_override);
 	bitmap_free(pci_dev->dma_alias_mask);
+	dev_dbg(dev, "device released\n");
 	kfree(pci_dev);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: Print a debug message on PCI device release
  2021-03-11 13:23 [PATCH] PCI: Print a debug message on PCI device release Niklas Schnelle
@ 2021-05-27 23:58 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2021-05-27 23:58 UTC (permalink / raw)
  To: Niklas Schnelle; +Cc: Bjorn Helgaas, linux-pci, linux-kernel

On Thu, Mar 11, 2021 at 02:23:12PM +0100, Niklas Schnelle wrote:
> Commit 62795041418d ("PCI: enhance physical slot debug information")
> added a debug print on releasing the PCI slot and another message on
> destroying it. There is however no debug print on releasing the PCI
> device structure itself and even with closely looking at the kernel log
> during hotplug testing, I overlooked several missing pci_dev_put() calls
> for way too long. So let's add a debug print in pci_release_dev() making
> it much easier to spot when the PCI device structure is not released
> when it is supposed to.
> 
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Applied to pci/enumeration for v5.14, thanks!

> ---
>  drivers/pci/probe.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 953f15abc850..3e3669a00a2f 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2226,6 +2226,7 @@ static void pci_release_dev(struct device *dev)
>  	pci_bus_put(pci_dev->bus);
>  	kfree(pci_dev->driver_override);
>  	bitmap_free(pci_dev->dma_alias_mask);
> +	dev_dbg(dev, "device released\n");
>  	kfree(pci_dev);
>  }
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-27 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 13:23 [PATCH] PCI: Print a debug message on PCI device release Niklas Schnelle
2021-05-27 23:58 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).