lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250822164638.GA687302@bhelgaas>
Date: Fri, 22 Aug 2025 11:46:38 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Hans Zhang <18255117159@....com>
Cc: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 0/7] PCI: Replace short msleep() calls with more
 precise delay functions

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ