@@ -400,6 +400,26 @@ When monitoring is enabled all MON groups will also contain:
the sum for all tasks in the CTRL_MON group and all tasks in
MON groups. Please see example section for more details on usage.
+"monitor_state":
+ Available when ABMC feature is supported. ABMC feature provides an
+ option to the user to assign an RMID to hardware counter and
+ monitor the bandwidth for the longer duration. The RMID will
+ be active until user unassigns it manually. Each group will have
+ two events that are assignable. By default, the events are
+ unassigned. Index 0 holds the monitor_state for MBM total bytes.
+ Index 1 holds the monitor_state for MBM local bytes.
+
+ Example::
+
+ # cat /sys/fs/resctrl/monitor_state
+ total=unassign;local=unassign
+
+ When the events are assigned, the output will look like below.
+ Example::
+
+ # cat /sys/fs/resctrl/monitor_state
+ total=assign;local=assign
+
"mon_hw_id":
Available only with debug option. The identifier used by hardware
for the monitor group. On x86 this is the RMID.
@@ -57,6 +57,12 @@
/* ABMC ENABLE */
#define ABMC_ENABLE BIT(0)
+/*
+ * monitor group's state when ABMC is enabled
+ */
+#define TOTAL_ASSIGN BIT(0)
+#define LOCAL_ASSIGN BIT(1)
+
struct rdt_fs_context {
struct kernfs_fs_context kfc;
bool enable_cdpl2;
@@ -163,12 +169,14 @@ enum rdtgrp_mode {
* @parent: parent rdtgrp
* @crdtgrp_list: child rdtgroup node list
* @rmid: rmid for this rdtgroup
+ * @monitor_state: Assignment state of the group
*/
struct mongroup {
struct kernfs_node *mon_data_kn;
struct rdtgroup *parent;
struct list_head crdtgrp_list;
u32 rmid;
+ u32 monitor_state;
};
/**
@@ -829,6 +829,8 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
RFTYPE_MON_INFO);
resctrl_file_fflags_init("mbm_assign_enable",
RFTYPE_MON_INFO);
+ resctrl_file_fflags_init("monitor_state",
+ RFTYPE_MON_BASE);
}
}
@@ -779,6 +779,36 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of,
return ret;
}
+static int rdtgroup_monitor_state_show(struct kernfs_open_file *of,
+ struct seq_file *s, void *v)
+{
+ struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
+ struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
+ struct rdtgroup *rdtgrp;
+ int ret = 0;
+
+ if (!hw_res->abmc_enabled) {
+ rdt_last_cmd_puts("Assignable Bandwidth Monitoring is not enabled\n");
+ seq_printf(s, "Unsuppoted\n");
+ return ret;
+ }
+
+ rdt_last_cmd_clear();
+
+ rdtgrp = rdtgroup_kn_lock_live(of->kn);
+ if (rdtgrp)
+ seq_printf(s, "total=%s;local=%s\n",
+ rdtgrp->mon.monitor_state & TOTAL_ASSIGN ?
+ "assign" : "unassign",
+ rdtgrp->mon.monitor_state & LOCAL_ASSIGN ?
+ "assign" : "unassign");
+ else
+ ret = -EINVAL;
+ rdtgroup_kn_unlock(of->kn);
+
+ return ret;
+}
+
static int rdtgroup_closid_show(struct kernfs_open_file *of,
struct seq_file *s, void *v)
{
@@ -1944,6 +1974,12 @@ static struct rftype res_common_files[] = {
.flags = RFTYPE_FLAGS_CPUS_LIST,
.fflags = RFTYPE_BASE,
},
+ {
+ .name = "monitor_state",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdtgroup_monitor_state_show,
+ },
{
.name = "tasks",
.mode = 0644,
@@ -2439,6 +2475,7 @@ static void resctrl_abmc_msrwrite(void *arg)
static int resctrl_abmc_setup(enum resctrl_res_level l, bool enable)
{
struct rdt_resource *r = &rdt_resources_all[l].r_resctrl;
+ struct rdtgroup *prgrp, *crgrp;
struct rdt_domain *d;
/* Update QOS_CFG MSR on all the CPUs in cpu_mask */
@@ -2447,6 +2484,14 @@ static int resctrl_abmc_setup(enum resctrl_res_level l, bool enable)
resctrl_arch_reset_rmid_all(r, d);
}
+ /* Reset monitor state for all the monitor groups */
+ list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) {
+ memset(&prgrp->mon.monitor_state, 0, sizeof(prgrp->mon.monitor_state));
+
+ list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list)
+ memset(&crgrp->mon.monitor_state, 0, sizeof(crgrp->mon.monitor_state));
+ }
+
return 0;
}