From: Tony Luck <tony.luck@intel.com>
To: Fenghua Yu <fenghua.yu@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
Peter Newman <peternewman@google.com>,
James Morse <james.morse@arm.com>,
Babu Moger <babu.moger@amd.com>,
Drew Fustini <dfustini@baylibre.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
patches@lists.linux.dev, Tony Luck <tony.luck@intel.com>
Subject: [PATCH 07/10] x86/resctrl: Update rmdir_mondata_subdir_allrdtgrp() for Sub-NUMA domains
Date: Wed, 27 Mar 2024 13:03:49 -0700 [thread overview]
Message-ID: <20240327200352.236835-8-tony.luck@intel.com> (raw)
In-Reply-To: <20240327200352.236835-1-tony.luck@intel.com>
Old code could simply remove the mon_L3_XX directory with all
contents when a domain was taken offline. With Sub-NUMA cluster
enabled this becomes a multi-stage process.
While the parent L3 domain is still online the offline process for
a SUBL3 domain removes just one directory from mon_L3_XX. When the
last such domain goes offline the whole mon_L3_XX must be removed.
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++----
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 22effd8dc207..399dc3175292 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3012,17 +3012,49 @@ static int mon_addfile(struct kernfs_node *parent_kn, const char *name,
* and monitor groups with given domain id.
*/
static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
- unsigned int dom_id)
+ struct rdt_domain *d)
{
struct rdtgroup *prgrp, *crgrp;
- char name[32];
+ char pname[32], name[32];
+ bool remove_all = false;
+ struct kernfs_node *kn;
+ struct rdt_domain *pd;
+
+ sprintf(name, "mon_%s_%02d", r->name, d->id);
+
+ if (!r->parent) {
+ 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);
+ }
+ return;
+ }
+
+ sprintf(pname, "mon_%s_%02d", r->parent->name, d->parent);
+ pd = get_parent_domain(r, d);
+ if (!pd)
+ remove_all = true;
list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
- sprintf(name, "mon_%s_%02d", r->name, dom_id);
- kernfs_remove_by_name(prgrp->mon.mon_data_kn, name);
+ if (remove_all) {
+ kernfs_remove_by_name(prgrp->mon.mon_data_kn, pname);
+ } else {
+ kn = kernfs_find_and_get_ns(prgrp->mon.mon_data_kn, pname, NULL);
+ if (kn)
+ kernfs_remove_by_name(kn, name);
+ }
- list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
- kernfs_remove_by_name(crgrp->mon.mon_data_kn, name);
+ list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) {
+ if (remove_all) {
+ kernfs_remove_by_name(crgrp->mon.mon_data_kn, pname);
+ } else {
+ kn = kernfs_find_and_get_ns(crgrp->mon.mon_data_kn, pname, NULL);
+ if (kn)
+ kernfs_remove_by_name(kn, name);
+ }
+ }
}
}
@@ -3979,7 +4011,7 @@ void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d)
* per domain monitor data directories.
*/
if (resctrl_mounted && resctrl_arch_mon_capable())
- rmdir_mondata_subdir_allrdtgrp(r, d->id);
+ rmdir_mondata_subdir_allrdtgrp(r, d);
if (is_mbm_enabled())
cancel_delayed_work(&d->mbm_over);
--
2.44.0
next prev parent reply other threads:[~2024-03-27 20:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 20:03 [PATCH 00/10] Add support for Sub-NUMA cluster (SNC) systems Tony Luck
2024-03-27 20:03 ` [PATCH 01/10] x86/resctrl: Prepare for new domain scope Tony Luck
2024-03-27 20:03 ` [PATCH 02/10] x86/resctrl: Add new rdt_resource for sub-node monitoring Tony Luck
2024-03-27 20:03 ` [PATCH 03/10] x86/resctrl: Add new "enabled" state for monitor resources Tony Luck
2024-03-27 20:03 ` [PATCH 04/10] x86/resctrl: Add pointer to enabled monitor resource Tony Luck
2024-03-27 20:03 ` [PATCH 05/10] x86/resctrl: Add parent/child information to rdt_resource and rdt_domain Tony Luck
2024-03-27 20:03 ` [PATCH 06/10] x86/resctrl: Update mkdir_mondata_subdir() for Sub-NUMA domains Tony Luck
2024-03-27 20:03 ` Tony Luck [this message]
2024-03-27 20:03 ` [PATCH 08/10] x86/resctrl: Mark L3 monitor files with summation flag Tony Luck
2024-03-27 20:03 ` [PATCH 09/10] x86/resctrl: Update __mon_event_count() for Sub-NUMA domains Tony Luck
2024-03-27 20:03 ` [PATCH 10/10] x86/resctrl: Determine Sub-NUMA configuration Tony Luck
2024-05-02 17:00 ` [PATCH 00/10] Add support for Sub-NUMA cluster (SNC) systems Reinette Chatre
2024-05-03 15:38 ` Luck, Tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240327200352.236835-8-tony.luck@intel.com \
--to=tony.luck@intel.com \
--cc=babu.moger@amd.com \
--cc=dfustini@baylibre.com \
--cc=fenghua.yu@intel.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox