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 3/3] [RFC] PCI/ASPM: Print L1/L0s latency messages per endpoint
Date: Sat, 24 Oct 2020 22:55:48 +0200 [thread overview]
Message-ID: <20201024205548.1837770-3-ian.kumlien@gmail.com> (raw)
In-Reply-To: <20201024205548.1837770-1-ian.kumlien@gmail.com>
Print information on where along the path we disable L1 or L0s per
endpoint. I think the infromation could be useful in the normal dmesg.
Signed-off-by: Ian Kumlien <ian.kumlien@gmail.com>
---
drivers/pci/pcie/aspm.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index dbe3ce60c1ff..8bec24119f3e 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -436,6 +436,7 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
{
u32 latency, l1_max_latency = 0, l1_switch_latency = 0,
l0s_latency_up = 0, l0s_latency_dw = 0;
+ bool aspm_disable = 0;
struct aspm_latency *acceptable;
struct pcie_link_state *link;
@@ -447,19 +448,35 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
link = endpoint->bus->self->link_state;
acceptable = &link->acceptable[PCI_FUNC(endpoint->devfn)];
+#define aspm_info(device, type, down, up) \
+ if (!aspm_disable) \
+ { \
+ pr_cont("pci %s: ASPM latency exceeded, disabling: %s:%s-%s", \
+ pci_name(device), type, pci_name(down), pci_name(up)); \
+ aspm_disable = 1; \
+ } \
+ else \
+ pr_cont(", %s:%s-%s", type, pci_name(down), pci_name(up));
+
while (link) {
/* Check upstream direction L0s latency */
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;
+ aspm_info(endpoint, "L0s-up", link->downstream, link->pdev);
+ }
}
/* Check downstream direction L0s latency */
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;
+ aspm_info(endpoint, "L0s-dw", link->downstream, link->pdev);
+ }
}
/*
@@ -482,12 +499,18 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
latency = max_t(u32, link->latency_up.l1, link->latency_dw.l1);
l1_max_latency = max_t(u32, latency, l1_max_latency);
if (l1_max_latency + l1_switch_latency > acceptable->l1)
+ {
link->aspm_capable &= ~ASPM_STATE_L1;
+ aspm_info(endpoint, "L1", link->downstream, link->pdev);
+ }
l1_switch_latency += 1000;
}
link = link->parent;
}
+ if (aspm_disable)
+ pr_cont("\n");
+#undef aspm_info
}
/*
--
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 ` [PATCH 2/3] PCI/ASPM: Fix L0s max " Ian Kumlien
2020-11-15 21:49 ` Ian Kumlien
2020-10-24 20:55 ` Ian Kumlien [this message]
2020-11-15 21:49 ` [PATCH 1/3] PCI/ASPM: Use the path max in L1 ASPM " 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-3-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).