From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=203.205.221.205 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796473246; b=h/Mif8SW5HE1kjzZq0CjkBB9RTi8aJpUYGt34by7YPwOEVcJcUNPCWX2E5Qn4u4ZF03j 8U5oA+XhZaRv/OXt6qUt9srkkPJFj6yiPCxYWqXH/L5rMv3IxwifPfXGx5D+cY7KYg9jr 6wj30g91dWNxhKmT+lNtyx/U6pNK6wwkv6YGbvSwaDSvrfGDv6VehsU8jcLo6IR0bvKza Nikund+tWDF3Tg/bhxUXyqCzzH4DQ+EAAMRnLZgIBK9uiD82RqNoGbAgo2mSYUnEvvhwY 1xXRFTfq0T9ArBFzDrf8l+qhrTX/xu+w9/noqa8uVLbrNSyUD4dorqJ1W5GLpf83p2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796473246; h=DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:Message-ID: X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:X-OQ-MSGID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=1gL1C/5vHoQYrxRFOf9KrXOIYoUgDuXdUQxNaxIeEPs=; b=puUAb5YDcBHRn6mOs8hwbnf9+4wmcaY/YkKrYuoENKZDWmLPiy37i2iybTbghznkxgz4 FOVmo+2ocFFvVLYPMMABsxeG2bQL5FaKHKzqN6aRFPyItIntmfB2pO6NYJlwOTo/lHcWG 6/Njy1PB/RjQPOKJ4h/ZQSpGKW404btwWteS4NmUAz/7tPkAPvxfSo7wq5iI33REBwIba oWMsl+MEKcuPps/eFS3YbOYqZPrfU2fA8iO8Ecx6LGmSfzx+XfKk123EfkMZoLgBpnMBE goRIHtz7faULtlDg+9dqudKsvkZusfksqltuAsFAZXviLFm3FLBllEeloDUYV0vRhqQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=foxmail.com; spf=pass smtp.mailfrom=foxmail.com; dkim=pass header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=BAQn6wAx; arc=none smtp.remote-ip=203.205.221.205 Received: from out203-205-221-205.mail.qq.com (out203-205-221-205.mail.qq.com [203.205.221.205]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C3E606A322; Sat, 5 Dec 2026 12:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31C3E606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=BAQn6wAx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1796473232; bh=1gL1C/5vHoQYrxRFOf9KrXOIYoUgDuXdUQxNaxIeEPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BAQn6wAxLhyeY4SYIhOBzIx4fuyTvBMIsOPyjdV1N6c01Mrm92r2ZJ9Zy8DRysBfb b1Lg7quETzimAWaWrW8lmNAK0wcJwgNUIF7nf6Bd/rOZkC+KhmYYpV4BqxYLh4MR+B HDNcgZkxFz2nKRvFglpBMwjUnsjFS9UR4xGIkFpE= Received: from localhost.localdomain ([107.173.101.132]) by newxmesmtplogicsvrszc50-0.qq.com (NewEsmtp) with SMTP id 51B20A58; Sat, 05 Dec 2026 20:20:27 +0800 X-QQ-mid: xmsmtpt1796473227tlz1dlpo2 Message-ID: X-QQ-XMAILINFO: MMwjR1C73eIsVdBjes9L/IFt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AoTHDB4+ENMxbS/4UB5D4PU2k8ix X-QQ-XMRINFO: OWPUhxQsoeAVwkVaQIEGSKwwgKCxK/fD5g== From: "Ziyou Wang (Lenovo)" To: lukas@wunner.de Cc: bhelgaas@google.com, brett.creeley@amd.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, sathyanarayanan.kuppuswamy@linux.intel.com, stable@vger.kernel.org, ziyou.dev@foxmail.com Subject: [PATCH v3] PCI/DPC: Increase recovery timeout to 60 seconds Date: Sat, 5 Dec 2026 20:19:49 +0800 X-OQ-MSGID: <20261205121949.2372405-1-ziyou.dev@foxmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Move PCIE_RESET_READY_POLL_MS definition from pci.c to pci.h so it can be used in dpc.c. Use PCIE_RESET_READY_POLL_MS (60 seconds) as the timeout so pciehp waits as long as pci_bridge_wait_for_secondary_bus() does, which is sufficient for all known devices. Tested with INNOGRIT NVMe SSD [1dbe:5668] with ACS Fatal error injection: Upstream kernel (7.3.0-master+, 4s timeout): [123.018691] nvme: not ready 1023ms after DPC; waiting [124.106690] nvme: not ready 2047ms after DPC; waiting [125.642703] pciehp: Slot(64): Link Down [126.218696] AER: subordinate device reset failed [126.218700] AER: device recovery failed Device re-enumerated as nvme1 With this patch (60s timeout): [74.894811] nvme: not ready 1023ms after DPC; waiting [75.982813] nvme: not ready 2047ms after DPC; waiting [78.094810] nvme: ready 4095ms after DPC [78.094816] nvme: restart after slot reset [78.111620] AER: device recovery successful Device works normally Fixes: a97396c6eb13 ("PCI: pciehp: Ignore Link Down/Up caused by DPC") Cc: stable@vger.kernel.org Cc: Brett Creeley Signed-off-by: Ziyou Wang (Lenovo) --- v3: remove stale comment in pci.c, update comment in dpc.c, reference pci_bridge_wait_for_secondary_bus() in commit message drivers/pci/pci.c | 8 -------- drivers/pci/pci.h | 8 ++++++++ drivers/pci/pcie/dpc.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7c6f2aba8144..eaa985e250af 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -74,14 +74,6 @@ struct pci_pme_device { */ #define PCI_RESET_WAIT 1000 /* msec */ -/* - * Devices may extend the 1 sec period through Request Retry Status - * completions (PCIe r6.0 sec 2.3.1). The spec does not provide an upper - * limit, but 60 sec ought to be enough for any device to become - * responsive. - */ -#define PCIE_RESET_READY_POLL_MS 60000 /* msec */ - static void pci_dev_d3_sleep(struct pci_dev *dev) { unsigned int delay_ms = max(dev->d3hot_delay, pci_pm_d3hot_delay); diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 77efa4c5c960..bac130508348 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -70,6 +70,14 @@ struct pcie_tlp_log; */ #define PCIE_RESET_CONFIG_WAIT_MS 100 +/* + * Devices may extend the 1 sec period through Request Retry Status + * completions (PCIe r6.0 sec 2.3.1). The spec does not provide an upper + * limit, but 60 sec ought to be enough for any device to become + * responsive. + */ +#define PCIE_RESET_READY_POLL_MS 60000 /* msec */ + /* Parameters for the waiting for link up routine */ #define PCIE_LINK_WAIT_MAX_RETRIES 10 #define PCIE_LINK_WAIT_SLEEP_MS 90 diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c index 2b779bd1d861..4cad4de74a9e 100644 --- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -118,10 +118,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); } -- 2.53.0