PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
Subsystems (4)
Niklas Schnelle
maintainerv3 cover PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
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
---
Changes in v3:
- Reworded cover letter
- Rebase on v6.16
- Link to v2: https://lore.kernel.org/r/[email protected]
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/[email protected]
---
Niklas Schnelle (2):
PCI/AER: Fix missing uevent on recovery when a reset is requested PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
arch/s390/pci/pci_event.c | 3 +++ drivers/pci/pci-driver.c | 3 ++- include/linux/pci.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
---
base-commit: 038d61fd642278bab63ee8ef722c50d10ab01e8f
change-id: 20250417-add_err_uevents-6f8d4d7ce09c
Best regards,
Signature · 1 line
Niklas Schnelle
Niklas Schnelle
maintainerPATCH v3 1/2 PCI/AER: Fix missing uevent on recovery when a reset is requested
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.
--- drivers/pci/pci-driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pci-driver.c +1 -0
@@ -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 ;
Signature · 1 line
2.48.1
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Quoted 6 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.
[...]
drivers/pci/pci-driver.c void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) · line 1598
Quoted 9 lines
+++
b/drivers/pci/pci-driver.cdrivers/pci/pci-driver.c +1
-0@@ -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 ;
I note that PCI_ERS_RESULT_NO_AER_DRIVER is also missing in that switch/case statement. I guess for the patch to be complete, it needs to be added to the PCI_ERS_RESULT_DISCONNECT case. Do you agree?
If you do and respin the patch with that change, feel free to add my Reviewed-by.
Since you're an IBMer and EEH is maintained by IBM, I'm wondering if it would be possible to amend EEH to report "rc" instead of PCI_ERS_RESULT_NONE in eeh_report_error()? There are multiple deviations between AER and EEH, this is one of them. It would be good to move towards a more consistent recovery process across platforms.
Thanks,
Lukas
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Quoted 8 lines · Lukas Wunner
Quoted 6 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.[...]
Quoted 14 lines
drivers/pci/pci-driver.c void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) · line 1598
Quoted 9 lines
+++
b/drivers/pci/pci-driver.cdrivers/pci/pci-driver.c +1
-0@@ -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 ;I note that
PCI_ERS_RESULT_NO_AER_DRIVERis also missing in that switch/case statement. I guess for the patch to be complete, it needs to be added to thePCI_ERS_RESULT_DISCONNECTcase. Do you agree?
I realize now there's a bigger problem here: In pcie_do_recovery(), when control reaches the "failed:" label, a uevent is only signaled for the *bridge*. Shouldn't a uevent instead be signaled for every device *below* the bridge? (And possibly the bridge itself if it was the device reporting the error.)
In that case you don't need to add PCI_ERS_RESULT_NO_AER_DRIVER to the switch/case statement because we wouldn't want to have multiple uevents reporting disconnect, so the one emitted below the "failed:" label would be sufficient.
Right now we may report BEGIN_RECOVERY to user space, but we fail to later on signal FAILED_RECOVERY (unless I'm missing something).
This all looks so broken that I'm starting to wonder if there's any user space application at all that takes advantage of these uevents?
Thanks,
Lukas
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Quoted 24 lines · Lukas Wunner
Quoted 8 lines · Lukas Wunner
Quoted 6 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.[...]
Quoted 14 lines
Review void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) · line 1598
Quoted 9 lines
+++
b/drivers/pci/pci-driver.c(quoted diff) +1
-0@@ -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;I note that
PCI_ERS_RESULT_NO_AER_DRIVERis also missing in that switch/case statement. I guess for the patch to be complete, it needs to be added to thePCI_ERS_RESULT_DISCONNECTcase. Do you agree?
Quoted 5 lines
I realize now there's a bigger problem here: In
pcie_do_recovery(), when control reaches the "failed:" label, a uevent is only signaled for the *bridge*. Shouldn't a uevent instead be signaled for every device *below* the bridge? (And possibly the bridge itself if it was the device reporting the error.)
The small patch below should resolve this issue.
Please let me know what you think.
Quoted 4 lines
In that case you don't need to add
PCI_ERS_RESULT_NO_AER_DRIVERto the switch/case statement because we wouldn't want to have multiple uevents reporting disconnect, so the one emitted below the "failed:" label would be sufficient.
I'll send a separate Reviewed-by for your original patch as the small patch below should resolve my concern about PCI_ERS_RESULT_NO_AER_DRIVER.
Quoted 2 lines
This all looks so broken that I'm starting to wonder if there's any user space application at all that takes advantage of these uevents?
I'd still be interested to know which user space application you're using to track these uevents?
Thanks,
Lukas
-- >8 --
drivers/pci/pcie/err.c +7 -1
@@ -165,6 +165,12 @@ static int report_resume(struct pci_dev *dev, void *data)return 0 ; } +static int report_disconnect (struct pci_dev *dev,void *data) +{ +pci_uevent_ers (dev,PCI_ERS_RESULT_DISCONNECT ); +return 0 ; +} +/** * pci_walk_bridge - walk bridges potentially AER affected * @bridge: bridge which may be a Port, an RCEC, or an RCiEP
@@ -272,7 +278,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, failed:pci_walk_bridge (bridge, pci_pm_runtime_put,NULL ); -pci_uevent_ers (bridge,PCI_ERS_RESULT_DISCONNECT ); +pci_walk_bridge (bridge, report_disconnect,NULL );pci_info (bridge,"device recovery failed\n" );
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Quoted 54 lines · Lukas Wunner
Quoted 22 lines · Lukas Wunner
Quoted 8 lines · Lukas Wunner
Quoted 6 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.[...]
Quoted 13 lines
Review void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) · line 1598
Quoted 9 lines
+++
b/drivers/pci/pci-driver.c(quoted diff) +1
-0@@ -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;I note that
PCI_ERS_RESULT_NO_AER_DRIVERis also missing in that switch/case statement. I guess for the patch to be complete, it needs to be added to thePCI_ERS_RESULT_DISCONNECTcase. Do you agree?Quoted 5 lines
I realize now there's a bigger problem here: In
pcie_do_recovery(), when control reaches the "failed:" label, a uevent is only signaled for the *bridge*. Shouldn't a uevent instead be signaled for every device *below* the bridge? (And possibly the bridge itself if it was the device reporting the error.)The small patch below should resolve this issue.
Please let me know what you think.Quoted 4 lines
In that case you don't need to add
PCI_ERS_RESULT_NO_AER_DRIVERto the switch/case statement because we wouldn't want to have multiple uevents reporting disconnect, so the one emitted below the "failed:" label would be sufficient.I'll send a separate Reviewed-by for your original patch as the small patch below should resolve my concern about
PCI_ERS_RESULT_NO_AER_DRIVER.Quoted 2 lines
This all looks so broken that I'm starting to wonder if there's any user space application at all that takes advantage of these uevents?
I'd still be interested to know which user space application you're using to track these uevents?
Thanks,
Lukas
-- >8 --
drivers/pci/pcie/err.c +0
-0
drivers/pci/pcie/err.c static int report_resume(struct pci_dev *dev, void *data) · line 172
Quoted 8 lines
drivers/pci/pcie/err.c +5
-0@@ -165,6 +165,12 @@ static int report_resume(struct pci_dev *dev, void *data)return 0 ; } +static int report_disconnect (struct pci_dev *dev,void *data) +{ +pci_uevent_ers (dev,PCI_ERS_RESULT_DISCONNECT ); +return 0 ; +}
Since you are notifying the user space, I am wondering whether the drivers should be notified about the recovery failure?
Quoted 14 lines
drivers/pci/pcie/err.c +2
-1+/** * pci_walk_bridge - walk bridges potentially AER affected * @bridge: bridge which may be a Port, an RCEC, or an RCiEP @@ -272,7 +278,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, failed:pci_walk_bridge (bridge, pci_pm_runtime_put,NULL ); -pci_uevent_ers (bridge,PCI_ERS_RESULT_DISCONNECT ); +pci_walk_bridge (bridge, report_disconnect,NULL );pci_info (bridge,"device recovery failed\n" );
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Quoted 13 lines · Sathyanarayanan Kuppuswamy
drivers/pci/pcie/err.c static int report_resume(struct pci_dev *dev, void *data) · line 171
Quoted 9 lines · Lukas Wunner
+++
b/drivers/pci/pcie/err.cdrivers/pci/pcie/err.c +5
-0@@ -165,6 +165,12 @@ static int report_resume(struct pci_dev *dev, void *data)return 0 ; } +static int report_disconnect (struct pci_dev *dev,void *data) +{ +pci_uevent_ers (dev,PCI_ERS_RESULT_DISCONNECT ); +return 0 ; +}Since you are notifying the user space, I am wondering whether the drivers should be notified about the recovery failure?
The drivers are usually *causing* the recovery failure by returning PCI_ERS_RESULT_DISCONNECT from their pci_error_handlers callbacks (or by lacking pci_error_handlers, in particular ->error_detected()).
So in principle the drivers should be aware of recovery failure.
There are cases where multiple drivers are involved. E.g. on GPUs, there's often a PCIe switch with a graphics device and various sound or telemetry devices. Typically errors are reported by the Upstream Port, so the Secondary Bus Reset occurs at the Root or Downstream Port above the Upstream Port and affects the switch and all subordinate devices. In cases like this, recovery failure may be caused by a single driver (e.g. GPU) and the other drivers (e.g. telemetry) may be unaware of it.
The recovery flow documented in Documentation/PCI/pci-error-recovery.rst was originally conceived for EEH and indeed EEH does notify all drivers of recovery failures by invoking the ->error_detected() callback with channel_state pci_channel_io_perm_failure. See this call ...
eeh_pe_report("error_detected(permanent failure)", pe,
eeh_report_failure, NULL);... in arch/powerpc/kernel/eeh_driver.c below the recover_failed label in eeh_handle_normal_event().
I don't know why pcie_do_recovery() doesn't do the same on recovery failure. This is one of several annoying deviations between AER and EEH. Ideally the behavior should be the same across all platforms so that drivers don't have to cope with platform-specific quirks.
However I think that's orthogonal to the pci_uevent_ers() invocation in pcie_do_recovery().
Thanks,
Lukas
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
Hi Lukas,
Quoted 19 lines · Lukas Wunner
Quoted 12 lines · Sathyanarayanan Kuppuswamy
drivers/pci/pcie/err.c static int report_resume(struct pci_dev *dev, void *data) · line 171
Quoted 9 lines · Lukas Wunner
+++
b/drivers/pci/pcie/err.cdrivers/pci/pcie/err.c +5
-0@@ -165,6 +165,12 @@ static int report_resume(struct pci_dev *dev, void *data)return 0 ; } +static int report_disconnect (struct pci_dev *dev,void *data) +{ +pci_uevent_ers (dev,PCI_ERS_RESULT_DISCONNECT ); +return 0 ; +}Since you are notifying the user space, I am wondering whether the drivers should be notified about the recovery failure?
The drivers are usually *causing* the recovery failure by returning
PCI_ERS_RESULT_DISCONNECTfrom theirpci_error_handlerscallbacks (or by lackingpci_error_handlers, in particular ->error_detected()).So in principle the drivers should be aware of recovery failure.
Quoted 8 lines
There are cases where multiple drivers are involved. E.g. on GPUs, there's often a PCIe switch with a graphics device and various sound or telemetry devices. Typically errors are reported by the Upstream Port, so the Secondary Bus Reset occurs at the Root or Downstream Port above the Upstream Port and affects the switch and all subordinate devices. In cases like this, recovery failure may be caused by a single driver (e.g. GPU) and the other drivers (e.g. telemetry) may be unaware of it.
Yes, my comment was referring to the scenario mentioned above. If one of the subordinate devices fails recovery, then recovery effectively fails for all devices under that downstream port (or root port). Notifying all devices under that port would allow their drivers to perform the necessary cleanup
Quoted 11 lines
The recovery flow documented in
Documentation/PCI/pci-error-recovery.rstwas originally conceived for EEH and indeed EEH does notify all drivers of recovery failures by invoking the ->error_detected() callback withchannel_statepci_channel_io_perm_failure. See this call ...eeh_pe_report("error_detected(permanent failure)", pe, eeh_report_failure, NULL);... in
arch/powerpc/kernel/eeh_driver.cbelow therecover_failedlabel ineeh_handle_normal_event().
Agree. The current implementation does not seem to follow the steps mentioned in the Documentation/PCI/pci-error-recovery.rst.
STEP 6: Permanent Failure
-------------------------
A "permanent failure" has occurred, and the platform cannot recover the device. The platform will call error_detected() with a pci_channel_state_t value of pci_channel_io_perm_failure.
The device driver should, at this point, assume the worst. It should cancel all pending I/O, refuse all new I/O, returning -EIO to higher layers. The device driver should then clean up all of its memory and remove itself from kernel operations, much as it would during system shutdown.
Quoted 8 lines
I don't know why
pcie_do_recovery()doesn't do the same on recovery failure. This is one of several annoying deviations between AER and EEH. Ideally the behavior should be the same across all platforms so that drivers don't have to cope with platform-specific quirks.However I think that's orthogonal to the
pci_uevent_ers()invocation inpcie_do_recovery().
Agree. My thought is, since there is an attempt to fix the user notification side of things, may be the driver side should also be fixed together .
Quoted 3 lines
Thanks,
Lukas
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Niklas Schnelle
maintainerRe: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
In reply to Lukas WunnerQuoted 10 lines · Lukas Wunner
Quoted 9 lines · Lukas Wunner
Quoted 8 lines · Lukas Wunner
Quoted 6 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.[...]
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+++
b/drivers/pci/pci-driver.c(quoted diff) +1
-0@@ -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:Quoted 8 lines
Quoted 8 lines
Review void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) · line 1598
Quoted 3 lines
(quoted diff) +0
-0envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY"; envp[idx++] = "DEVICE_ONLINE=0"; break;I note that
PCI_ERS_RESULT_NO_AER_DRIVERis also missing in that switch/case statement. I guess for the patch to be complete, it needs to be added to thePCI_ERS_RESULT_DISCONNECTcase. Do you agree?
As far as I can see PCI_ERS_RESULT_NO_AER_DRIVER only occurs in the AER code and leads to abandoning all recovery attempts for the whole subtree with a disconnect. So my thinking is that the uevent is just disconnect. That also matches your proposal below. Thankfully it looks like there are still kernel messages indicating the reason of the failure.
Quoted 9 lines
Quoted 6 lines
I realize now there's a bigger problem here: In
pcie_do_recovery(), when control reaches the "failed:" label, a uevent is only signaled for the *bridge*. Shouldn't a uevent instead be signaled for every device *below* the bridge? (And possibly the bridge itself if it was the device reporting the error.)The small patch below should resolve this issue.
Please let me know what you think.
The patch makes sense to me I agree one should get uevents for each downstream device. Please Cc me when you send it.
Quoted 12 lines
Quoted 5 lines
In that case you don't need to add
PCI_ERS_RESULT_NO_AER_DRIVERto the switch/case statement because we wouldn't want to have multiple uevents reporting disconnect, so the one emitted below the "failed:" label would be sufficient.I'll send a separate Reviewed-by for your original patch as the small patch below should resolve my concern about
PCI_ERS_RESULT_NO_AER_DRIVER.Quoted 2 lines
This all looks so broken that I'm starting to wonder if there's any user space application at all that takes advantage of these uevents?
Quoted 6 lines
I'd still be interested to know which user space application you're using to track these uevents?
Thanks,
Lukas
Thanks for the R-b! And yes I agree we should minimize the differences between the behavior of the implementations. I'll see if I can sync up on this with Mahesh too.
I only tested this with udevadm so far. That said I had multiple projects ask for ways to monitor for errors/recovery from user-space so at least for s390 there is interest for these events. There is also a bit of mainframe specifics here of course, for example our machines have the ability to fail over a broken PCI link to an I/O drawer with an alternate path and that piggybacks on these recovery mechanisms. And generally, we're looking at expanding our support for and use of PCI error recovery and will hopefully be sharing some more of that soon.
Also note that with the recently released IBM z17 and IBM LinuxONE 5 with Linux we're significantly expanding our reliance on native PCI[0][1].
[0]
https://www.ibm.com/docs/en/linux-on-systems?topic=networking-network-express
[1]
https://vmworkshop.org/2025/present/9175tovr.pdf
Quoted 1 line
Re: [PATCH v3 1/2] PCI/AER: Fix missing uevent on recovery when a reset is requested
In reply to Niklas SchnelleQuoted 10 lines · Niklas Schnelle
Since commit
7b42d97e99d3("PCI/ERR: Always report current recovery status for udev") AER uses the result oferror_detected()as parameter topci_uevent_ers(). Aspci_uevent_ers()however does not handlePCI_ERS_RESULT_NEED_RESETthis results in a missing uevent for the beginning of recovery if drivers request a reset. Fix this by treatingPCI_ERS_RESULT_NEED_RESETas beginning recovery.Fixes 7b42d97e99d3 ("PCI/ERR: Always report current recovery status for udev")Signed-off-by Niklas Schnelle <[email protected]>
Niklas Schnelle
maintainerPATCH v3 2/2 PCI/ERR: s390/pci: Use pci_uevent_ers() in PCI recovery
In reply to Niklas SchnelleIssue uevents during PCI recovery using pci_uevent_ers() as done by EEH and AER PCIe recovery routines.
--- 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(-)
arch/s390/pci/pci_event.c +3 -0
@@ -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);
drivers/pci/pci-driver.c +1 -1
@@ -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
include/linux/pci.h +1 -1
@@ -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
Signature · 1 line
2.48.1
Quoted 4 lines · Niklas Schnelle
Issue uevents during PCI recovery using
pci_uevent_ers()as done by EEH and AER PCIe recovery routines.Signed-off-by Niklas Schnelle <[email protected]>