[PATCH v3 12/26] fs/resctrl: Add hook for architecture code to set monitor event attributes
From: Tony Luck
Date: Mon Apr 07 2025 - 19:42:38 EST
Architecture code knows whether an event can be read from any CPU, or
from a CPU on a specific domain. It also knows what format to use
when printing each event value.
Add a hook to set mon_event.any_cpu and mon_event.type.
Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
---
include/linux/resctrl.h | 3 +++
fs/resctrl/monitor.c | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 0fce626605b9..8ac77b738de5 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -418,6 +418,9 @@ void resctrl_offline_mon_domain(struct rdt_resource *r, struct rdt_mon_domain *d
void resctrl_online_cpu(unsigned int cpu);
void resctrl_offline_cpu(unsigned int cpu);
+int resctrl_set_event_attributes(enum resctrl_event_id evt,
+ enum resctrl_event_type type, bool any_cpu);
+
/**
* resctrl_arch_rmid_read() - Read the eventid counter corresponding to rmid
* for this resource and domain.
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 1efad57d1d85..5846a13c631a 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -863,6 +863,18 @@ static struct mon_evt all_events[QOS_NUM_EVENTS] = {
},
};
+int resctrl_set_event_attributes(enum resctrl_event_id evt,
+ enum resctrl_event_type type, bool any_cpu)
+{
+ if (evt >= QOS_NUM_EVENTS)
+ return -ENOENT;
+
+ all_events[evt].type = type;
+ all_events[evt].any_cpu = any_cpu;
+
+ return 0;
+}
+
int rdt_lookup_evtid_by_name(char *name)
{
int evt;
--
2.48.1