[PATCH v19 15/20] x86/resctrl: Pass two extra arguments to resctrl_arch_rmid_read()
From: Tony Luck
Date: Tue May 28 2024 - 18:22:46 EST
For backwards compatibility on Sub-NUMA Cluster (SNC) systems the legacy
files in the mon_L3_XX directories must report the sum of data from each
SNC node sharing that L3 cache instance.
To make this possible, pass the "sumdomains" and "ci" fields from
rmid_read structure as extra arguments to resctrl_arch_rmid_read().
Note that the call from check_limbo() never operates on a "sum" basis,
so pass sumdomains=false, ci=NULL.
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
include/linux/resctrl.h | 4 +++-
arch/x86/kernel/cpu/resctrl/monitor.c | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index d733e1f6485d..d0281c93229d 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -276,6 +276,8 @@ void resctrl_offline_cpu(unsigned int cpu);
* @rmid: rmid of the counter to read.
* @eventid: eventid to read, e.g. L3 occupancy.
* @val: result of the counter read in bytes.
+ * @sum: sum across all domains sharing an L3 cache instance
+ * @ci: cacheinfo structure for the cache when @sum is true
* @arch_mon_ctx: An architecture specific value from
* resctrl_arch_mon_ctx_alloc(), for MPAM this identifies
* the hardware monitor allocated for this read request.
@@ -292,7 +294,7 @@ void resctrl_offline_cpu(unsigned int cpu);
*/
int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
u32 closid, u32 rmid, enum resctrl_event_id eventid,
- u64 *val, void *arch_mon_ctx);
+ u64 *val, bool sum, struct cacheinfo *ci, void *arch_mon_ctx);
/**
* resctrl_arch_rmid_read_context_check() - warn about invalid contexts
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index b9b4d2b5ca82..5f89ed4823ee 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -300,7 +300,7 @@ static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width)
int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_mon_domain *d,
u32 unused, u32 rmid, enum resctrl_event_id eventid,
- u64 *val, void *ignored)
+ u64 *val, bool sum, struct cacheinfo *ci, void *ignored)
{
struct rdt_hw_mon_domain *hw_dom = resctrl_to_arch_mon_dom(d);
struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
@@ -380,6 +380,7 @@ void __check_limbo(struct rdt_mon_domain *d, bool force_free)
entry = __rmid_entry(idx);
if (resctrl_arch_rmid_read(r, d, entry->closid, entry->rmid,
QOS_L3_OCCUP_EVENT_ID, &val,
+ false, NULL,
arch_mon_ctx)) {
rmid_dirty = true;
} else {
@@ -589,7 +590,7 @@ static int __mon_event_count(u32 closid, u32 rmid, struct rmid_read *rr)
}
rr->err = resctrl_arch_rmid_read(rr->r, rr->d, closid, rmid, rr->evtid,
- &tval, rr->arch_mon_ctx);
+ &tval, rr->sumdomains, rr->ci, rr->arch_mon_ctx);
if (rr->err)
return rr->err;
--
2.45.0