diff options
| author | Koichiro Den <den@valinux.co.jp> | 2026-10-09 13:54:51 +0900 |
|---|---|---|
| committer | Dave Jiang <dave.jiang@intel.com> | 2026-10-09 14:10:35 -0700 |
| commit | db4503d4575cdd2fad7e8a13a8a8ffcbc86d152d (patch) | |
| tree | 591000390ff2fea0ca57e4a6c5ecf8fc8c49b1b8 /tools/perf/scripts | |
| parent | 16440d6e4bf1175cda83438d9f9a8ae84bfcf0ee (diff) | |
| download | linux-next-db4503d4575cdd2fad7e8a13a8a8ffcbc86d152d.tar.gz linux-next-db4503d4575cdd2fad7e8a13a8a8ffcbc86d152d.zip | |
cxl: Account for link width in latency calculation
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.
Fixes: 4d07a05397c8 ("cxl: Calculate and store PCI link latency for the downstream ports")
Cc: stable@vger.kernel.org
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci/pci.c
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20261009045452.1107921-3-den@valinux.co.jp
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'tools/perf/scripts')
0 files changed, 0 insertions, 0 deletions
