From: Ian Kumlien <ian.kumlien@gmail.com>
To: kai.heng.feng@canonical.com, linux-pci@vger.kernel.org,
alexander.duyck@gmail.com, refactormyself@gmail.com,
puranjay12@gmail.com
Cc: Ian Kumlien <ian.kumlien@gmail.com>
Subject: [PATCH 2/3] PCI/ASPM: Fix L0s max latency check
Date: Sat, 24 Oct 2020 22:55:47 +0200 [thread overview]
Message-ID: <20201024205548.1837770-2-ian.kumlien@gmail.com> (raw)
In-Reply-To: <20201024205548.1837770-1-ian.kumlien@gmail.com>
From what I have been able to figure out, it seems like LOs path latency
is cumulative, so the max path latency should be the sum of all links
maximum latency.
Signed-off-by: Ian Kumlien <ian.kumlien@gmail.com>
---
drivers/pci/pcie/aspm.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index c03ead0f1013..dbe3ce60c1ff 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -434,7 +434,8 @@ static void pcie_get_aspm_reg(struct pci_dev *pdev,
static void pcie_aspm_check_latency(struct pci_dev *endpoint)
{
- u32 latency, l1_max_latency = 0, l1_switch_latency = 0;
+ u32 latency, l1_max_latency = 0, l1_switch_latency = 0,
+ l0s_latency_up = 0, l0s_latency_dw = 0;
struct aspm_latency *acceptable;
struct pcie_link_state *link;
@@ -448,14 +449,18 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
while (link) {
/* Check upstream direction L0s latency */
- if ((link->aspm_capable & ASPM_STATE_L0S_UP) &&
- (link->latency_up.l0s > acceptable->l0s))
- link->aspm_capable &= ~ASPM_STATE_L0S_UP;
+ if (link->aspm_capable & ASPM_STATE_L0S_UP) {
+ l0s_latency_up += link->latency_up.l0s;
+ if (l0s_latency_up > acceptable->l0s)
+ link->aspm_capable &= ~ASPM_STATE_L0S_UP;
+ }
/* Check downstream direction L0s latency */
- if ((link->aspm_capable & ASPM_STATE_L0S_DW) &&
- (link->latency_dw.l0s > acceptable->l0s))
- link->aspm_capable &= ~ASPM_STATE_L0S_DW;
+ if (link->aspm_capable & ASPM_STATE_L0S_DW) {
+ l0s_latency_dw += link->latency_dw.l0s;
+ if (l0s_latency_dw > acceptable->l0s)
+ link->aspm_capable &= ~ASPM_STATE_L0S_DW;
+ }
/*
* Check L1 latency.
--
2.29.1
next prev parent reply other threads:[~2020-10-24 20:56 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 13:28 [PATCH] Use maximum latency when determining L1 ASPM Ian Kumlien
2020-10-08 4:20 ` Kai-Heng Feng
2020-10-08 16:13 ` Bjorn Helgaas
2020-10-12 10:20 ` Ian Kumlien
2020-10-14 8:34 ` Kai-Heng Feng
2020-10-14 13:33 ` Ian Kumlien
2020-10-14 14:36 ` Bjorn Helgaas
2020-10-14 15:39 ` Ian Kumlien
2020-10-16 14:53 ` Ian Kumlien
2020-10-16 21:28 ` Bjorn Helgaas
2020-10-16 22:41 ` Ian Kumlien
2020-10-18 11:35 ` Ian Kumlien
2020-10-22 15:37 ` Bjorn Helgaas
2020-10-22 15:41 ` Ian Kumlien
2020-10-22 18:30 ` Bjorn Helgaas
2020-10-24 20:55 ` [PATCH 1/3] PCI/ASPM: Use the path max in L1 ASPM latency check Ian Kumlien
2020-10-24 20:55 ` Ian Kumlien [this message]
2020-11-15 21:49 ` [PATCH 2/3] PCI/ASPM: Fix L0s max " Ian Kumlien
2020-10-24 20:55 ` [PATCH 3/3] [RFC] PCI/ASPM: Print L1/L0s latency messages per endpoint Ian Kumlien
2020-11-15 21:49 ` [PATCH 1/3] PCI/ASPM: Use the path max in L1 ASPM latency check Ian Kumlien
2020-12-07 11:04 ` Ian Kumlien
2020-12-12 23:47 ` Bjorn Helgaas
2020-12-13 21:39 ` Ian Kumlien
2020-12-14 5:44 ` Bjorn Helgaas
2020-12-14 9:14 ` Ian Kumlien
2020-12-14 14:02 ` Bjorn Helgaas
2020-12-14 15:47 ` Ian Kumlien
2020-12-14 19:19 ` Bjorn Helgaas
2020-12-14 22:56 ` Ian Kumlien
2020-12-15 0:40 ` Bjorn Helgaas
2020-12-15 13:09 ` Ian Kumlien
2020-12-16 0:08 ` Bjorn Helgaas
2020-12-16 11:20 ` Ian Kumlien
2020-12-16 23:21 ` Bjorn Helgaas
2020-12-17 23:37 ` Ian Kumlien
2021-01-12 20:42 ` Bjorn Helgaas
2021-01-28 12:41 ` Ian Kumlien
2021-02-24 22:19 ` Ian Kumlien
2021-02-25 22:03 ` Bjorn Helgaas
2021-04-26 14:36 ` Ian Kumlien
2021-04-28 21:15 ` Bjorn Helgaas
2021-05-15 11:52 ` Ian Kumlien
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=20201024205548.1837770-2-ian.kumlien@gmail.com \
--to=ian.kumlien@gmail.com \
--cc=alexander.duyck@gmail.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-pci@vger.kernel.org \
--cc=puranjay12@gmail.com \
--cc=refactormyself@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).