Re: [ndctl PATCH v8 0/7] Add error injection support

Cheatham, Benjamin
2026-02-16T14:28:35Z

On 2/12/2026 6:12 PM, Alison Schofield wrote:
> On Fri, Feb 06, 2026 at 03:50:01PM -0600, Ben Cheatham wrote:
>
> snip
>>
>> Ben Cheatham (7):
>> libcxl: Add debugfs path to CXL context
>> libcxl: Add CXL protocol errors
>> libcxl: Add poison injection support
>> cxl: Add inject-protocol-error command
>> cxl: Add poison injection/clear commands
>> cxl/list: Add injectable errors in output
>> Documentation: Add docs for protocol and poison injection commands
>
> Hi Ben,
>
> Same concern touches 2 patches, so commenting here:
> libcxl: Add CXL protocol errors
> cxl/list: Add injectable errors in output
>
> I'm seeing some unwanted complaining with cxl list when protocol inject
> is not supported. Here is a sample:
>
> # cxl list -P -v
> libcxl: cxl_add_protocol_errors: failed to access /sys/kernel/debug/cxl/einj_types: No such file or directory
> libcxl: cxl_dport_get_einj_path: failed to access /sys/kernel/debug/cxl/cxl_host_bridge.0/einj_inject: No such file or directory
> libcxl: cxl_dport_get_einj_path: failed to access /sys/kernel/debug/cxl/cxl_root_port.0/einj_inject: No such file or directory
> libcxl: cxl_dport_get_einj_path: failed to access /sys/kernel/debug/cxl/cxl_switch_dport.0/einj_inject: No such file or directory
>
> I believe it is not an error for the path not to exist. With the device poison,
> you already treat search for debugfs file as an existence test and no
> error is emitted on failure to find.
>
> If the diff below works for you, and nothing else comes up, I can fix it up
> when merging. Let me know -
>

Sorry about that, below looks good to me!

Thanks,
Ben
> diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
> index d86884bc2de1..5e8deb6e297b 100644
> --- a/cxl/lib/libcxl.c
> +++ b/cxl/lib/libcxl.c
> @@ -3496,10 +3496,8 @@ static void cxl_add_protocol_errors(struct cxl_ctx *ctx)
> }
>
> rc = access(path, F_OK);
> - if (rc) {
> - err(ctx, "failed to access %s: %s\n", path, strerror(errno));
> + if (rc)
> goto err;
> - }
>
> rc = sysfs_read_attr(ctx, path, buf);
> if (rc) {
> @@ -3593,7 +3591,6 @@ CXL_EXPORT char *cxl_dport_get_einj_path(struct cxl_dport *dport)
>
> rc = access(path, F_OK);
> if (rc) {
> - err(ctx, "failed to access %s: %s\n", path, strerror(errno));
> free(path);
> return NULL;
> }
>