summaryrefslogtreecommitdiff
path: root/fs/resctrl/ctrlmondata.c
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2025-12-17 09:20:52 -0800
committerBorislav Petkov (AMD) <bp@alien8.de>2026-01-04 13:48:11 +0100
commit97fec06d35b2c1ce6d80cf3b01bfddd82c720a2d (patch)
tree8ffac6b3f5a0801edba87c75ed4c78a940bdc688 /fs/resctrl/ctrlmondata.c
parentc1b630573c8ca51a89bd480f7eeaf8754c7609f2 (diff)
downloadlinux-next-97fec06d35b2c1ce6d80cf3b01bfddd82c720a2d.tar.gz
linux-next-97fec06d35b2c1ce6d80cf3b01bfddd82c720a2d.zip
x86,fs/resctrl: Refactor domain create/remove using struct rdt_domain_hdr
Up until now, all monitoring events were associated with the L3 resource and it made sense to use the L3 specific "struct rdt_mon_domain *" argument to functions operating on domains. Telemetry events will be tied to a new resource with its instances represented by a new domain structure that, just like struct rdt_mon_domain, starts with the generic struct rdt_domain_hdr. Prepare to support domains belonging to different resources by changing the calling convention of functions operating on domains. Pass the generic header and use that to find the domain specific structure where needed. Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
Diffstat (limited to 'fs/resctrl/ctrlmondata.c')
-rw-r--r--fs/resctrl/ctrlmondata.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index 905c310de573..3154cdc98a31 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -551,14 +551,21 @@ struct rdt_domain_hdr *resctrl_find_domain(struct list_head *h, int id,
}
void mon_event_read(struct rmid_read *rr, struct rdt_resource *r,
- struct rdt_mon_domain *d, struct rdtgroup *rdtgrp,
+ struct rdt_domain_hdr *hdr, struct rdtgroup *rdtgrp,
cpumask_t *cpumask, int evtid, int first)
{
+ struct rdt_mon_domain *d = NULL;
int cpu;
/* When picking a CPU from cpu_mask, ensure it can't race with cpuhp */
lockdep_assert_cpus_held();
+ if (hdr) {
+ if (!domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, RDT_RESOURCE_L3))
+ return;
+ d = container_of(hdr, struct rdt_mon_domain, hdr);
+ }
+
/*
* Setup the parameters to pass to mon_event_count() to read the data.
*/
@@ -653,12 +660,11 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
* the resource to find the domain with "domid".
*/
hdr = resctrl_find_domain(&r->mon_domains, domid, NULL);
- if (!hdr || !domain_header_is_valid(hdr, RESCTRL_MON_DOMAIN, resid)) {
+ if (!hdr) {
ret = -ENOENT;
goto out;
}
- d = container_of(hdr, struct rdt_mon_domain, hdr);
- mon_event_read(&rr, r, d, rdtgrp, &d->hdr.cpu_mask, evtid, false);
+ mon_event_read(&rr, r, hdr, rdtgrp, &hdr->cpu_mask, evtid, false);
}
checkresult: