Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions
@ 2025-08-22 15:59 Hans Zhang
  2025-08-22 15:59 ` [PATCH v2 1/7] PCI: Replace msleep(2) with fsleep() for precise delay Hans Zhang
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Hans Zhang @ 2025-08-22 15:59 UTC (permalink / raw)
  To: bhelgaas, helgaas, linux-pci, linux-kernel; +Cc: Hans Zhang

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.

---
Changes for v2:
https://patchwork.kernel.org/project/linux-pci/patch/20250820160944.489061-1-18255117159@163.com/

- According to the Maintainer's suggestion, it was modified to fsleep,
  usleep_range, and macro definitions were used instead of hard code. (Bjorn)
---

Hans Zhang (7):
  PCI: Replace msleep(2) with fsleep() for precise delay
  PCI: Replace msleep(1) with fsleep() for precise link status checking
  PCI: rcar-host: Replace msleep(1) with fsleep() for precise speed
    change monitoring
  PCI: brcmstb: Replace msleep(5) with usleep_range() for precise link
    up checking
  PCI: rcar: Replace msleep(5) with usleep_range() for precise PHY ready
    checking
  PCI: pciehp: Replace msleep(10) with usleep_range() for precise delays
  PCI/DPC: Replace msleep(10) with usleep_range() for precise RP busy
    checking

 drivers/pci/controller/pcie-brcmstb.c   | 5 ++++-
 drivers/pci/controller/pcie-rcar-host.c | 4 +++-
 drivers/pci/controller/pcie-rcar.c      | 4 +++-
 drivers/pci/hotplug/pciehp_hpc.c        | 6 +++++-
 drivers/pci/pci.c                       | 9 +++------
 drivers/pci/pci.h                       | 7 +++++++
 drivers/pci/pcie/dpc.c                  | 5 ++++-
 7 files changed, 29 insertions(+), 11 deletions(-)


base-commit: b19a97d57c15643494ac8bfaaa35e3ee472d41da
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-08-26 17:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 0/7] PCI: Replace short msleep() calls with more precise delay functions Bjorn Helgaas
2025-08-24 16:05   ` Hans Zhang
2025-08-25 20:30     ` Bjorn Helgaas
2025-08-26 17:07   ` Hans Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox