Re: [PATCH v1] PCI/AER: Avoid power state transition during system suspend
From: Rafael J. Wysocki
Date: Thu Apr 03 2025 - 14:36:15 EST
On Thu, Apr 3, 2025 at 9:45 AM Raag Jadav <raag.jadav@xxxxxxxxx> wrote:
>
> If an error is triggered while system suspend is in progress, any bus
> level power state transition will result in unpredictable error handling.
> Mark skip_bus_pm flag as true to avoid this.
This needs to be synchronized with the skip_bus_pm clearing in pci_pm_suspend().
Also, skip_bus_pm is only used in the _noirq phases, so if a driver
calls pci_set_power_state() from its ->suspend() callback, this change
won't help.
I think that you're aware of it, but the changelog should mention this
limitation.
> Signed-off-by: Raag Jadav <raag.jadav@xxxxxxxxx>
> ---
>
> Ideally we'd want to defer recovery until system resume, but this is
> good enough to prevent device suspend.
>
> More discussion at [1].
> [1] https://lore.kernel.org/r/Z-38rPeN_j7YGiEl@xxxxxxxxxxxxxxxxxx
>
> drivers/pci/pcie/aer.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 508474e17183..5acf4efc2df3 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1108,6 +1108,12 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info)
>
> static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)
> {
> + /*
> + * Avoid any power state transition if an error is triggered during
> + * system suspend.
> + */
> + dev->skip_bus_pm = true;
> +
> cxl_rch_handle_error(dev, info);
> pci_aer_handle_error(dev, info);
> pci_dev_put(dev);
> --