linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set
@ 2021-08-21 13:30 Shanker Donthineni
  2021-08-21 15:26 ` Shanker R Donthineni
  0 siblings, 1 reply; 2+ messages in thread
From: Shanker Donthineni @ 2021-08-21 13:30 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alex Williamson, linux-pci, linux-kernel, linuxppc-dev,
	Oliver O'Halloran, Russell Currey, Shanker Donthineni

In the current implementation, the AER FATAL and NONFTAL recovery will be
terminated for the device that exhibits NO_BUS_RESET quirk. The non-zero
return value from pci_bus_error_reset() is treated as an error condition
in aer_root_reset() which leads to return PCI_ERS_RESULT_DISCONNECT.

  aer_recover_work_func()
    pcie_do_recovery()
      report_frozen_detected()
      if (aer_root_reset() == PCI_ERS_RESULT_DISCONNECT)
         goto failed           # termimates here because of NO_BUS_RESET

      ...
      report_mmio_enabled()
      report_resume()
      pcie_clear_xxx_status()
      ...
      return 0
  failed:
      pci_uevent_ers(PCI_ERS_RESULT_DISCONNECT);

The return value -ENOTTY from pci_bus_error_reset() indicates SBR was
skipped but no real errors were encountered. This scenario could be
considered as a non-error case so that the PCI device driver gets the
opportunity to recover the device back to an operational state instead
of keeping it in the DISCONNECT state.

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
---
 drivers/pci/pcie/aer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 9784fdcf30061..8cf6bd6a3376d 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -1414,8 +1414,12 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
 			pci_info(dev, "not reset (no FLR support: %d)\n", rc);
 	} else {
 		rc = pci_bus_error_reset(dev);
-		pci_info(dev, "%s Port link has been reset (%d)\n",
-			pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc);
+		pci_info(dev, "%s Port link has %sbeen reset (%d)\n",
+			pci_is_root_bus(dev->bus) ? "Root" : "Downstream",
+			rc == -ENOTTY ? "not " : "", rc);
+
+		if (rc == -ENOTTY)
+			rc = 0;
 	}
 
 	if ((host->native_aer || pcie_ports_native) && aer) {
-- 
2.25.1


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

* Re: [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set
  2021-08-21 13:30 [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set Shanker Donthineni
@ 2021-08-21 15:26 ` Shanker R Donthineni
  0 siblings, 0 replies; 2+ messages in thread
From: Shanker R Donthineni @ 2021-08-21 15:26 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Alex Williamson, linux-pci, linux-kernel, linuxppc-dev,
	Oliver O'Halloran, Russell Currey



On 8/21/21 8:30 AM, Shanker Donthineni wrote:
> External email: Use caution opening links or attachments
>
>
> In the current implementation, the AER FATAL and NONFTAL recovery will be
> terminated for the device that exhibits NO_BUS_RESET quirk. The non-zero

Correction, this problem happens only for AER_FATAL recovery case.

> return value from pci_bus_error_reset() is treated as an error condition
> in aer_root_reset() which leads to return PCI_ERS_RESULT_DISCONNECT.
>
>   aer_recover_work_func()
>     pcie_do_recovery()
>       report_frozen_detected()
>       if (aer_root_reset() == PCI_ERS_RESULT_DISCONNECT)
>          goto failed           # termimates here because of NO_BUS_RESET
>
>       ...
>       report_mmio_enabled()
>       report_resume()
>       pcie_clear_xxx_status()
>       ...
>       return 0
>   failed:
>       pci_uevent_ers(PCI_ERS_RESULT_DISCONNECT);
>
> The return value -ENOTTY from pci_bus_error_reset() indicates SBR was
> skipped but no real errors were encountered. This scenario could be
> considered as a non-error case so that the PCI device driver gets the
> opportunity to recover the device back to an operational state instead
> of keeping it in the DISCONNECT state.
>
> Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> ---
>  drivers/pci/pcie/aer.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 9784fdcf30061..8cf6bd6a3376d 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1414,8 +1414,12 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
>                         pci_info(dev, "not reset (no FLR support: %d)\n", rc);
>         } else {
>                 rc = pci_bus_error_reset(dev);
> -               pci_info(dev, "%s Port link has been reset (%d)\n",
> -                       pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc);
> +               pci_info(dev, "%s Port link has %sbeen reset (%d)\n",
> +                       pci_is_root_bus(dev->bus) ? "Root" : "Downstream",
> +                       rc == -ENOTTY ? "not " : "", rc);
> +
> +               if (rc == -ENOTTY)
> +                       rc = 0;
>         }
>
>         if ((host->native_aer || pcie_ports_native) && aer) {
> --
> 2.25.1
>


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

end of thread, other threads:[~2021-08-21 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 13:30 [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set Shanker Donthineni
2021-08-21 15:26 ` Shanker R Donthineni

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).