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 03/10] x86/resctrl: Add new "enabled" state for monitor resources
Date: Wed, 27 Mar 2024 13:03:45 -0700 [thread overview]
Message-ID: <20240327200352.236835-4-tony.luck@intel.com> (raw)
In-Reply-To: <20240327200352.236835-1-tony.luck@intel.com>
When Sub-NUMA cluster is enabled resctrl needs to build domain
lists for both the regular L3 resource (scoped at L3 cache level)
and the SUBL3 resource (scoped at NUMA node level).
But only one of these resources will be used for all monitoring
functions.
Add a new "enabled" flag to indicate which resource should allocate
space for MBM counters, run MBM overflow and LLC occupancy timeouts
etc.
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
include/linux/resctrl.h | 2 ++
arch/x86/kernel/cpu/resctrl/internal.h | 4 ++++
arch/x86/kernel/cpu/resctrl/core.c | 4 ++--
arch/x86/kernel/cpu/resctrl/monitor.c | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 ++++----
5 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index f39a07b27a98..dea79f6a8122 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -161,6 +161,7 @@ enum resctrl_scope {
* @rid: The index of the resource
* @alloc_capable: Is allocation available on this machine
* @mon_capable: Is monitor feature available on this machine
+ * @mon_enabled: Monitor feature enabled for this resource
* @num_rmid: Number of RMIDs available
* @scope: Scope of this resource
* @cache: Cache allocation related data
@@ -179,6 +180,7 @@ struct rdt_resource {
int rid;
bool alloc_capable;
bool mon_capable;
+ bool mon_enabled;
int num_rmid;
enum resctrl_scope scope;
struct resctrl_cache cache;
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 24fad5ecc158..5fcff861e185 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -514,6 +514,10 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable);
for_each_rdt_resource(r) \
if (r->mon_capable)
+#define for_each_mon_enabled_rdt_resource(r) \
+ for_each_rdt_resource(r) \
+ if (r->mon_enabled)
+
/* CPUID.(EAX=10H, ECX=ResID=1).EAX */
union cpuid_0x10_1_eax {
struct {
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 395bcb3199f8..bfa179f20802 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -559,7 +559,7 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
return;
}
- if (r->mon_capable && arch_domain_mbm_alloc(r->num_rmid, hw_dom)) {
+ if (r->mon_enabled && arch_domain_mbm_alloc(r->num_rmid, hw_dom)) {
domain_free(hw_dom);
return;
}
@@ -1002,7 +1002,7 @@ static void __exit resctrl_exit(void)
rdtgroup_exit();
- if (r->mon_capable)
+ if (r->mon_enabled)
rdt_put_mon_l3_config();
}
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index c34a35ec0f03..84a2056190c8 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -1060,6 +1060,7 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
l3_mon_evt_init(r);
r->mon_capable = true;
+ r->mon_enabled = true;
return 0;
}
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index b8588ce88eef..ffcafe567b25 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3150,7 +3150,7 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
* Create the subdirectories for each domain. Note that all events
* in a domain like L3 are grouped into a resource whose domain is L3
*/
- for_each_mon_capable_rdt_resource(r) {
+ for_each_mon_enabled_rdt_resource(r) {
ret = mkdir_mondata_subdir_alldom(kn, r, prgrp);
if (ret)
goto out_destroy;
@@ -3937,7 +3937,7 @@ void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d)
if (supports_mba_mbps() && r->rid == RDT_RESOURCE_MBA)
mba_sc_domain_destroy(r, d);
- if (!r->mon_capable)
+ if (!r->mon_enabled)
goto out_unlock;
/*
@@ -4011,7 +4011,7 @@ int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d)
goto out_unlock;
}
- if (!r->mon_capable)
+ if (!r->mon_enabled)
goto out_unlock;
err = domain_setup_mon_state(r, d);
@@ -4074,7 +4074,7 @@ void resctrl_offline_cpu(unsigned int cpu)
}
}
- if (!l3->mon_capable)
+ if (!l3->mon_enabled)
goto out_unlock;
d = get_domain_from_cpu(cpu, l3);
--
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 ` Tony Luck [this message]
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 ` [PATCH 07/10] x86/resctrl: Update rmdir_mondata_subdir_allrdtgrp() " Tony Luck
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-4-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