[<prev] [next>] [day] [month] [year] [list]
Message-ID: <176807435882.510.3454113946711939080.tip-bot2@tip-bot2>
Date: Sat, 10 Jan 2026 19:45:58 -0000
From: "tip-bot2 for Tony Luck" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Reinette Chatre <reinette.chatre@...el.com>,
Tony Luck <tony.luck@...el.com>, "Borislav Petkov (AMD)" <bp@...en8.de>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject:
[tip: x86/cache] fs/resctrl: Refactor rmdir_mondata_subdir_allrdtgrp()
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: 93d9fd89995181d7ff420752328cc8b4b228f100
Gitweb: https://git.kernel.org/tip/93d9fd89995181d7ff420752328cc8b4b228f100
Author: Tony Luck <tony.luck@...el.com>
AuthorDate: Wed, 17 Dec 2025 09:21:09 -08:00
Committer: Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Fri, 09 Jan 2026 23:02:58 +01:00
fs/resctrl: Refactor rmdir_mondata_subdir_allrdtgrp()
Clearing a monitor group's mon_data directory is complicated because of the
support for Sub-NUMA Cluster (SNC) mode.
Refactor the SNC case into a helper function to make it easier to add support
for a new telemetry resource.
Suggested-by: Reinette Chatre <reinette.chatre@...el.com>
Signed-off-by: Tony Luck <tony.luck@...el.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
---
fs/resctrl/rdtgroup.c | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 6314819..57139f9 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -3229,28 +3229,24 @@ static void mon_rmdir_one_subdir(struct kernfs_node *pkn, char *name, char *subn
}
/*
- * Remove all subdirectories of mon_data of ctrl_mon groups
- * and monitor groups for the given domain.
- * Remove files and directories containing "sum" of domain data
- * when last domain being summed is removed.
+ * Remove files and directories for one SNC node. If it is the last node
+ * sharing an L3 cache, then remove the upper level directory containing
+ * the "sum" files too.
*/
-static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
- struct rdt_domain_hdr *hdr)
+static void rmdir_mondata_subdir_allrdtgrp_snc(struct rdt_resource *r,
+ struct rdt_domain_hdr *hdr)
{
struct rdtgroup *prgrp, *crgrp;
struct rdt_l3_mon_domain *d;
char subname[32];
- bool snc_mode;
char name[32];
if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
return;
d = container_of(hdr, struct rdt_l3_mon_domain, hdr);
- snc_mode = r->mon_scope == RESCTRL_L3_NODE;
- sprintf(name, "mon_%s_%02d", r->name, snc_mode ? d->ci_id : hdr->id);
- if (snc_mode)
- sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id);
+ sprintf(name, "mon_%s_%02d", r->name, d->ci_id);
+ sprintf(subname, "mon_sub_%s_%02d", r->name, hdr->id);
list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
mon_rmdir_one_subdir(prgrp->mon.mon_data_kn, name, subname);
@@ -3261,6 +3257,30 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
}
/*
+ * Remove all subdirectories of mon_data of ctrl_mon groups
+ * and monitor groups for the given domain.
+ */
+static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
+ struct rdt_domain_hdr *hdr)
+{
+ struct rdtgroup *prgrp, *crgrp;
+ char name[32];
+
+ if (r->rid == RDT_RESOURCE_L3 && r->mon_scope == RESCTRL_L3_NODE) {
+ rmdir_mondata_subdir_allrdtgrp_snc(r, hdr);
+ return;
+ }
+
+ sprintf(name, "mon_%s_%02d", r->name, hdr->id);
+ list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
+ kernfs_remove_by_name(prgrp->mon.mon_data_kn, name);
+
+ list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
+ kernfs_remove_by_name(crgrp->mon.mon_data_kn, name);
+ }
+}
+
+/*
* Create a directory for a domain and populate it with monitor files. Create
* summing monitors when @hdr is NULL. No need to initialize summing monitors.
*/
Powered by blists - more mailing lists