[PATCH v1 14/14] arm64/mpam: resctrl: export DSPRI value to info directory

From: Amit Singh Tomar
Date: Wed Jan 17 2024 - 09:18:24 EST


Now that, we have support for priority partitioning, let's export
Downstream priority value (maximum value that user can supply) to
info directory. This value is visible under resource directory
to which this control (Downstream priority partition ) is applied.

Signed-off-by: Amit Singh Tomar <amitsinght@xxxxxxxxxxx>
---
Changes since RFC:
* No change, it's new patch.
---
fs/resctrl/rdtgroup.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index d71fac0ae4d4..8c3df4bb8ee9 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1118,6 +1118,16 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
return 0;
}

+static int rdt_max_dspri_show(struct kernfs_open_file *of,
+ struct seq_file *seq, void *v)
+{
+ struct resctrl_schema *s = of->kn->parent->priv;
+ struct rdt_resource *r = s->res;
+
+ seq_printf(seq, "%u\n", r->default_dspri_ctrl);
+ return 0;
+}
+
static int rdt_min_bw_show(struct kernfs_open_file *of,
struct seq_file *seq, void *v)
{
@@ -1713,6 +1723,13 @@ static struct rftype res_common_files[] = {
.seq_show = rdt_bit_usage_show,
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
},
+ {
+ .name = "max_dspri",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_max_dspri_show,
+ .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
+ },
{
.name = "min_bandwidth",
.mode = 0444,
@@ -2009,6 +2026,9 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)

/* loop over enabled controls, these are all alloc_capable */
list_for_each_entry(s, &resctrl_schema_all, list) {
+ if (s->ctrl_type == SCHEMA_DSPRI)
+ continue;
+
r = s->res;
fflags = r->fflags | RF_CTRL_INFO;
ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags);
--
2.25.1