From: Christoph Hellwig <hch@infradead.org>
To: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
Cc: helgaas@kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v4 2/4] PCI/ASPM: Do not cache link latencies
Date: Sun, 14 Nov 2021 23:01:17 -0800 [thread overview]
Message-ID: <YZIFvZzdajJf3iTU@infradead.org> (raw)
In-Reply-To: <20211106175305.25565-3-refactormyself@gmail.com>
On Sat, Nov 06, 2021 at 06:53:03PM +0100, Saheed O. Bolarinwa wrote:
> The latencies of the upstream and downstream are calculated within
> pcie_aspm_cap_init() and cached in struct pcie_link_state.latency_*
> These values are only used in pcie_aspm_check_latency() where they are
> compared with the acceptable latencies on the link.
>
> - remove `latency_*` entries from struct pcie_link_state.
> - calculate the latencies directly where they are needed.
>
> Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.com>
> ---
> drivers/pci/pcie/aspm.c | 25 ++++++++++++++-----------
> 1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index a6d89c2c5b60..9e74df7b9dc0 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -66,9 +66,6 @@ struct pcie_link_state {
> u32 clkpm_default:1; /* Default Clock PM state by BIOS */
> u32 clkpm_disable:1; /* Clock PM disabled */
>
> - /* Exit latencies */
> - struct aspm_latency latency_up; /* Upstream direction exit latency */
> - struct aspm_latency latency_dw; /* Downstream direction exit latency */
> /*
> * Endpoint acceptable latencies. A pcie downstream port only
> * has one slot under it, so at most there are 8 functions.
> @@ -392,7 +389,8 @@ static void encode_l12_threshold(u32 threshold_us, u32 *scale, u32 *value)
>
> static void pcie_aspm_check_latency(struct pci_dev *endpoint)
> {
> - u32 latency, l1_switch_latency = 0;
> + u32 latency, lnkcap_up, lnkcap_dw, l1_switch_latency = 0;
> + struct aspm_latency latency_up, latency_dw;
> struct aspm_latency *acceptable;
> struct pcie_link_state *link;
>
> @@ -405,14 +403,23 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
> acceptable = &link->acceptable[PCI_FUNC(endpoint->devfn)];
>
> while (link) {
> + /* Read direction exit latencies */
> + pcie_capability_read_dword(link->pdev, PCI_EXP_LNKCAP, &lnkcap_up);
> + pcie_capability_read_dword(pci_function_0(link->pdev->subordinate),
Please avoid the overly long lines.
next prev parent reply other threads:[~2021-11-15 7:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 17:53 [RFC PATCH v4 0/4] PCI/ASPM: Remove struct aspm_latency Saheed O. Bolarinwa
2021-11-06 17:53 ` [RFC PATCH v4 1/4] PCI/ASPM: Move pci_function_0() upward Saheed O. Bolarinwa
2021-11-15 7:00 ` Christoph Hellwig
2021-11-06 17:53 ` [RFC PATCH v4 2/4] PCI/ASPM: Do not cache link latencies Saheed O. Bolarinwa
2021-11-15 7:01 ` Christoph Hellwig [this message]
2021-11-06 17:53 ` [RFC PATCH v4 3/4] PCI/ASPM: Remove struct pcie_link_state.acceptable Saheed O. Bolarinwa
2021-11-15 7:01 ` Christoph Hellwig
2021-11-06 17:53 ` [RFC PATCH v4 4/4] PCI/ASPM: Remove struct aspm_latency Saheed O. Bolarinwa
2021-11-15 7:02 ` Christoph Hellwig
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=YZIFvZzdajJf3iTU@infradead.org \
--to=hch@infradead.org \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--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