diff mbox series

PCI: Log debug messages about reset method

Message ID 20250303204220.197172-1-helgaas@kernel.org (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series PCI: Log debug messages about reset method | expand

Commit Message

Bjorn Helgaas March 3, 2025, 8:42 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Log pci_dbg() messages about the reset methods we attempt and any errors
(-ENOTTY means "try the next method").

Set CONFIG_DYNAMIC_DEBUG=y and enable by booting with
dyndbg="file drivers/pci/* +p" or enable at runtime:

  # echo "file drivers/pci/* +p" > /sys/kernel/debug/dynamic_debug/control

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Dave Jiang March 3, 2025, 9:08 p.m. UTC | #1
On 3/3/25 1:42 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Log pci_dbg() messages about the reset methods we attempt and any errors
> (-ENOTTY means "try the next method").
> 
> Set CONFIG_DYNAMIC_DEBUG=y and enable by booting with
> dyndbg="file drivers/pci/* +p" or enable at runtime:
> 
>   # echo "file drivers/pci/* +p" > /sys/kernel/debug/dynamic_debug/control
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/pci/pci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 869d204a70a3..3d13bb8e5c53 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5230,6 +5230,7 @@ const struct pci_reset_fn_method pci_reset_fn_methods[] = {
>  int __pci_reset_function_locked(struct pci_dev *dev)
>  {
>  	int i, m, rc;
> +	const struct pci_reset_fn_method *method;
>  
>  	might_sleep();
>  
> @@ -5246,9 +5247,13 @@ int __pci_reset_function_locked(struct pci_dev *dev)
>  		if (!m)
>  			return -ENOTTY;
>  
> -		rc = pci_reset_fn_methods[m].reset_fn(dev, PCI_RESET_DO_RESET);
> +		method = &pci_reset_fn_methods[m];
> +		pci_dbg(dev, "reset via %s\n", method->name);
> +		rc = method->reset_fn(dev, PCI_RESET_DO_RESET);
>  		if (!rc)
>  			return 0;
> +
> +		pci_dbg(dev, "%s failed with %d\n", method->name, rc);
>  		if (rc != -ENOTTY)
>  			return rc;
>  	}
Bjorn Helgaas March 10, 2025, 6:43 p.m. UTC | #2
On Mon, Mar 03, 2025 at 02:42:20PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Log pci_dbg() messages about the reset methods we attempt and any errors
> (-ENOTTY means "try the next method").
> 
> Set CONFIG_DYNAMIC_DEBUG=y and enable by booting with
> dyndbg="file drivers/pci/* +p" or enable at runtime:
> 
>   # echo "file drivers/pci/* +p" > /sys/kernel/debug/dynamic_debug/control
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Applied to pci/reset for v6.15.

> ---
>  drivers/pci/pci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 869d204a70a3..3d13bb8e5c53 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5230,6 +5230,7 @@ const struct pci_reset_fn_method pci_reset_fn_methods[] = {
>  int __pci_reset_function_locked(struct pci_dev *dev)
>  {
>  	int i, m, rc;
> +	const struct pci_reset_fn_method *method;
>  
>  	might_sleep();
>  
> @@ -5246,9 +5247,13 @@ int __pci_reset_function_locked(struct pci_dev *dev)
>  		if (!m)
>  			return -ENOTTY;
>  
> -		rc = pci_reset_fn_methods[m].reset_fn(dev, PCI_RESET_DO_RESET);
> +		method = &pci_reset_fn_methods[m];
> +		pci_dbg(dev, "reset via %s\n", method->name);
> +		rc = method->reset_fn(dev, PCI_RESET_DO_RESET);
>  		if (!rc)
>  			return 0;
> +
> +		pci_dbg(dev, "%s failed with %d\n", method->name, rc);
>  		if (rc != -ENOTTY)
>  			return rc;
>  	}
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 869d204a70a3..3d13bb8e5c53 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5230,6 +5230,7 @@  const struct pci_reset_fn_method pci_reset_fn_methods[] = {
 int __pci_reset_function_locked(struct pci_dev *dev)
 {
 	int i, m, rc;
+	const struct pci_reset_fn_method *method;
 
 	might_sleep();
 
@@ -5246,9 +5247,13 @@  int __pci_reset_function_locked(struct pci_dev *dev)
 		if (!m)
 			return -ENOTTY;
 
-		rc = pci_reset_fn_methods[m].reset_fn(dev, PCI_RESET_DO_RESET);
+		method = &pci_reset_fn_methods[m];
+		pci_dbg(dev, "reset via %s\n", method->name);
+		rc = method->reset_fn(dev, PCI_RESET_DO_RESET);
 		if (!rc)
 			return 0;
+
+		pci_dbg(dev, "%s failed with %d\n", method->name, rc);
 		if (rc != -ENOTTY)
 			return rc;
 	}