Re: [RFC PATCH 1/4] cxl/extent: Promote cxlr_dax->region_extent to an xarray

From: Gregory Price

Date: Fri May 01 2026 - 06:56:36 EST


On Wed, Apr 29, 2026 at 11:56:38AM +0100, Jonathan Cameron wrote:
> On Mon, 27 Apr 2026 10:12:02 -0500
> Ira Weiny <ira.weiny@xxxxxxxxx> wrote:
>
> > Jonathan Cameron wrote:
> > >
> > > > Look at the diagrams in this presentation:
> > > >
> > > > https://lpc.events/event/18/contributions/1826/attachments/1435/3335/LPC2024_CXL_DCD-v2.pdf
> > > >
> > > > 'DAX dev 1' covers memory from Extent A and Extent B. What yall will want
> > > > to do is ensure that the region extents which get surfaced are ordered
> > > > based on the sequence number _when_ _the_ _dax_ _device_ is created. The
> > > > order they come into the host does not really matter. Although yea the
> > > > spec has a bunch of rules... so whatever, follow those. But it is the
> > > > dax device which groups the extents into a contiguous HPA range and maps
> > >
> > > On this bit, HPA? Why would extents be contiguous in HPA? Contiguous
> > > in the DAX device mapping sure, but not HPA.
> >
> > I'm not saying the _extents_ are contiguous in HPA. I said they get
> > _mapped_ into a contiguous HPA _by_ the DAX device.
>
> That's not HPA at that point, it's a VA of some type.
> Now maybe it smells like HPA in some DAX interface but if it does
> we should think about any renames etc necessary to avoid it doing
> so! Or introduce DAXPA (not DPA for obvious reasons ;)
>

Dynamic Capacity Extent
Byte Offset Length Description
00h 08h Starting DPA

This is all we need to know what should happen in the rest of the path.

The device sends a set of DPA-extents that map into a host defined DCD
region (which has an HPA range).

The extents it sends may be laid out as such:

Extent0: Tag(A) Seq(0) DPA(0x0000.0000) Length(0x1000.0000)
Extent1: Tag(A) Seq(1) DPA(0xF000.0000) Length(0x1000.0000)
(start of device, end of device)

The CXL driver creates a DCD Region, which maps a *possible region of
memory* for extents, but this region *may be sparse*.

For example:

DCDRegion -> Base(0x5.0000.0000) Length(0x1.0000.0000)
Extent0 -> Base(0x5.0000.0000) Length(0x1000.0000) (start of region)
Extent1 -> Base(0x5.F000.0000) Length(0x1000.0000) (end of region)

This is a completely valid set of extents.

We use DAX to cobble these sparse extents into a "virtually contiguous"
region of memory - essentially base-0 + length.

DAX0.0: Base(0x0) Length(0x2000.0000)
Region List:
Base(0x0) -> Extent0
Base(0x1000.0000) -> Extent1


So in a single diagram:


[ device dc partition ]
[extent0] ... unalloc... [extent1] Device View
| Sparse! |
----------------------------------------
| Sparse! |
[extent0] ... unalloc... [extent1]
[ host dc region ] CXL Driver View
| |
----------------------------------------
| |
[ DAX0.0 ]
[ Extent0 ][ Extent1 ] DAX View
| NOT Sparse |
----------------------------------------
fd = open("/dev/dax0.0")
buf = mmap(fd, ...) Software View

buf[0]; -> DPA 0x0000.0000
buf[0x10000000]; -> DPA 0xF000.0000

~Gregory