The mbm_mode displays list of monitor modes supported.
The mbm_cntr_assign is one of the currently supported modes. It is also
called ABMC (Assignable Bandwidth Monitoring Counters) feature. ABMC
feature provides option to assign a hardware counter to an RMID and
monitor the bandwidth as long as it is assigned. ABMC mode is enabled
by default when supported.
Legacy mode works without the assignment option.
Provide an interface to display the monitor mode on the system.
$cat /sys/fs/resctrl/info/L3_MON/mbm_mode
[mbm_cntr_assign]
legacy
Switching the mbm_mode will reset all the mbm counters of all resctrl
groups.
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 6075b1e5bb77..d8f85b20ab8f 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -845,6 +845,26 @@ static int rdtgroup_rmid_show(struct kernfs_open_file *of,
return ret;
}
+static int rdtgroup_mbm_mode_show(struct kernfs_open_file *of,
+ struct seq_file *s, void *v)
+{
+ struct rdt_resource *r = of->kn->parent->priv;
+
+ if (r->mon.mbm_cntr_assignable) {
+ if (resctrl_arch_get_abmc_enabled()) {
+ seq_puts(s, "[mbm_cntr_assign]\n");
+ seq_puts(s, "legacy\n");
+ } else {
+ seq_puts(s, "mbm_cntr_assign\n");
+ seq_puts(s, "[legacy]\n");
+ }
+ } else {
+ seq_puts(s, "[legacy]\n");
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_PROC_CPU_RESCTRL
/*