[PATCH 04/23] resctrl: Expose per-control status in resource_schemata

Fenghua Yu fenghuay at nvidia.com
Thu Jul 16 14:02:54 PDT 2026


Emulated MB controls can be individually present or absent depending on
what the underlying MSC advertises, but user space has no way to tell
which controls under resource_schemata are actually backed by hardware.

Track this per control and expose it as a read-only "status" file for
scalar controls, reporting "enabled" or "disabled". The state is stored
as resctrl_membw::no_mbw_hw, which defaults to false so every control is
reported "enabled" (hardware-backed) unless an architecture explicitly
marks it as lacking MBW hardware of its own. This keeps the common case
correct on all architectures with no per-arch initialization code.

This commit only adds the generic field, the "status" file, and the
default (hardware-backed) reporting. No architecture writes no_mbw_hw
yet, so every control reports "enabled" until a backend sets it. On
MPAM the field is assigned for the emulated, hardware-less MB control in
a later patch that adds the node-scoped MB_NODE control.

Signed-off-by: Fenghua Yu <fenghuay at nvidia.com>
---
 fs/resctrl/rdtgroup.c   | 17 +++++++++++++++++
 include/linux/resctrl.h |  4 ++++
 2 files changed, 21 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 6b1f24c6a1f2..a3aad9b1ff6e 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2318,6 +2318,16 @@ static int resctrl_ctrl_unit_show(struct kernfs_open_file *of,
 	return 0;
 }
 
+static int resctrl_ctrl_status_show(struct kernfs_open_file *of,
+				    struct seq_file *seq, void *v)
+{
+	struct resctrl_ctrl *ctrl = rdt_kn_parent_priv(of->kn);
+
+	seq_printf(seq, "%s\n", ctrl->membw.no_mbw_hw ? "disabled" : "enabled");
+
+	return 0;
+}
+
 static struct rftype ctrl_files[] = {
 	{
 		.name		= "scope",
@@ -2375,6 +2385,13 @@ static struct rftype ctrl_files[] = {
 		.seq_show	= resctrl_ctrl_unit_show,
 		.fflags		= BIT(RESCTRL_CTRL_SCALAR),
 	},
+	{
+		.name		= "status",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= resctrl_ctrl_status_show,
+		.fflags		= BIT(RESCTRL_CTRL_SCALAR),
+	},
 };
 
 static int resctrl_add_ctrl_files(struct kernfs_node *kn, struct resctrl_ctrl *ctrl)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 4fc41e269d0b..5d8ea12ae16b 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -289,6 +289,9 @@ enum resctrl_ctrl_mode {
  *			"all" for a proportional schema. Base unit of an
  *			absolute control, for example "GBps".
  * @mba_sc:		True if MBA software controller(mba_sc) is enabled
+ * @no_mbw_hw:		True if the control has no MBW (mbw_max) hardware of its
+ *			own. Defaults to false (hardware-backed); architectures
+ *			set this for emulated controls that lack hardware.
  *
  * With a control value "C" written to the schemata file, min_bw <= C <= max_bw,
  * the amount of resource allocated by this control is:
@@ -303,6 +306,7 @@ struct resctrl_membw {
 	u32				scale;
 	enum resctrl_ctrl_unit		unit;
 	bool				mba_sc;
+	bool				no_mbw_hw;
 };
 
 enum resctrl_scope {
-- 
2.43.0




More information about the linux-arm-kernel mailing list