RFC: configfs attribute description

From: Lucas De Marchi
Date: Wed Aug 13 2025 - 11:38:42 EST


Hi,

In the drm/xe drivers we recently started to use configfs for a few
things that would be added as module parameters in the past. Configfs
seems a much better fit for us in these cases.

One thing we are missing from module parameters is the description.
I can point people to https://docs.kernel.org/gpu/xe/xe_configfs.html,
but having a short description somewhere of each config at runtime would
be good. I thought of 2 alternatives and would like to know your opinion
or if there's a different way you envision for this.

1) Add description to a module info. This would allow to show "all
configfs attributes this module implements":

configfs.h:
#define CONFIGFS_ATTR_DESC(_name, _desc) \
MODULE_INFO(configfs_attr_ ## _name, _desc)

xe_configfs.c:
#define XE_CONFIGFS_ATTR(_name, _desc) \
CONFIGFS_ATTR(, survivability_mode); \
CONFIGFS_ATTR_DESC(survivability_mode, \
"Bind device in a survivability mode useful to unbrick it")

Or provide a single macro in configfs itself. This would "standardize"
module info to contain configfs_attr_xxxxx to describe each entry a
module implements. Main benefit here is that I can take a module and run

2) Add description in the fs tree itself, similarly to how perf adds a
.unit: 2 attributes are created, with the second being RO:

ls /sys/kernel/config/xe/0000:03:00.0/
...
survivability_mode
survivability_mode.description
...

This could be done all inside xe itself, but I think it would be better
if there's a common way across the kernel for that, hence my RFC here.

thanks
Lucas De Marchi