Re: [PATCH 2/5] cxl: Rename CXL_DECODER_HOSTONLYMEM/DEVMEM

From: Huang, Ying
Date: Fri Oct 18 2024 - 02:22:32 EST


Hi, Dan,

Dan Williams <dan.j.williams@xxxxxxxxx> writes:

> Huang Ying wrote:
>> Previously, CXL type3 devices (memory expanders) use host only
>> coherence (HDM-H), while CXL type2 devices (accelerators) use dev
>> coherence (HDM-D). So the name of the target device type of a cxl
>> decoder is CXL_DECODER_HOSTONLYMEM for type3 devices and
>> CXL_DECODER_DEVMEM for type2 devices. However, this isn't true
>> anymore. CXL type3 devices can use dev coherence + back
>> invalidation (HDM-DB) too.
>>
>> To avoid confusion between the device type and coherence, the patch
>> renames CXL_DECODER_HOSTONLYMEM/DEVMEM to CXL_DECODER_EXPANDER/ACCEL.
>
> This does not look like an improvement to me. Type-3 devices that
> support back-invalidate are DEVMEM devices. The device plays a role in
> the coherence.
>
> Your explanation is the reverse of this commit:
>
> 5aa39a9165cf cxl/port: Rename CXL_DECODER_{EXPANDER, ACCELERATOR} => {HOSTONLYMEM, DEVMEM}
>
> ...so I am confused what motivated this rename?

Sorry, I am confused about the target_type and coherence and forgot to
check the history. In some places, current kernel still hints
target_type (CXL_DECODER_HOSTONLYMEM/DEVMEM) as expander/accelerator.
Should we change them to avoid confusion in the future?

$ grep expander -r drivers/cxl/
drivers/cxl/cxl.h:346: * @target_type: accelerator vs expander (type2 vs type3) selector
drivers/cxl/core/region.c:2450: * @type: select whether this is an expander or accelerator (type-2 or type-3)
drivers/cxl/core/port.c:141: return sysfs_emit(buf, "expander\n");

The last one is

static ssize_t target_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct cxl_decoder *cxld = to_cxl_decoder(dev);

switch (cxld->target_type) {
case CXL_DECODER_DEVMEM:
return sysfs_emit(buf, "accelerator\n");
case CXL_DECODER_HOSTONLYMEM:
return sysfs_emit(buf, "expander\n");
}
return -ENXIO;
}
static DEVICE_ATTR_RO(target_type);

for decoder device. This is a testing ABI documented in,

Documentation/ABI/testing/sysfs-bus-cxl

Is it OK to change this?

--
Best Regards,
Huang, Ying