Re: [PATCH 2/3] cxl: Account for link width in latency calculation

From: Alison Schofield

Date: Fri Oct 09 2026 - 15:04:44 EST


On Fri, Oct 09, 2026 at 01:54:51PM +0900, Koichiro Den wrote:
> cxl_pci_get_latency() derives bandwidth from the per-lane speed returned
> by pcie_link_speed_mbps(), ignoring the negotiated link width. This
> overestimates the FlitLatency contribution for multi-lane links.
> Sections 2.11.3 and 2.11.4 of the Intel CXL Memory Device Software Guide
> describe the link bandwidth as the product of the negotiated speed and
> width.
>
> Replace pcie_link_speed_mbps() with pcie_link_bandwidth_mbps() and
> migrate both CXL callers (the only users of the API). The new helper
> obtains speed and width from a single Link Status read. The CXL
> bandwidth calculation no longer needs a separate width read and
> multiplication.
>
> While at it, make error handling more robust by converting PCI config
> read errors to negative errno values and checking for zero bandwidth
> before calculating latency.

It would be nice to include the link here to the mentioned guide:
[1] https://www.intel.com/content/www/us/en/content-details/643805/cxl-memory-device-software-guide.html

Reviewed-by: Alison Schofield <alison.schofield@xxxxxxxxx>