From: Bjorn Helgaas <helgaas@kernel.org>
To: Michael Schaller <michael@5challer.de>,
Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
regressions@lists.linux.dev,
"Maciej W . Rozycki" <macro@orcam.me.uk>,
Ajay Agarwal <ajayagarwal@google.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heiner Kallweit <hkallweit1@gmail.com>,
Johan Hovold <johan+linaro@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
stable@vger.kernel.org
Subject: [PATCH] Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()"
Date: Tue, 2 Jan 2024 17:25:50 -0600 [thread overview]
Message-ID: <20240102232550.1751655-1-helgaas@kernel.org> (raw)
In-Reply-To: <76c61361-b8b4-435f-a9f1-32b716763d62@5challer.de>
From: Bjorn Helgaas <bhelgaas@google.com>
This reverts commit 08d0cc5f34265d1a1e3031f319f594bd1970976c.
Michael reported that when attempting to resume from suspend to RAM on ASUS
mini PC PN51-BB757MDE1 (DMI model: MINIPC PN51-E1), 08d0cc5f3426
("PCI/ASPM: Remove pcie_aspm_pm_state_change()") caused a 12-second delay
with no output, followed by a reboot.
Workarounds include:
- Reverting 08d0cc5f3426 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()")
- Booting with "pcie_aspm=off"
- Booting with "pcie_aspm.policy=performance"
- "echo 0 | sudo tee /sys/bus/pci/devices/0000:03:00.0/link/l1_aspm"
before suspending
- Connecting a USB flash drive
Fixes: 08d0cc5f3426 ("PCI/ASPM: Remove pcie_aspm_pm_state_change()")
Reported-by: Michael Schaller <michael@5challer.de>
Link: https://lore.kernel.org/r/76c61361-b8b4-435f-a9f1-32b716763d62@5challer.de
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: <stable@vger.kernel.org>
---
drivers/pci/pci.c | 6 ++++++
drivers/pci/pci.h | 2 ++
drivers/pci/pcie/aspm.c | 19 +++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 55bc3576a985..bdbf8a94b4d0 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1335,6 +1335,9 @@ static int pci_set_full_power_state(struct pci_dev *dev)
pci_restore_bars(dev);
}
+ if (dev->bus->self)
+ pcie_aspm_pm_state_change(dev->bus->self);
+
return 0;
}
@@ -1429,6 +1432,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state)
pci_power_name(dev->current_state),
pci_power_name(state));
+ if (dev->bus->self)
+ pcie_aspm_pm_state_change(dev->bus->self);
+
return 0;
}
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 5ecbcf041179..f43873049d52 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -569,10 +569,12 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt);
#ifdef CONFIG_PCIEASPM
void pcie_aspm_init_link_state(struct pci_dev *pdev);
void pcie_aspm_exit_link_state(struct pci_dev *pdev);
+void pcie_aspm_pm_state_change(struct pci_dev *pdev);
void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
#else
static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { }
static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { }
+static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { }
static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
#endif
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 50b04ae5c394..8715e951c491 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -1008,6 +1008,25 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
up_read(&pci_bus_sem);
}
+/* @pdev: the root port or switch downstream port */
+void pcie_aspm_pm_state_change(struct pci_dev *pdev)
+{
+ struct pcie_link_state *link = pdev->link_state;
+
+ if (aspm_disabled || !link)
+ return;
+ /*
+ * Devices changed PM state, we should recheck if latency
+ * meets all functions' requirement
+ */
+ down_read(&pci_bus_sem);
+ mutex_lock(&aspm_lock);
+ pcie_update_aspm_capable(link->root);
+ pcie_config_aspm_path(link);
+ mutex_unlock(&aspm_lock);
+ up_read(&pci_bus_sem);
+}
+
void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
{
struct pcie_link_state *link = pdev->link_state;
--
2.34.1
next prev parent reply other threads:[~2024-01-02 23:26 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-25 18:29 [Regression] [PCI/ASPM] [ASUS PN51] Reboot on resume attempt (bisect done; commit found) Michael Schaller
2023-12-29 0:26 ` Bjorn Helgaas
2023-12-29 10:31 ` Michael Schaller
2024-01-01 18:13 ` Bjorn Helgaas
2024-01-01 18:57 ` Michael Schaller
2024-01-01 22:15 ` Bjorn Helgaas
2024-01-02 13:50 ` Michael Schaller
2024-01-03 8:21 ` Linux regression tracking (Thorsten Leemhuis)
2024-01-05 3:25 ` Kai-Heng Feng
2024-01-05 11:18 ` Michael Schaller
2024-01-05 15:51 ` Bjorn Helgaas
2024-01-10 3:43 ` Kai-Heng Feng
2024-01-10 12:39 ` Michael Schaller
2024-03-07 6:51 ` Kai-Heng Feng
2024-03-08 15:49 ` michael
2024-03-08 16:40 ` Bjorn Helgaas
2024-01-03 15:41 ` Ilpo Järvinen
2024-01-05 3:14 ` Kai-Heng Feng
2024-01-05 10:29 ` Ilpo Järvinen
2024-01-02 23:25 ` Bjorn Helgaas [this message]
2024-01-02 23:33 ` [PATCH] Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()" Kuppuswamy Sathyanarayanan
2024-01-03 0:12 ` Bjorn Helgaas
2024-01-08 8:39 ` Johan Hovold
2024-01-22 10:53 ` PCI/ASPM locking regression in 6.7-final (was: Re: [PATCH] Revert "PCI/ASPM: Remove pcie_aspm_pm_state_change()") Johan Hovold
2024-01-22 18:26 ` Bjorn Helgaas
2024-01-23 17:25 ` Johan Hovold
2024-01-23 22:36 ` Bjorn Helgaas
2024-01-24 8:16 ` Johan Hovold
2024-01-30 10:07 ` Johan Hovold
2024-02-09 12:45 ` PCI/ASPM locking regression in 6.7-final Linux regression tracking #update (Thorsten Leemhuis)
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=20240102232550.1751655-1-helgaas@kernel.org \
--to=helgaas@kernel.org \
--cc=ajayagarwal@google.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=johan+linaro@kernel.org \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=michael@5challer.de \
--cc=regressions@lists.linux.dev \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox