Skip to content

util/sysfs: libcxl fails to bind on kernels >= 6.2 due to cxl_nvdimm_bridge #298

Description

@xutao323

The kernel commit torvalds/linux@cb9cfff removed bind attributes for cxl_pmem_region and cxl_nvdimm* objects.

Current libcxl logic attempts to find a bind attribute for every entry in /sys/bus/cxl/drivers/. Since some cxl objects do not have a bind attribute anymore, libcxl fails probing with ENOENT (No such file or directory). This masks actual device errors and prevents proper enumeration on kernels v6.2 and newer.

A simple check for bind shall be able to fix and pass the right errno from other cxl modules.

diff --git a/util/sysfs.c b/util/sysfs.c
index e027e38..41ee4d6 100644
--- a/util/sysfs.c
+++ b/util/sysfs.c
@@ -216,6 +216,11 @@ int __util_bind(const char *devname, struct kmod_module *module,
                        continue;
                }
 
+               if (access(drv_path, F_OK) != 0) {
+                       free(drv_path);
+                       continue;
+               }
+
                rc = __sysfs_write_attr_quiet(ctx, drv_path, devname);
                free(drv_path);
                if (rc == 0)

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions