From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Hongyu Xie <xiehongyu1@kylinos.cn>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND PATCH v1] PCI: replace msleep to save waiting time
Date: Mon, 23 Feb 2026 14:05:47 +0200 (EET) [thread overview]
Message-ID: <71825caa-5399-3676-4678-49d282e0a923@linux.intel.com> (raw)
In-Reply-To: <20260223061919.1408000-1-xiehongyu1@kylinos.cn>
On Mon, 23 Feb 2026, Hongyu Xie wrote:
> In pcie_wait_for_link_status, using msleep(1) to wait for link status
Add () after any function name in the commit message.
> change.
> But msleep(1) can sleep for nearly 5ms.
Why does the extra delay matter/is a problem? It would be good to include
such a justification into this change description.
> ftrace shows:
> 0) | pcie_wait_for_link_status() {
> 0) 0.500 us | pcie_capability_read_word();
> 0) 0.580 us | pcie_capability_read_word();
> 0) * 10292.26 us | }
>
> after changing to usleep_range.
+ ()
> ftrace shows:
>
> 0) | pcie_wait_for_link_status() {
> 0) 0.320 us | pcie_capability_read_word();
> 0) 0.480 us | pcie_capability_read_word();
> 0) # 2483.980 us | }
>
> So fix this by using usleep_range.
Ditto.
> Signed-off-by: Hongyu Xie <xiehongyu1@kylinos.cn>
> ---
> drivers/pci/pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index f3244630bfd0..68532e248e51 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4519,7 +4519,7 @@ static int pcie_wait_for_link_status(struct pci_dev *pdev,
> pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnksta);
> if ((lnksta & lnksta_mask) == lnksta_match)
> return 0;
> - msleep(1);
> + usleep_range(1000, 1100);
> } while (time_before(jiffies, end_jiffies));
>
> return -ETIMEDOUT;
>
--
i.
next prev parent reply other threads:[~2026-02-23 12:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 6:19 [RESEND PATCH v1] PCI: replace msleep to save waiting time Hongyu Xie
2026-02-23 12:05 ` Ilpo Järvinen [this message]
2026-02-25 18:10 ` Bjorn Helgaas
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=71825caa-5399-3676-4678-49d282e0a923@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=xiehongyu1@kylinos.cn \
/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