Re: [PATCH v2] ASPM: Use msleep instead of cpu_relax during linkretraining

From: Joe Perches
Date: Mon Jan 05 2009 - 19:53:57 EST


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@xxxxxx>
> 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))


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/