From: sashiko-bot@kernel.org
To: "Ziyou Wang (Lenovo)" <ziyou.dev@foxmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3] PCI/DPC: Increase recovery timeout to 60 seconds
Date: Sat, 05 Dec 2026 12:34:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-251495@kernel.org> (raw)
In-Reply-To: <tencent_646202B910D8DCC6ADF5705708D37A8EA20A@qq.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] PCI/DPC: pci_dpc_recovered() 60s timeout still expires before
bus wait
- [Medium] PCI/DPC: 60s pci_dpc_recovered() timeout stalls pciehp_ist()
on abort
- [Low] PCI/DPC: inaccurate Fixes tag should cite 53b54ad074de
- [Low] PCI/DPC: commit message misattributes device recovery failed to
pciehp
--
commit 9a32d3980f0ddb00d7fceea27e5dec2fdeb80fe2
Author: Ziyou Wang (Lenovo) <ziyou.dev@foxmail.com>
PCI/DPC: Increase recovery timeout to 60 seconds
This commit moves PCIE_RESET_READY_POLL_MS from drivers/pci/pci.c to
drivers/pci/pci.h and increases the wait_event_timeout() in
pci_dpc_recovered() from 4 seconds to 60 seconds.
> Some NVMe devices need more than 5 seconds to recover after DPC
> containment, but pci_dpc_recovered() waits only 4 seconds. If the device
> hasn't recovered by then, pciehp reports "device recovery failed" and
> the device is re-enumerated.
[Severity: Low]
Does pciehp report "device recovery failed" here? When
pci_dpc_recovered() times out, pciehp_handle_presence_or_link_change()
logs "Slot(%s): Link Down" and tears down the slot; that concurrent
teardown causes dpc_reset_link() to fail, and pcie_do_recovery() logs
"AER: device recovery failed".
[ ... ]
> Fixes: a97396c6eb13 ("PCI: pciehp: Ignore Link Down/Up caused by DPC")
[Severity: Low]
Should the Fixes: tag cite commit 53b54ad074de ("PCI/DPC: Await
readiness of secondary bus after reset") instead?
When a97396c6eb13 ("PCI: pciehp: Ignore Link Down/Up caused by DPC")
added the 4-second timeout, dpc_reset_link() only waited on
pcie_wait_for_link(). The later commit replaced that with
pci_bridge_wait_for_secondary_bus(), introducing the timeout mismatch.
[ ... ]
> diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
> index e030811a43c78..c3f4317b2eb35 100644
> --- a/drivers/pci/pcie/dpc.c
> +++ b/drivers/pci/pcie/dpc.c
> @@ -108,10 +108,10 @@ bool pci_dpc_recovered(struct pci_dev *pdev)
> /*
> * Need a timeout in case DPC never completes due to failure of
> * dpc_wait_rp_inactive(). The spec doesn't mandate a time limit,
> - * but reports indicate that DPC completes within 4 seconds.
> + * so use the same timeout as pci_bridge_wait_for_secondary_bus().
> */
> wait_event_timeout(dpc_completed_waitqueue, dpc_completed(pdev),
> - msecs_to_jiffies(4000));
> + msecs_to_jiffies(PCIE_RESET_READY_POLL_MS));
>
> return test_and_clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
> }
[Severity: Medium]
Can this 60-second timeout still expire before
pci_bridge_wait_for_secondary_bus() finishes?
Before pci_bridge_wait_for_secondary_bus() starts, DPC runs driver
error_detected() callbacks plus up to 2 s in pcie_wait_for_link() and
dpc_wait_rp_inactive().
Inside pci_dev_wait(), delay doubles after each msleep() and checks
delay > timeout (59900 ms) before sleeping, so at delay == 32768 the
cumulative wait in pci_dev_wait() alone reaches 65535 ms.
For a device that takes more than ~32.8 s to respond,
pci_dpc_recovered() times out and pciehp tears down the slot
concurrently with dpc_reset_link(). If dpc_reset_link() then sets
PCI_DPC_RECOVERED, that stale bit can hide a later Link Down event.
Since dpc_reset_link() always clears PCI_DPC_RECOVERING and wakes
dpc_completed_waitqueue on exit, waiting while PCI_DPC_RECOVERING is set
does not need to be capped at 60 seconds.
[Severity: Medium]
Will extending this wait to 60 seconds stall pciehp_ist() for a full
minute when DPC recovery aborts?
If dpc_wait_rp_inactive() fails after 1 s in dpc_reset_link(), it jumps
to out: without clearing PCI_EXP_DPC_STATUS_TRIGGER and wakes
dpc_completed_waitqueue. Because dpc_completed() still sees that bit
set, wait_event_timeout() sleeps for the remaining ~59 seconds.
While stalled with ctrl->ist_running set, pciehp_ist() delays slot
teardown and blocks sysfs slot enable/disable on ctrl->requester and
pciehp_remove() in pciehp_free_irq(). Any later PDC or DLLSC event
repeats the 60-second stall while PCI_EXP_DPC_STATUS_TRIGGER stays set.
Signaling DPC abort to dpc_completed(), or separating a short wait for
PCI_EXP_DPC_STATUS_TRIGGER from waiting on PCI_DPC_RECOVERING, would
avoid this regression.
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_646202B910D8DCC6ADF5705708D37A8EA20A@qq.com?part=1
prev parent reply other threads:[~2026-12-05 12:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261106082612.1840817-1-ziyou.dev@foxmail.com>
2026-11-06 8:56 ` [PATCH v2] PCI/DPC: Increase recovery timeout to 60 seconds Ziyou Wang (Lenovo)
2026-11-06 9:05 ` sashiko-bot
2026-11-06 15:21 ` Bjorn Helgaas
2026-11-19 3:30 ` Ziyou Wang (Lenovo)
2026-11-19 9:01 ` Lukas Wunner
2026-11-20 3:22 ` Ziyou Wang (Lenovo)
2026-12-04 2:14 ` Ziyou Wang (Lenovo)
2026-12-04 10:44 ` Lukas Wunner
2026-12-04 17:19 ` Creeley, Brett
2026-12-05 12:19 ` [PATCH v3] " Ziyou Wang (Lenovo)
2026-12-05 12:34 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-251495@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ziyou.dev@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.