Hi, On 9/27/2026 11:02 AM, Lukas Wunner wrote: > From: Yury Murashka <[email protected]> > > pcie_do_recovery() only clears the error status bits of an error-reporting > device if recovery succeeds, but not if it fails. (E.g. because reset > failed, drivers are missing pci_error_handlers or those handlers failed.) > > One undesirable consequence is that the AER driver may subsequently > identify a wrong device when searching for error-reporting devices in > is_error_source(), due to stale bits on an unaffected device. > > Avoid by clearing error status bits on recovery failure. > > Link: > https://lore.kernel.org/r/CAPzpGcRCTCZtaX1EVaJNZ103THZKsoszZduY7=gwfydcrmo...@mail.gmail.com/ > Signed-off-by: Yury Murashka <[email protected]> > [lukas: drop cmdline param, rewrite commit msg, tag for stable] > Signed-off-by: Lukas Wunner <[email protected]> > Cc: [email protected] > --- > drivers/pci/pcie/err.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c > index d77403d8855b..cfcfc7e4f10d 100644 > --- a/drivers/pci/pcie/err.c > +++ b/drivers/pci/pcie/err.c > @@ -284,6 +284,11 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, > return status; > > failed: > + if (host->native_aer || pcie_ports_native) {
If Bjorn takes AER cleanup patch before this series, we can avoid sprinkling pcie_ports_native checks everywhere. https://lore.kernel.org/linux-pci/20260922204548.3884906-1-sathyanarayanan.kuppusw...@linux.intel.com/ > + pcie_clear_device_status(dev); > + pci_aer_clear_nonfatal_status(dev); This only clears Non-Fatal status bits. On the success path, Fatal status bits are cleared by pci_restore_state() -> pci_aer_clear_status(), which drivers call from their ->slot_reset() callback. On the failure path, that may not happen (e.g. if the reset failed or the driver lacks pci_error_handlers). > + } > + > pci_walk_bridge(bridge, pci_pm_runtime_put, NULL); > > pci_walk_bridge(bridge, report_perm_failure_detected, NULL); -- Sathyanarayanan Kuppuswamy Linux Kernel Developer
