pds_core: cancel pending PCI reset work on AER recovery
Subsystems (3)
PATCH 1/1 pds_core: cancel pending PCI reset work on AER recovery
pdsc_check_pci_health() queues pci_reset_work when it sees a broken PCI connection, and nothing cancels it. When the PCI core starts AER recovery, pdsc_pci_error_detected() runs pdsc_reset_prepare() and recovers the device, but a pci_reset_work queued just before is left pending. If it runs after recovery released the device lock, it resets a device the driver now considers healthy, bouncing the link for no reason.
Cancel pci_reset_work in pdsc_pci_error_detected() after pdsc_reset_prepare(), which has already stopped the health thread so it cannot requeue the work. cancel_work_sync() is safe under the device lock here because pdsc_pci_reset_thread() uses pci_try_reset_function(), which returns instead of blocking on the lock. Only PFs initialize pci_reset_work, so guard the cancel with !is_virtfn.
--- drivers/net/ethernet/amd/pds_core/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/amd/pds_core/main.c +4 -0
@@ -555,7 +555,11 @@ static pci_ers_result_t pdsc_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t error) {if (error == pci_channel_io_frozen) { +struct pdsc *pdsc =pci_get_drvdata (pdev); +pdsc_reset_prepare (pdev); +if (!pdev->is_virtfn) +cancel_work_sync (&pdsc->pci_reset_work);return PCI_ERS_RESULT_NEED_RESET ; }
Signature · 1 line
2.43.0
Quoted 28 lines · Nikhil P. Rao
pdsc_check_pci_health()queuespci_reset_workwhen it sees a broken PCI connection, and nothing cancels it. When the PCI core starts AER recovery,pdsc_pci_error_detected()runspdsc_reset_prepare()and recovers the device, but apci_reset_workqueued just before is left pending. If it runs after recovery released the device lock, it resets a device the driver now considers healthy, bouncing the link for no reason.Cancel
pci_reset_workinpdsc_pci_error_detected()afterpdsc_reset_prepare(), which has already stopped the health thread so it cannot requeue the work.cancel_work_sync()is safe under the device lock here becausepdsc_pci_reset_thread()usespci_try_reset_function(), which returns instead of blocking on the lock. Only PFs initializepci_reset_work, so guard the cancel with !is_virtfn.Fixes 81665adf25d2 ("pds_core: Fix pdsc_check_pci_health function to use work thread")Reported-by sashiko-bot <[email protected]>Signed-off-by Nikhil P. Rao <[email protected]>--- drivers/net/ethernet/amd/pds_core/main.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/ethernet/amd/pds_core/main.c +0
-0@@ -555,7 +555,11 @@ static pci_ers_result_t pdsc_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t error)
drivers/net/ethernet/amd/pds_core/main.c static pci_ers_result_t pdsc_pci_error_detected(struct pci_dev *pdev, · line 565
Quoted 10 lines
drivers/net/ethernet/amd/pds_core/main.c +4
-0{if (error == pci_channel_io_frozen) { +struct pdsc *pdsc =pci_get_drvdata (pdev); +pdsc_reset_prepare (pdev); +if (!pdev->is_virtfn) +cancel_work_sync (&pdsc->pci_reset_work);return PCI_ERS_RESULT_NEED_RESET ; }
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 27 Jul 2026 17:00:30 +0000 you wrote:
pdsc_check_pci_health()queuespci_reset_workwhen it sees a broken PCI connection, and nothing cancels it. When the PCI core starts AER recovery,pdsc_pci_error_detected()runspdsc_reset_prepare()and recovers the device, but apci_reset_workqueued just before is left pending. If it runs after recovery released the device lock, it resets a device the driver now considers healthy, bouncing the link for no reason.[...]
Here is the summary with links:
- [net] pds_core: cancel pending PCI reset work on AER recovery
https://git.kernel.org/netdev/net/c/57d635329d79
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html