From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796474087; b=vmuC3PDE1Pkuq89Awqk+sl3iioxBHIUeavngoMgWEHp9E6KxUVa6X3HSlz+JIYBQjqx9 FzkNGvV54rX7GJIqcxZOagesg79wLbMW1pfcIUE8ZRXREkriuBvEZKl3/S4a30MP4kLQ1 yFaNPJ692AJnI/iGWY7/gsBpFwDlVG6N3kYItpznFyidcgBUN5yAylm9mNmmD8zsrUikX oiAs3UtgRxOzPR18rQgiN/teAJ19evlSpAw53OnFH6BQd3MUu9KwgabvUYTG7DUBAyHl2 gw9GdX7uGryOUG4OgBmBKAH6uyFkGNr24pfHhpQ3u+2aVoCC+NY3JMBQnDo6Pvqplwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796474087; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=B2NzkqiM/dnO4mcW4JY8ktpKG7ZDku9dMJG/eG5mEQA=; b=WavMtK7A0ozrq1c61jYw69tc3qQbVQYq9xgGv/zztL55zdYCbusgql/qtUzRkUxv2Ic+ wv5gPitVXueVvRttTKvCpZUHhMVLqaTWNi8UUqVOTiQMbFqGBIdcoet9vOmegGovTC+JA TXLOtR0U5+ND2a7t3488ahM5/25Oub8oIVy1K2j2f8s9PGdXs7nZGVmKsrRhXa/Bzh0zd JCFNowC0lCngz5OkOJCJodz4rLOHLlPqJ5k3Q08nztSrS52NQIwBnJEoUwgApHK3ufS25 aHBdtp10GdpC0j5Sd0sg5/BRpaUv6o+rSzqNBZmNfGajc0tQn4p8euC0mkSskNpqEQw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OTcoHaE+; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 402F8606A322 for ; Sat, 5 Dec 2026 12:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OTcoHaE+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB2C81F0092B; Sat, 5 Dec 2026 12:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796474086; bh=B2NzkqiM/dnO4mcW4JY8ktpKG7ZDku9dMJG/eG5mEQA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=OTcoHaE+sAwDa8hNnpYRbxXeRsIvav0RtWrqfNEHQddKazl8TH4k+1MhHYg/Ep/Lh ecK/8cxdUXf+2vZukJSBpgE80/2aK5YpgFaQgzoQgAIbNXRgIAaCNfbI4m8ALsV/hx qVbELyBo8rvKfazDai9v91wLat5dD0YD7LbW3r3qrD9Z55Rra6AzU0cBUAPUdb2f5i acrlpPBMjCruW/mXR/nKvx+gacai8WCANJMeir7x9Lr1f7hxgNwQgDwSam9t9DXwZY d1yPVOoHlNsconUDv7p2Bh8gLAlps5ZogAjxCzEIV2SYM413jLW09QPl6hb//SjvyQ RVAXENzdexZkg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3] PCI/DPC: Increase recovery timeout to 60 seconds Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?Wml5b3UgV2FuZyAoTGVub3ZvKQ==?= Cc: linux-pci@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 12:34:46 +0000 X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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) 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)); > =20 > 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 =3D=3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/tencent_646202B910D= 8DCC6ADF5705708D37A8EA20A@qq.com?part=3D1