* [PATCH v4 0/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
@ 2025-08-07 10:15 Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 1/3] PCI/AER: Fix missing uevent on recovery when a reset is requested Niklas Schnelle
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Niklas Schnelle @ 2025-08-07 10:15 UTC (permalink / raw)
To: Bjorn Helgaas, Lukas Wunner, Mahesh J Salgaonkar
Cc: Linas Vepstas, Ilpo Järvinen, Manivannan Sadhasivam,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Niklas Schnelle, Keith Busch
Hi Bjorn, Lukas, Mahesh,
This series adds issuing of uevents during PCI recovery on s390. In
developing this I noticed that pci_uevent_ers() ignores
PCI_ERS_RESULT_NEED_RESET. I think this will result in AER not generating a uevent
at the beginning of recovery if drivers request a reset via the voting
on error_detected() returns. This is fixed in the first patch and relied
upon by the s390 recovery code as it also uses the result of
error_detected() though with one device/driver at a time.
Thanks,
Niklas
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Changes in v4:
- Add change in EEH to use the return of error_detected() in the uevent
just like AER and the new s390 code
- Add R-b from Lukas
- Link to v3: https://lore.kernel.org/r/20250730-add_err_uevents-v3-0-540b158c070f@linux.ibm.com
Changes in v3:
- Reworded cover letter
- Rebase on v6.16
- Link to v2: https://lore.kernel.org/r/20250623-add_err_uevents-v2-0-a3a2cf8e711d@linux.ibm.com
Changes in v2:
- Add a patch fixing pci_uevent_ers() mistakenly ignoring PCI_ERS_RESULT_NEED_RESET
- Use the result of error_detected() for initial pci_uevent_ers()
- Drop fixes tag in s390 patch
- Rebase and re-test on current master
- Link to v1: https://lore.kernel.org/r/20250424-add_err_uevents-v1-1-3384d6b779c6@linux.ibm.com
---
Niklas Schnelle (3):
PCI/AER: Fix missing uevent on recovery when a reset is requested
powerpc/eeh: Use result of error_detected() in uevent
PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
arch/powerpc/kernel/eeh_driver.c | 2 +-
arch/s390/pci/pci_event.c | 3 +++
drivers/pci/pci-driver.c | 3 ++-
include/linux/pci.h | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
---
base-commit: 038d61fd642278bab63ee8ef722c50d10ab01e8f
change-id: 20250417-add_err_uevents-6f8d4d7ce09c
Best regards,
--
Niklas Schnelle
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 1/3] PCI/AER: Fix missing uevent on recovery when a reset is requested
2025-08-07 10:15 [PATCH v4 0/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
@ 2025-08-07 10:15 ` Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 3/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2 siblings, 0 replies; 6+ messages in thread
From: Niklas Schnelle @ 2025-08-07 10:15 UTC (permalink / raw)
To: Bjorn Helgaas, Lukas Wunner, Mahesh J Salgaonkar
Cc: Linas Vepstas, Ilpo Järvinen, Manivannan Sadhasivam,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Niklas Schnelle, Keith Busch
Since commit 7b42d97e99d3 ("PCI/ERR: Always report current recovery
status for udev") AER uses the result of error_detected() as parameter
to pci_uevent_ers(). As pci_uevent_ers() however does not handle
PCI_ERS_RESULT_NEED_RESET this results in a missing uevent for the
beginning of recovery if drivers request a reset. Fix this by treating
PCI_ERS_RESULT_NEED_RESET as beginning recovery.
Cc: stable@vger.kernel.org
Fixes: 7b42d97e99d3 ("PCI/ERR: Always report current recovery status for udev")
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
drivers/pci/pci-driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 67db34fd10ee7101baeeaae1bb9bec3b13e2fdeb..94ba6938b7c6271b557cc7f17ffb89631d83827e 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1592,6 +1592,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type)
switch (err_type) {
case PCI_ERS_RESULT_NONE:
case PCI_ERS_RESULT_CAN_RECOVER:
+ case PCI_ERS_RESULT_NEED_RESET:
envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY";
envp[idx++] = "DEVICE_ONLINE=0";
break;
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent
2025-08-07 10:15 [PATCH v4 0/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 1/3] PCI/AER: Fix missing uevent on recovery when a reset is requested Niklas Schnelle
@ 2025-08-07 10:15 ` Niklas Schnelle
2025-08-07 11:34 ` Lukas Wunner
2025-08-07 10:15 ` [PATCH v4 3/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2 siblings, 1 reply; 6+ messages in thread
From: Niklas Schnelle @ 2025-08-07 10:15 UTC (permalink / raw)
To: Bjorn Helgaas, Lukas Wunner, Mahesh J Salgaonkar
Cc: Linas Vepstas, Ilpo Järvinen, Manivannan Sadhasivam,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Niklas Schnelle, Keith Busch
With pci_uevent_ers() handling PCI_ERS_RESULT_NEED_RESET the result of
error_detected() can be used in pci_uevent_ers() even if drivers request
a reset. This aligns EEH's behavior with both AER.
Suggested-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/linux-pci/aIp6LiKJor9KLVpv@wunner.de/
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
arch/powerpc/kernel/eeh_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 7efe04c68f0fe3fb1c3c13d97d58e79e47cf103b..20ed9685da8b7e6d419a4b02f715b52acfe715d3 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -334,7 +334,7 @@ static enum pci_ers_result eeh_report_error(struct eeh_dev *edev,
rc = driver->err_handler->error_detected(pdev, pci_channel_io_frozen);
edev->in_error = true;
- pci_uevent_ers(pdev, PCI_ERS_RESULT_NONE);
+ pci_uevent_ers(pdev, rc);
return rc;
}
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 3/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
2025-08-07 10:15 [PATCH v4 0/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 1/3] PCI/AER: Fix missing uevent on recovery when a reset is requested Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent Niklas Schnelle
@ 2025-08-07 10:15 ` Niklas Schnelle
2 siblings, 0 replies; 6+ messages in thread
From: Niklas Schnelle @ 2025-08-07 10:15 UTC (permalink / raw)
To: Bjorn Helgaas, Lukas Wunner, Mahesh J Salgaonkar
Cc: Linas Vepstas, Ilpo Järvinen, Manivannan Sadhasivam,
Gerald Schaefer, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Niklas Schnelle, Keith Busch
Issue uevents during PCI recovery using pci_uevent_ers() as done by EEH
and AER PCIe recovery routines.
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
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 d930416d4c903f709764b75fe45fb66e529fcc5b..b95376041501f479eee20705d45fb8c68553da71 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -88,6 +88,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, ers_res);
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)
@@ -244,6 +245,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
ers_res = PCI_ERS_RESULT_RECOVERED;
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)";
@@ -253,6 +255,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 94ba6938b7c6271b557cc7f17ffb89631d83827e..2f3037050fd011108ef93e39d2d78a5c7e22fd05 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1578,7 +1578,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 05e68f35f39238f8b9ce08df97b384d1c1e89bbe..bcc412a21d93a6dcc566f011258ed39d80d896c2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2737,7 +2737,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
--
2.48.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent
2025-08-07 10:15 ` [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent Niklas Schnelle
@ 2025-08-07 11:34 ` Lukas Wunner
2025-08-07 11:49 ` Niklas Schnelle
0 siblings, 1 reply; 6+ messages in thread
From: Lukas Wunner @ 2025-08-07 11:34 UTC (permalink / raw)
To: Niklas Schnelle
Cc: Bjorn Helgaas, Mahesh J Salgaonkar, Linas Vepstas,
Ilpo Järvinen, Manivannan Sadhasivam, Gerald Schaefer,
Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Keith Busch
On Thu, Aug 07, 2025 at 12:15:32PM +0200, Niklas Schnelle wrote:
> With pci_uevent_ers() handling PCI_ERS_RESULT_NEED_RESET the result of
> error_detected() can be used in pci_uevent_ers() even if drivers request
> a reset. This aligns EEH's behavior with both AER.
I guess the sentence is supposed to end with "and s390"?
I would have recounted the history a bit, e.g.:
Ever since uevent support was added for AER and EEH with commit
856e1eb9bdd4 ("PCI/AER: Add uevents in AER and EEH error/resume"), it
reported PCI_ERS_RESULT_NONE as the result of ->error_detected() to
user space.
Commit 7b42d97e99d3 ("PCI/ERR: Always report current recovery status for
udev") subsequently amended AER to report the actual return value of
->error_detected().
Make the same change to EEH to align it with AER (and s390 error
recovery).
> Suggested-by: Lukas Wunner <lukas@wunner.de>
> Link: https://lore.kernel.org/linux-pci/aIp6LiKJor9KLVpv@wunner.de/
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent
2025-08-07 11:34 ` Lukas Wunner
@ 2025-08-07 11:49 ` Niklas Schnelle
0 siblings, 0 replies; 6+ messages in thread
From: Niklas Schnelle @ 2025-08-07 11:49 UTC (permalink / raw)
To: Lukas Wunner
Cc: Bjorn Helgaas, Mahesh J Salgaonkar, Linas Vepstas,
Ilpo Järvinen, Manivannan Sadhasivam, Gerald Schaefer,
Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle, Peter Oberparleiter,
Matthew Rosato, Oliver O'Halloran, Sinan Kaya, linuxppc-dev,
linux-s390, linux-kernel, linux-pci, Keith Busch
On Thu, 2025-08-07 at 13:34 +0200, Lukas Wunner wrote:
> On Thu, Aug 07, 2025 at 12:15:32PM +0200, Niklas Schnelle wrote:
> > With pci_uevent_ers() handling PCI_ERS_RESULT_NEED_RESET the result of
> > error_detected() can be used in pci_uevent_ers() even if drivers request
> > a reset. This aligns EEH's behavior with both AER.
>
> I guess the sentence is supposed to end with "and s390"?
Yes had it there and then realized that this is only true after the
last patch, did a bad job of adjusting.
>
> I would have recounted the history a bit, e.g.:
>
> Ever since uevent support was added for AER and EEH with commit
> 856e1eb9bdd4 ("PCI/AER: Add uevents in AER and EEH error/resume"), it
> reported PCI_ERS_RESULT_NONE as the result of ->error_detected() to
> user space.
>
> Commit 7b42d97e99d3 ("PCI/ERR: Always report current recovery status for
> udev") subsequently amended AER to report the actual return value of
> ->error_detected().
>
> Make the same change to EEH to align it with AER (and s390 error
> recovery).
Thanks for figuring out the history, I'll incorporate this and send a
v5.
>
> > Suggested-by: Lukas Wunner <lukas@wunner.de>
> > Link: https://lore.kernel.org/linux-pci/aIp6LiKJor9KLVpv@wunner.de/
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>
> Reviewed-by: Lukas Wunner <lukas@wunner.de>
Thanks for the R-b.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-07 11:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 10:15 [PATCH v4 0/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 1/3] PCI/AER: Fix missing uevent on recovery when a reset is requested Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 2/3] powerpc/eeh: Use result of error_detected() in uevent Niklas Schnelle
2025-08-07 11:34 ` Lukas Wunner
2025-08-07 11:49 ` Niklas Schnelle
2025-08-07 10:15 ` [PATCH v4 3/3] PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery 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).