All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Mahesh J Salgaonkar" <mahesh@linux.ibm.com>,
	"Oliver O'Halloran" <oohall@gmail.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Saeed Mahameed" <saeedm@nvidia.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "Pali Rohár" <pali@kernel.org>,
	"David Abdurachmanov" <david.abdurachmanov@gmail.com>,
	linux-rdma@vger.kernel.org,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	linux-pci@vger.kernel.org, "Stefan Roese" <sr@denx.de>,
	"Jim Wilson" <wilson@tuliptree.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v8 2/7] PCI: Export PCI link retrain timeout
Date: Thu, 4 May 2023 17:21:16 -0500	[thread overview]
Message-ID: <20230504222116.GA886747@bhelgaas> (raw)
In-Reply-To: <alpine.DEB.2.21.2304060110230.13659@angie.orcam.me.uk>

On Thu, Apr 06, 2023 at 01:21:09AM +0100, Maciej W. Rozycki wrote:
> Rename LINK_RETRAIN_TIMEOUT to PCIE_LINK_RETRAIN_TIMEOUT and make it
> available via "pci.h" for PCI drivers to use.

> +#define PCIE_LINK_RETRAIN_TIMEOUT HZ

This is basically just a rename and move, but since we're touching it
anyway, can we make it "PCIE_LINK_RETRAIN_TIMEOUT_MS 1000" here and
use msecs_to_jiffies() below?

I know jiffies and HZ are probably idiomatic elsewhere in the kernel,
and this particular timeout is arbitrary and not based on anything in
the spec, but many of the delays in PCI *are* straight from a spec, so
I'd like to make the units more explicit.

>  extern const unsigned char pcie_link_speed[];
>  extern bool pci_early_dump;
>  
> Index: linux-macro/drivers/pci/pcie/aspm.c
> ===================================================================
> --- linux-macro.orig/drivers/pci/pcie/aspm.c
> +++ linux-macro/drivers/pci/pcie/aspm.c
> @@ -90,8 +90,6 @@ static const char *policy_str[] = {
>  	[POLICY_POWER_SUPERSAVE] = "powersupersave"
>  };
>  
> -#define LINK_RETRAIN_TIMEOUT HZ
> -
>  /*
>   * The L1 PM substate capability is only implemented in function 0 in a
>   * multi function device.
> @@ -213,7 +211,7 @@ static bool pcie_retrain_link(struct pci
>  	}
>  
>  	/* Wait for link training end. Break out after waiting for timeout */
> -	end_jiffies = jiffies + LINK_RETRAIN_TIMEOUT;
> +	end_jiffies = jiffies + PCIE_LINK_RETRAIN_TIMEOUT;
>  	do {
>  		pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
>  		if (!(reg16 & PCI_EXP_LNKSTA_LT))

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Eric Dumazet" <edumazet@google.com>,
	"Oliver O'Halloran" <oohall@gmail.com>,
	"Stefan Roese" <sr@denx.de>, "Leon Romanovsky" <leon@kernel.org>,
	linux-rdma@vger.kernel.org, "Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Jim Wilson" <wilson@tuliptree.org>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"David Abdurachmanov" <david.abdurachmanov@gmail.com>,
	linuxppc-dev@lists.ozlabs.org,
	"Mahesh J Salgaonkar" <mahesh@linux.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Lukas Wunner" <lukas@wunner.de>,
	netdev@vger.kernel.org, "Pali Rohár" <pali@kernel.org>,
	"Saeed Mahameed" <saeedm@nvidia.com>
Subject: Re: [PATCH v8 2/7] PCI: Export PCI link retrain timeout
Date: Thu, 4 May 2023 17:21:16 -0500	[thread overview]
Message-ID: <20230504222116.GA886747@bhelgaas> (raw)
In-Reply-To: <alpine.DEB.2.21.2304060110230.13659@angie.orcam.me.uk>

On Thu, Apr 06, 2023 at 01:21:09AM +0100, Maciej W. Rozycki wrote:
> Rename LINK_RETRAIN_TIMEOUT to PCIE_LINK_RETRAIN_TIMEOUT and make it
> available via "pci.h" for PCI drivers to use.

> +#define PCIE_LINK_RETRAIN_TIMEOUT HZ

This is basically just a rename and move, but since we're touching it
anyway, can we make it "PCIE_LINK_RETRAIN_TIMEOUT_MS 1000" here and
use msecs_to_jiffies() below?

I know jiffies and HZ are probably idiomatic elsewhere in the kernel,
and this particular timeout is arbitrary and not based on anything in
the spec, but many of the delays in PCI *are* straight from a spec, so
I'd like to make the units more explicit.

>  extern const unsigned char pcie_link_speed[];
>  extern bool pci_early_dump;
>  
> Index: linux-macro/drivers/pci/pcie/aspm.c
> ===================================================================
> --- linux-macro.orig/drivers/pci/pcie/aspm.c
> +++ linux-macro/drivers/pci/pcie/aspm.c
> @@ -90,8 +90,6 @@ static const char *policy_str[] = {
>  	[POLICY_POWER_SUPERSAVE] = "powersupersave"
>  };
>  
> -#define LINK_RETRAIN_TIMEOUT HZ
> -
>  /*
>   * The L1 PM substate capability is only implemented in function 0 in a
>   * multi function device.
> @@ -213,7 +211,7 @@ static bool pcie_retrain_link(struct pci
>  	}
>  
>  	/* Wait for link training end. Break out after waiting for timeout */
> -	end_jiffies = jiffies + LINK_RETRAIN_TIMEOUT;
> +	end_jiffies = jiffies + PCIE_LINK_RETRAIN_TIMEOUT;
>  	do {
>  		pcie_capability_read_word(parent, PCI_EXP_LNKSTA, &reg16);
>  		if (!(reg16 & PCI_EXP_LNKSTA_LT))

  reply	other threads:[~2023-05-04 22:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06  0:20 [PATCH v8 0/7] pci: Work around ASMedia ASM2824 PCIe link training failures Maciej W. Rozycki
2023-04-06  0:20 ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 1/7] PCI: pciehp: Rely on `link_active_reporting' Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 2/7] PCI: Export PCI link retrain timeout Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-05-04 22:21   ` Bjorn Helgaas [this message]
2023-05-04 22:21     ` Bjorn Helgaas
2023-04-06  0:21 ` [PATCH v8 3/7] PCI: Execute `quirk_enable_clear_retrain_link' earlier Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 4/7] PCI: Initialize `link_active_reporting' earlier Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 5/7] powerpc/eeh: Rely on `link_active_reporting' Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 6/7] net/mlx5: " Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-04-06  0:21 ` [PATCH v8 7/7] PCI: Work around PCIe link training failures Maciej W. Rozycki
2023-04-06  0:21   ` Maciej W. Rozycki
2023-05-04 22:20   ` Bjorn Helgaas
2023-05-04 22:20     ` Bjorn Helgaas
2023-05-07 18:33     ` Maciej W. Rozycki
2023-05-07 18:33       ` Maciej W. Rozycki
2023-05-14 20:54       ` Maciej W. Rozycki
2023-05-14 20:54         ` Maciej W. Rozycki
2023-06-11 17:14     ` Maciej W. Rozycki
2023-06-11 17:14       ` Maciej W. Rozycki

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=20230504222116.GA886747@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=david.abdurachmanov@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=macro@orcam.me.uk \
    --cc=mahesh@linux.ibm.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --cc=oohall@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pali@kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=sr@denx.de \
    --cc=wilson@tuliptree.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.