Re: [PATCH v8 2/3] cxl: Calculate region bandwidth of targets with shared upstream link

Alison Schofield
2024-09-12T01:06:35Z

On Tue, Sep 03, 2024 at 05:11:51PM -0700, Dave Jiang wrote:
> The current bandwidth calculation aggregates all the targets. This simple
> method does not take into account where multiple targets sharing under
> a switch or a root port where the aggregated bandwidth can be greater than
> the upstream link of the switch.
>
> To accurately account for the shared upstream uplink cases, a new update
> function is introduced by walking from the leaves to the root of the
> hierarchy and clamp the bandwidth in the process as needed. This process
> is done when all the targets for a region are present but before the
> final values are send to the HMAT handling code cached access_coordinate
> targets.
>
> The original perf calculation path was kept to calculate the latency
> performance data that does not require the shared link consideration.
> The shared upstream link calculation is done as a second pass when all
> the endpoints have arrived.
>
> Testing is done via qemu with CXL hierachy. run_qemu[1] is modified to
> support several CXL hierachy layouts. The following layouts are tested:
>
> HB: Host Bridge
> RP: Root Port
> SW: Switch
> EP: End Point
>
> 2 HB 2 RP 2 EP: resulting bandwidth: 624
> 1 HB 2 RP 2 EP: resulting bandwidth: 624
> 2 HB 2 RP 2 SW 4 EP: resulting bandwidth: 624
>
> Current testing, perf number from SRAT/HMAT is hacked into the kernel
> code. However with new QEMU support of Generic Target Port that's
> incoming, the perf data injection is no longer needed.
>
> [1]: https://github.com/pmem/run_qemu
>
> Suggested-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Link: https://lore.kernel.org/linux-cxl/20240501152503.00002e60@Huawei.com/
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>
> ---
> v8:
> - Fix uninitialized is_root (kbot)
> - Fix checking incorrect return value. (Alison)
> - Remove goto from cxl_region_shared_upstrea_bandwidth_update(). (Alison)
> - Add ** for kdoc. (Alison)
> ---

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

snip