Re: [PATCH] PCI/DOE: Poll briefly for a response before sleeping
From: Lukas Wunner
Date: Fri Sep 18 2026 - 10:43:51 EST
On Fri, Sep 18, 2026 at 01:03:23AM +0200, Michal Clapinski wrote:
> doe_statemachine_work() waits for a response by sleeping
> PCI_DOE_POLL_INTERVAL (PCI_DOE_TIMEOUT / 128) between status reads,
> which is 7 ms at HZ=1000 and 4 ms at HZ=250. Exchanges are served from
> the device's local mailbox logic and typically complete within tens of
> microseconds, so nearly all of that sleep is wasted. Every DOE-capable
> endpoint pays it once per supported feature during enumeration.
>
> Poll with usleep_range(20, 50) for the first ~2 ms before falling back
> to the jiffies-based wait. On an Intel Emerald Rapids system, time spent
> in pci_device_add() for a DOE-capable endpoint drops from 41.8 ms to
> 14.0 ms.
Polling is just a poor man's replacement for interrupts. DOE supports
interrupt-driven transfers but we're not taking advantage of it so far.
Perhaps you could look into adding that? It would seem more worthwhile
than optimizing polling.
Thanks,
Lukas