[v1,5/9] x86/resctrl: Call mon_event_count() directly for soft RMIDs
Commit Message
There is no point in using IPIs to call mon_event_count() when it is
only reading software counters from memory.
When RMIDs are soft, mon_event_read() just calls mon_event_count()
directly.
Signed-off-by: Peter Newman <peternewman@google.com>
---
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 9 ++++++++-
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/monitor.c | 5 +++++
3 files changed, 14 insertions(+), 1 deletion(-)
Comments
Hi Peter,
On 4/21/2023 7:17 AM, Peter Newman wrote:
> There is no point in using IPIs to call mon_event_count() when it is
> only reading software counters from memory.
>
> When RMIDs are soft, mon_event_read() just calls mon_event_count()
> directly.
From this patch forward the patch ordering is a bit confusing.
At this time mon_event_count() does not read software counters
from memory so I think this change should move to later.
Also, note that rdt_mon_soft_rmid is introduced here but
the reader is left wondering how it is set until the final patch
in this series.
Reinette
@@ -534,7 +534,14 @@ void mon_event_read(struct rmid_read *rr, struct rdt_resource *r,
rr->val = 0;
rr->first = first;
- smp_call_function_any(&d->cpu_mask, mon_event_count, rr, 1);
+ if (rdt_mon_soft_rmid)
+ /*
+ * Soft RMID counters reside in memory, so they can be read from
+ * anywhere.
+ */
+ mon_event_count(rr);
+ else
+ smp_call_function_any(&d->cpu_mask, mon_event_count, rr, 1);
}
int rdtgroup_mondata_show(struct seq_file *m, void *arg)
@@ -115,6 +115,7 @@ struct rmid_read {
extern bool rdt_alloc_capable;
extern bool rdt_mon_capable;
+extern bool rdt_mon_soft_rmid;
extern unsigned int rdt_mon_features;
extern struct list_head resctrl_schema_all;
@@ -57,6 +57,11 @@ static struct rmid_entry *rmid_ptrs;
*/
bool rdt_mon_capable;
+/*
+ * Global boolean to indicate when RMIDs are implemented in software.
+ */
+bool rdt_mon_soft_rmid;
+
/*
* Global to indicate which monitoring events are enabled.
*/