Skip to content

Commit d507f83

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Support monitor configuration
Add a new field in struct mon_evt to support Bandwidth Monitoring Event Configuration (BMEC) and also update the "mon_features" display. The resctrl file "mon_features" will display the supported events and files that can be used to configure those events if monitor configuration is supported. Before the change: $ cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_local_bytes After the change when BMEC is supported: $ cat /sys/fs/resctrl/info/L3_MON/mon_features llc_occupancy mbm_total_bytes mbm_total_bytes_config mbm_local_bytes mbm_local_bytes_config Signed-off-by: Babu Moger <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent bd334c8 commit d507f83

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
5252
* struct mon_evt - Entry in the event list of a resource
5353
* @evtid: event id
5454
* @name: name of the event
55+
* @configurable: true if the event is configurable
5556
* @list: entry in &rdt_resource->evt_list
5657
*/
5758
struct mon_evt {
5859
enum resctrl_event_id evtid;
5960
char *name;
61+
bool configurable;
6062
struct list_head list;
6163
};
6264

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
800800
if (ret)
801801
return ret;
802802

803+
if (rdt_cpu_has(X86_FEATURE_BMEC)) {
804+
if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL))
805+
mbm_total_event.configurable = true;
806+
if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL))
807+
mbm_local_event.configurable = true;
808+
}
809+
803810
l3_mon_evt_init(r);
804811

805812
r->mon_capable = true;

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,11 @@ static int rdt_mon_features_show(struct kernfs_open_file *of,
998998
struct rdt_resource *r = of->kn->parent->priv;
999999
struct mon_evt *mevt;
10001000

1001-
list_for_each_entry(mevt, &r->evt_list, list)
1001+
list_for_each_entry(mevt, &r->evt_list, list) {
10021002
seq_printf(seq, "%s\n", mevt->name);
1003+
if (mevt->configurable)
1004+
seq_printf(seq, "%s_config\n", mevt->name);
1005+
}
10031006

10041007
return 0;
10051008
}

0 commit comments

Comments
 (0)