Re: [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux