Re: CXL Boot to Bash - Section 2: The Drivers

From: Gregory Price
Date: Mon Mar 03 2025 - 20:35:39 EST


On Wed, Feb 05, 2025 at 11:06:08AM -0500, Gregory Price wrote:
> ---------------------------------------------------------
> Second bit of nuanced complexity: Memory Block Alignment.
> ---------------------------------------------------------
> In section 1, we introduced CEDT / CFMW and how they map to iomem
> resources. In this section we discussed out we surface memory blocks
> to the kernel allocators.
>
> However, at no time did platform, arch code, and driver communicate
> about the expected size of a memory block. In most cases, the size
> of a memory block is defined by the architecture - unaware of CXL.
>
> On x86, for example, the heuristic for memory block size is:
> 1) user boot-arg value
> 2) Maximize size (up to 2GB) if operating on bare metal
> 3) Use smallest value that aligns with the end of memory
>
> The problem is that [SOFT RESERVED] memory is not considered in the
> alignment calculation - and not all [SOFT RESERVED] memory *should*
> be considered for alignment.
>
> In the case of our working example (real system, btw):
>
> Subtable Type : 01 [CXL Fixed Memory Window Structure]
> Window base address : 000000C050000000
> Window size : 0000003CA0000000
>
> The base is 256MB aligned (the minimum for the CXL Spec), and the
> window size is 512MB. This results in a loss of almost a full memory
> block worth of memory (~1280MB on the front, and ~512MB on the back).
>
> This is a loss of ~0.7% of capacity (1.5GB) for that region (121.25GB).
>

Some additional nuance adding here: Dynamic Capacity Devices will also
have problems with this issue unless the fabric manager is aware of the
host memory block size configuration.

Variable sized or sparse memory blocks may be possible in the future,
but as of today they are not.

~Gregory