From: Bjorn Helgaas <helgaas@kernel.org>
To: Hans Zhang <18255117159@163.com>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions
Date: Fri, 22 Aug 2025 11:46:38 -0500 [thread overview]
Message-ID: <20250822164638.GA687302@bhelgaas> (raw)
In-Reply-To: <20250822155908.625553-1-18255117159@163.com>
On Fri, Aug 22, 2025 at 11:59:01PM +0800, Hans Zhang wrote:
> This series replaces short msleep() calls (less than 20ms) with more
> precise delay functions (fsleep() and usleep_range()) throughout the
> PCI subsystem.
>
> The msleep() function with small values can sleep longer than intended
> due to timer granularity, which can cause unnecessary delays in PCI
> operations such as link status checking, reset handling, and hotplug
> operations.
>
> These changes:
> - Use fsleep() for delays that require precise timing (1-2ms).
> - Use usleep_range() for delays that can benefit from a small range.
> - Add #defines for all delay values with references to PCIe specifications.
> - Update comments to reference the latest PCIe r7.0 specification.
>
> This improves the responsiveness of PCI operations while maintaining
> compliance with PCIe specifications.
I would split this a little differently:
- Add #defines for values from PCIe base spec. Make the #define
value match the spec value. If there's adjustment, e.g.,
doubling, do it at the sleep site. Adjustment like this seems a
little paranoid since the spec should already have some margin
built into it.
- Change to fsleep() (or usleep_range()) in separate patch. There
might be discussion about these changes, but the #defines are
desirable regardless.
I'm personally dubious about the places you used usleep_range().
These are low-frequency paths (rcar PHY ready, brcmstb link up,
hotplug command completion, DPC recover) that don't seem critical. I
think they're all using made-up delays that don't come from any spec
or hardware requirement anyway. I think it's hard to make an argument
for precision here.
Bjorn
next prev parent reply other threads:[~2025-08-22 16:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 15:59 [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions Hans Zhang
2025-08-22 15:59 ` [PATCH v2 1/7] PCI: Replace msleep(2) with fsleep() for precise delay Hans Zhang
2025-08-22 15:59 ` [PATCH v2 2/7] PCI: Replace msleep(1) with fsleep() for precise link status checking Hans Zhang
2025-08-22 15:59 ` [PATCH v2 3/7] PCI: rcar-host: Replace msleep(1) with fsleep() for precise speed change monitoring Hans Zhang
2025-08-22 15:59 ` [PATCH v2 4/7] PCI: brcmstb: Replace msleep(5) with usleep_range() for precise link up checking Hans Zhang
2025-08-22 15:59 ` [PATCH v2 5/7] PCI: rcar: Replace msleep(5) with usleep_range() for precise PHY ready checking Hans Zhang
2025-08-22 15:59 ` [PATCH v2 6/7] PCI: pciehp: Replace msleep(10) with usleep_range() for precise delays Hans Zhang
2025-08-22 15:59 ` [PATCH v2 7/7] PCI/DPC: Replace msleep(10) with usleep_range() for precise RP busy checking Hans Zhang
2025-08-22 16:46 ` Bjorn Helgaas [this message]
2025-08-24 16:05 ` [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions Hans Zhang
2025-08-25 20:30 ` Bjorn Helgaas
2025-08-26 17:07 ` Hans Zhang
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=20250822164638.GA687302@bhelgaas \
--to=helgaas@kernel.org \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox