[RFC PATCH 1/8] fs/resctrl: Change UI of "max" file (merge back into earlier patches)
From: Tony Luck
Date: Mon Oct 26 2026 - 18:06:55 EST
Make the UI of the "max" file show values per-domain so no changes
in UI are needed when support for asymmetric controls (L2 on hybrid
CPUs) is added later.
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
Documentation/filesystems/resctrl.rst | 5 ++++-
fs/resctrl/rdtgroup.c | 27 ++++++++++++++++++++-------
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 434e6f42db4a..de162280a0fe 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -397,12 +397,15 @@ with individual files:
the schemata file.
"max":
+ Maximum values per domain in the same format as the schemata file.
+ Format of values depends on the type of the control:
+
When "type" == "scalar":
The maximum value that can be written to the control when writing
the schemata file.
When "type" == "bitmap":
- The supported bitmap (in hexadecimal with 0x prefix) with
+ The supported bitmap (in hexadecimal without 0x prefix) with
all bits set.
"tolerance":
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 416b73c57016..7119ad0029c1 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2465,15 +2465,28 @@ static int resctrl_ctrl_max_show(struct kernfs_open_file *of,
struct seq_file *seq, void *v)
{
struct resctrl_ctrl *ctrl = rdt_kn_parent_priv(of->kn);
+ struct rdt_ctrl_domain *d;
+ bool sep = false;
- switch (ctrl->type) {
- case RESCTRL_CTRL_SCALAR:
- seq_printf(seq, "%u\n", ctrl->scalar.max);
- break;
- case RESCTRL_CTRL_BITMAP:
- seq_printf(seq, "0x%lx\n", BIT_MASK(ctrl->bitmap.cbm_len) - 1);
- break;
+ if (!info_kn_lock(of->kn))
+ return -ENOENT;
+
+ list_for_each_entry_rcu(d, &ctrl->domains, hdr.list, lockdep_is_cpus_held()) {
+ if (sep)
+ seq_putc(seq, ';');
+ switch (ctrl->type) {
+ case RESCTRL_CTRL_SCALAR:
+ seq_printf(seq, "%d=%u", d->hdr.id, ctrl->scalar.max);
+ break;
+ case RESCTRL_CTRL_BITMAP:
+ seq_printf(seq, "%d=%lx", d->hdr.id, BIT_MASK(ctrl->bitmap.cbm_len) - 1);
+ break;
+ }
+ sep = true;
}
+ seq_putc(seq, '\n');
+
+ info_kn_unlock(of->kn);
return 0;
}
--
2.56.0