linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
@ 2025-04-24 12:02 Niklas Schnelle
  2025-05-13 10:57 ` Niklas Schnelle
  0 siblings, 1 reply; 2+ messages in thread
From: Niklas Schnelle @ 2025-04-24 12:02 UTC (permalink / raw)
  To: Lukas Wunner, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Bjorn Helgaas, Peter Oberparleiter, Matthew Rosato,
	Mahesh J Salgaonkar, Oliver O'Halloran
  Cc: linuxppc-dev, linux-s390, linux-kernel, linux-pci,
	Niklas Schnelle

Issue uevents during PCI recovery using pci_uevent_ers() as done by EEH
and AER PCIe recovery routines.

Cc: stable@vger.kernel.org
Fixes: 4cdf2f4e24ff ("s390/pci: implement minimal PCI error recovery")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Question: pci_uevent_ers() ignores PCI_ERS_RESULT_NEED_RESET which also
means that unless we use PCI_ERS_RESULT_NONE instead of the return of
error_detected() like EEH also does. there is no event for beginning
recovery. This is also true for AER and seems odd, is this intentional?

Npte: The fixes tag / Cc stable is maybe a bit borderline but I think
having the events on EEH and AER but not on s390 warrants it. Thoughts?
---
 arch/s390/pci/pci_event.c | 3 +++
 drivers/pci/pci-driver.c  | 2 +-
 include/linux/pci.h       | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
index 7bd7721c1239a20e13cd3c618cce6679f36b0d06..37609bc2b514c00b5b91d6edd2ec366d59ae9f49 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -91,6 +91,7 @@ static pci_ers_result_t zpci_event_notify_error_detected(struct pci_dev *pdev,
 	pci_ers_result_t ers_res = PCI_ERS_RESULT_DISCONNECT;
 
 	ers_res = driver->err_handler->error_detected(pdev,  pdev->error_state);
+	pci_uevent_ers(pdev, PCI_ERS_RESULT_NONE);
 	if (ers_result_indicates_abort(ers_res))
 		pr_info("%s: Automatic recovery failed after initial reporting\n", pci_name(pdev));
 	else if (ers_res == PCI_ERS_RESULT_NEED_RESET)
@@ -226,6 +227,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
 		ers_res = zpci_event_do_reset(pdev, driver);
 
 	if (ers_res != PCI_ERS_RESULT_RECOVERED) {
+		pci_uevent_ers(pdev, PCI_ERS_RESULT_DISCONNECT);
 		pr_err("%s: Automatic recovery failed; operator intervention is required\n",
 		       pci_name(pdev));
 		status_str = "failed (driver can't recover)";
@@ -235,6 +237,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
 	pr_info("%s: The device is ready to resume operations\n", pci_name(pdev));
 	if (driver->err_handler->resume)
 		driver->err_handler->resume(pdev);
+	pci_uevent_ers(pdev, PCI_ERS_RESULT_RECOVERED);
 out_unlock:
 	pci_dev_unlock(pdev);
 	zpci_report_status(zdev, "recovery", status_str);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index c8bd71a739f724e09b4dd773fb0cf74bddda1728..5cc031fae9a0210d66959ce6082539e52cdd81b4 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1584,7 +1584,7 @@ static int pci_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
-#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
+#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH) || defined(CONFIG_S390)
 /**
  * pci_uevent_ers - emit a uevent during recovery path of PCI device
  * @pdev: PCI device undergoing error recovery
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0e8e3fd77e96713054388bdc82f439e51023c1bf..71628a9c61bd7bc90fdbd9bc6ab68603ac8800dd 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2688,7 +2688,7 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
 	return false;
 }
 
-#if defined(CONFIG_PCIEPORTBUS) || defined(CONFIG_EEH)
+#if defined(CONFIG_PCIEPORTBUS) || defined(CONFIG_EEH) || defined(CONFIG_S390)
 void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);
 #endif
 

---
base-commit: 8ffd015db85fea3e15a77027fda6c02ced4d2444
change-id: 20250417-add_err_uevents-6f8d4d7ce09c

Best regards,
-- 
Niklas Schnelle


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

* Re: [PATCH] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
  2025-04-24 12:02 [PATCH] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
@ 2025-05-13 10:57 ` Niklas Schnelle
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Schnelle @ 2025-05-13 10:57 UTC (permalink / raw)
  To: Lukas Wunner, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Bjorn Helgaas, Peter Oberparleiter, Matthew Rosato,
	Mahesh J Salgaonkar, Oliver O'Halloran
  Cc: linuxppc-dev, linux-s390, linux-kernel, linux-pci

On Thu, 2025-04-24 at 14:02 +0200, Niklas Schnelle wrote:
> Issue uevents during PCI recovery using pci_uevent_ers() as done by EEH
> and AER PCIe recovery routines.
> 
> Cc: stable@vger.kernel.org
> Fixes: 4cdf2f4e24ff ("s390/pci: implement minimal PCI error recovery")
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Question: pci_uevent_ers() ignores PCI_ERS_RESULT_NEED_RESET which also
> means that unless we use PCI_ERS_RESULT_NONE instead of the return of
> error_detected() like EEH also does. there is no event for beginning
> recovery. This is also true for AER and seems odd, is this intentional?
> 
> Npte: The fixes tag / Cc stable is maybe a bit borderline but I think
> having the events on EEH and AER but not on s390 warrants it. Thoughts?
> ---
>  arch/s390/pci/pci_event.c | 3 +++
>  drivers/pci/pci-driver.c  | 2 +-
>  include/linux/pci.h       | 2 +-
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
> index 7bd7721c1239a20e13cd3c618cce6679f36b0d06..37609bc2b514c00b5b91d6edd2ec366d59ae9f49 100644
> --- a/arch/s390/pci/pci_event.c
> +++ b/arch/s390/pci/pci_event.c
> @@ -91,6 +91,7 @@ static pci_ers_result_t zpci_event_notify_error_detected(struct pci_dev *pdev,
>  	pci_ers_result_t ers_res = PCI_ERS_RESULT_DISCONNECT;
>  
>  	ers_res = driver->err_handler->error_detected(pdev,  pdev->error_state);
> +	pci_uevent_ers(pdev, PCI_ERS_RESULT_NONE);
>  	if (ers_result_indicates_abort(ers_res))
>  		pr_info("%s: Automatic recovery failed after initial reporting\n", pci_name(pdev));
>  	else if (ers_res == PCI_ERS_RESULT_NEED_RESET)
> @@ -226,6 +227,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
>  		ers_res = zpci_event_do_reset(pdev, driver);
>  
>  	if (ers_res != PCI_ERS_RESULT_RECOVERED) {
> +		pci_uevent_ers(pdev, PCI_ERS_RESULT_DISCONNECT);
>  		pr_err("%s: Automatic recovery failed; operator intervention is required\n",
>  		       pci_name(pdev));
>  		status_str = "failed (driver can't recover)";
> @@ -235,6 +237,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
>  	pr_info("%s: The device is ready to resume operations\n", pci_name(pdev));
>  	if (driver->err_handler->resume)
>  		driver->err_handler->resume(pdev);
> +	pci_uevent_ers(pdev, PCI_ERS_RESULT_RECOVERED);
>  out_unlock:
>  	pci_dev_unlock(pdev);
>  	zpci_report_status(zdev, "recovery", status_str);
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index c8bd71a739f724e09b4dd773fb0cf74bddda1728..5cc031fae9a0210d66959ce6082539e52cdd81b4 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1584,7 +1584,7 @@ static int pci_uevent(const struct device *dev, struct kobj_uevent_env *env)
>  	return 0;
>  }
>  
> -#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH)
> +#if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH) || defined(CONFIG_S390)
>  /**
>   * pci_uevent_ers - emit a uevent during recovery path of PCI device
>   * @pdev: PCI device undergoing error recovery
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 0e8e3fd77e96713054388bdc82f439e51023c1bf..71628a9c61bd7bc90fdbd9bc6ab68603ac8800dd 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -2688,7 +2688,7 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
>  	return false;
>  }
>  
> -#if defined(CONFIG_PCIEPORTBUS) || defined(CONFIG_EEH)
> +#if defined(CONFIG_PCIEPORTBUS) || defined(CONFIG_EEH) || defined(CONFIG_S390)
>  void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);
>  #endif
>  
> 
> ---
> base-commit: 8ffd015db85fea3e15a77027fda6c02ced4d2444
> change-id: 20250417-add_err_uevents-6f8d4d7ce09c
> 
> Best regards,

Gentle ping.

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

end of thread, other threads:[~2025-05-13 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 12:02 [PATCH] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2025-05-13 10:57 ` Niklas Schnelle

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