Commit 499e1042 authored by Babu Moger's avatar Babu Moger Committed by Wenkuan Wang
Browse files

x86/resctrl: Support monitor configuration

mainline inclusion
from mainline-v6.3-rc1
commit d507f83c
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9U2JC


CVE: NA

--------------------------------

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: default avatarBabu Moger <babu.moger@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/r/20230113152039.770054-9-babu.moger@amd.com



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

Signed-off-by: default avatarWenkuan Wang <Wenkuan.Wang@amd.com>
parent dbe6d75e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -61,11 +61,13 @@ DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
 * struct mon_evt - Entry in the event list of a resource
 * @evtid:		event id
 * @name:		name of the event
 * @configurable:	true if the event is configurable
 * @list:		entry in &rdt_resource->evt_list
 */
struct mon_evt {
	u32			evtid;
	char			*name;
	bool			configurable;
	struct list_head	list;
};

+7 −0
Original line number Diff line number Diff line
@@ -708,6 +708,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
	if (ret)
		return ret;

	if (rdt_cpu_has(X86_FEATURE_BMEC)) {
		if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL))
			mbm_total_event.configurable = true;
		if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL))
			mbm_local_event.configurable = true;
	}

	l3_mon_evt_init(r);

	r->mon_capable = true;
+4 −1
Original line number Diff line number Diff line
@@ -998,8 +998,11 @@ static int rdt_mon_features_show(struct kernfs_open_file *of,
	struct rdt_resource *r = of->kn->parent->priv;
	struct mon_evt *mevt;

	list_for_each_entry(mevt, &r->evt_list, list)
	list_for_each_entry(mevt, &r->evt_list, list) {
		seq_printf(seq, "%s\n", mevt->name);
		if (mevt->configurable)
			seq_printf(seq, "%s_config\n", mevt->name);
	}

	return 0;
}