Re: [PATCH 2/7] libcxl: Add CXL protocol errors

Cheatham, Benjamin
2026-01-12T17:20:12Z

Hey Dave, thanks for taking a look! Responses inline.

On 1/9/2026 11:54 AM, Dave Jiang wrote:
>
>
> On 1/9/26 9:07 AM, Ben Cheatham wrote:
>> The v6.11 Linux kernel adds CXL protocl (CXL.cache & CXL.mem) error
>> injection for platforms that implement the error types as according to
>> the v6.5+ ACPI specification. The interface for injecting these errors
>> are provided by the kernel under the CXL debugfs. The relevant files in
>> the interface are the einj_types file, which provides the available CXL
>> error types for injection, and the einj_inject file, which injects the
>> error into a CXL VH root port or CXL RCH downstream port.
>>
>> Add a library API to retrieve the CXL error types and inject them. This
>> API will be used in a later commit by the 'cxl-inject-error' and
>> 'cxl-list' commands.
>>
>> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
>
> Just a nit below. otherwise
>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>

[snip]

>> +static void cxl_add_protocol_errors(struct cxl_ctx *ctx)
>> +{
>> + struct cxl_protocol_error *perror;
>> + char buf[SYSFS_ATTR_SIZE];
>> + char *path, *num, *save;
>> + size_t path_len, len;
>> + unsigned long n;
>> + int rc = 0;
>> +
>> + if (!ctx->cxl_debugfs)
>> + return;
>> +
>> + path_len = strlen(ctx->cxl_debugfs) + 100;
>> + path = calloc(1, path_len);
>
> Maybe just use PATH_MAX from <linux/limits.h>.

Sounds good to me, I'll change it.