From nobody Fri Dec 19 16:05:51 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 993DF17F384; Wed, 27 Mar 2024 12:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542301; cv=none; b=DxUgh4eMaMEqmT01BWVmTJxu6A9exx5sOo7aYGbvdHZbZ2/1hQhMl4cCpQ+76dIinzby7+uqXAKV/5G6Sjcm01f2ezqFN1+s46ouI8DcTX/yp45is/rVZ+RFJCqD29/N9X6R7FHNCEWCZDIygViOgSP14bAVP4tR3lDUECKnzBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542301; c=relaxed/simple; bh=jLjPNhssEhsgVPKSr4v89Roh0XQJGGM530uvVjhi2oU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J3b9SZwu8rv00cq8TPx0O0prldLbGy4+qeZXBl8YuQvz1b8Yy9BFinhzW8cNRlBPn0l/kBWhUsER4w9k5Dcn9WZ0cIdYLfp+kw8A2XK6nLwWm1CcKeBjDLB06Fh1J7R3CV+JmTGQrI+nqkiLKa+5OOC1XlM0JbFNqpCyiCNDitI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=keMkcfbe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="keMkcfbe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92C5CC43390; Wed, 27 Mar 2024 12:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711542301; bh=jLjPNhssEhsgVPKSr4v89Roh0XQJGGM530uvVjhi2oU=; h=From:To:Cc:Subject:Date:From; b=keMkcfbet4tgL/ysu50if8HpKVm3GOxd+MJ70eBG6RtdlInNtTuMYcYv57ymAApo5 EsK15tcPOBPYg8IpsU8OSeBQ47BZJUvlDRFB/eBnjjkYTZv0cCIu5QZIGJIJypkxBG nX4qE84LyVPfkb95+gzO7vKZGdMYnsFL1hHwkqGApcBDso1SJdXhLRb0f8hZUZBjcG hclI2LffCjyw51E6SzYZHQ8k7wwNESdM8bw1YOZJlWf/GcoG+I8k5G72kVzRvHMr7H UMS6M0zjkh+eqZ59SmpDwif+m9RTmkOjs4RBcG01L47cuAba74bfuP4Ua4wGxa5zbm 0N7rxGvE35xkg== From: Sasha Levin To: stable@vger.kernel.org, stanislaw.gruszka@linux.intel.com Cc: Bjorn Helgaas , Kuppuswamy Sathyanarayanan , "Rafael J . Wysocki" , linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: FAILED: Patch "PCI/AER: Block runtime suspend when handling errors" failed to apply to 5.4-stable tree Date: Wed, 27 Mar 2024 08:24:59 -0400 Message-ID: <20240327122459.2839840-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha Acked-by: Rafael J. Wysocki Reviewed-by: Kuppuswamy Sathyanarayanan ------------------ original commit in Linus's tree ------------------ From 002bf2fbc00e5c4b95fb167287e2ae7d1973281e Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Mon, 12 Feb 2024 13:01:35 +0100 Subject: [PATCH] PCI/AER: Block runtime suspend when handling errors PM runtime can be done simultaneously with AER error handling. Avoid that by using pm_runtime_get_sync() before and pm_runtime_put() after reset in pcie_do_recovery() for all recovering devices. pm_runtime_get_sync() will increase dev->power.usage_count counter to prevent any possible future request to runtime suspend a device. It will also resume a device, if it was previously in D3hot state. I tested with igc device by doing simultaneous aer_inject and rpm suspend/resume via /sys/bus/pci/devices/PCI_ID/power/control and can reproduce: igc 0000:02:00.0: not ready 65535ms after bus reset; giving up pcieport 0000:00:1c.2: AER: Root Port link has been reset (-25) pcieport 0000:00:1c.2: AER: subordinate device reset failed pcieport 0000:00:1c.2: AER: device recovery failed igc 0000:02:00.0: Unable to change power state from D3hot to D0, device i= naccessible The problem disappears when this patch is applied. Link: https://lore.kernel.org/r/20240212120135.146068-1-stanislaw.gruszka@l= inux.intel.com Signed-off-by: Stanislaw Gruszka Signed-off-by: Bjorn Helgaas Reviewed-by: Kuppuswamy Sathyanarayanan Acked-by: Rafael J. Wysocki Cc: --- drivers/pci/pcie/err.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 59c90d04a609a..705893b5f7b09 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -13,6 +13,7 @@ #define dev_fmt(fmt) "AER: " fmt =20 #include +#include #include #include #include @@ -85,6 +86,18 @@ static int report_error_detected(struct pci_dev *dev, return 0; } =20 +static int pci_pm_runtime_get_sync(struct pci_dev *pdev, void *data) +{ + pm_runtime_get_sync(&pdev->dev); + return 0; +} + +static int pci_pm_runtime_put(struct pci_dev *pdev, void *data) +{ + pm_runtime_put(&pdev->dev); + return 0; +} + static int report_frozen_detected(struct pci_dev *dev, void *data) { return report_error_detected(dev, pci_channel_io_frozen, data); @@ -207,6 +220,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, else bridge =3D pci_upstream_bridge(dev); =20 + pci_walk_bridge(bridge, pci_pm_runtime_get_sync, NULL); + pci_dbg(bridge, "broadcast error_detected message\n"); if (state =3D=3D pci_channel_io_frozen) { pci_walk_bridge(bridge, report_frozen_detected, &status); @@ -251,10 +266,15 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pcie_clear_device_status(dev); pci_aer_clear_nonfatal_status(dev); } + + pci_walk_bridge(bridge, pci_pm_runtime_put, NULL); + pci_info(bridge, "device recovery successful\n"); return status; =20 failed: + pci_walk_bridge(bridge, pci_pm_runtime_put, NULL); + pci_uevent_ers(bridge, PCI_ERS_RESULT_DISCONNECT); =20 /* TODO: Should kernel panic here? */ --=20 2.43.0