[PATCH v4 29/31] fs/resctrl: Add interface for per-resource debug info files

Tony Luck posted 31 patches 7 months, 3 weeks ago
There is a newer version of this series
[PATCH v4 29/31] fs/resctrl: Add interface for per-resource debug info files
Posted by Tony Luck 7 months, 3 weeks ago
There are some status registers on each of the telemetry aggregators.
Users may need to view these to understand unexpected event counter
values.

Add the file system support for a "status" file in each mon_capable
resource directory in the "info" directory. This will only be present if
the file system is mounted with the "-o debug" option. It will only have
content for resources that provide a rdt_resource::info_debug() routine.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 include/linux/resctrl.h |  1 +
 fs/resctrl/rdtgroup.c   | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 3ae50b947a99..675cfbe3e6c6 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -299,6 +299,7 @@ struct rdt_resource {
 	struct list_head	evt_list;
 	unsigned int		mbm_cfg_mask;
 	bool			cdp_capable;
+	void			(*info_debug)(struct seq_file *s);
 };
 
 /*
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 195e41eb73fb..5948e279b44c 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1022,6 +1022,17 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
 	return 0;
 }
 
+static int rdtgroup_info_debug_show(struct kernfs_open_file *of,
+				struct seq_file *s, void *v)
+{
+	struct rdt_resource *r = rdt_kn_parent_priv(of->kn);
+
+	if (r->info_debug)
+		r->info_debug(s);
+
+	return 0;
+}
+
 /*
  * rdt_bit_usage_show - Display current usage of resources
  *
@@ -1983,6 +1994,13 @@ static struct rftype res_common_files[] = {
 		.seq_show	= rdtgroup_closid_show,
 		.fflags		= RFTYPE_CTRL_BASE | RFTYPE_DEBUG,
 	},
+	{
+		.name		= "status",
+		.mode		= 0444,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= rdtgroup_info_debug_show,
+		.fflags		= RFTYPE_MON_INFO | RFTYPE_DEBUG,
+	},
 };
 
 static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags)
-- 
2.48.1