public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Patterson <andrew.patterson@hp.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	matthew@wil.cx, akpm@linux-foundation.org, shaohua.li@intel.com
Subject: Re: [PATCH v2] ASPM: Use msleep instead of cpu_relax during link retraining
Date: Mon, 05 Jan 2009 16:54:36 -0800	[thread overview]
Message-ID: <1231203276.20557.175.camel@localhost> (raw)
In-Reply-To: <20090105230716.15081.29984.stgit@bob.kio>

On Mon, 2009-01-05 at 16:07 -0700, Andrew Patterson wrote:
> ASPM: Use msleep instead of cpu_relax during link retraining
> Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 4d8e2c7..e67eaa2 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
[]
> @@ -238,16 +241,19 @@ static void pcie_aspm_configure_common_clock(struct pci_dev *pdev)
>  	pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
>  
>  	/* Wait for link training end */
> -	/* break out after waiting for 1 second */
> +	/* break out after waiting for timeout */
>  	start_jiffies = jiffies;
> -	while ((jiffies - start_jiffies) < HZ) {
> +	for (;;) {
>  		pci_read_config_word(pdev, pos + PCI_EXP_LNKSTA, &reg16);
>  		if (!(reg16 & PCI_EXP_LNKSTA_LT))
>  			break;
> -		cpu_relax();
> +		if (time_after(start_jiffies,
> +			       start_jiffies + LINK_RETRAIN_TIMEOUT))
> +			break;
> +		msleep(1);
>  	}

if (time_after(jiffies, start_jiffies + LINK_RETRAIN_TIMEOUT))



  reply	other threads:[~2009-01-06  0:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 23:07 [PATCH v2] ASPM: Use msleep instead of cpu_relax during link retraining Andrew Patterson
2009-01-06  0:54 ` Joe Perches [this message]
2009-01-06  0:55   ` Joe Perches

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=1231203276.20557.175.camel@localhost \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.patterson@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=shaohua.li@intel.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