Skip to contentSkip to conversation

fs,x86/resctrl: Support AMD Assignable Bandwidth Monitoring Counters (ABMC)

PATCH Applied Babu Moger 5 participants 118 messages Jun 13, 2025 – Jul 8, 2025 Page 2 of 2

Subsystems (3)

v14 of 18 Applied Latest is v18 →

lore
Share & tools
lore
author reviewer
#111 lore raw

Re: [PATCH v14 31/32] fs/resctrl: Introduce the interface to switch between monitor modes

In reply to Reinette Chatre

Hi Reinette,

Quoted 9 lines · Reinette Chatre

Hi Babu,

Quoted 6 lines · Babu Moger

Resctrl subsystem can support two monitoring modes, "mbm_event" or "default". In mbm_event mode, monitoring event can only accumulate data while it is backed by a hardware counter. In "default" mode, resctrl assumes there is a hardware counter for each event within every CTRL_MON and MON group.

Quoted 4 lines
Quoted 1 line

Introduce interface to switch between mbm_event and default modes.

"Introduce interface" -> "Introduce mbm_assign_mode resctrl file"

Sure.

Quoted 36 lines
Quoted 20 lines

Example:
To list the MBM monitor modes supported:

$ cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
[mbm_event]
default

To enable the "mbm_event" monitoring mode:

$ echo "mbm_event" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode

To enable the "default" monitoring mode:

$ echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode

MBM event counters are automatically reset as part of changing the mode. Clear both architectural and non-architectural event states to prevent overflow conditions during the next event read. Also clear assignable counter configuration on all the domains.

---

...

Quoted 13 lines
---
 Documentation/filesystems/resctrl.rst | 23 +++++++-
 fs/resctrl/internal.h                 |  2 +
 fs/resctrl/monitor.c                  | 27 ++++++++++
 fs/resctrl/rdtgroup.c                 | 78 +++++++++++++++++++++++++--
 4 files changed, 126 insertions(+), 4 deletions(-)
Documentation/filesystems/resctrl.rst +0 -0
index cd82c2966ed7..7e62c7fdcefa 100644
@@ -259,7 +259,9 @@ with the following files:
 
Quoted 7 lines

Documentation/filesystems/resctrl.rst with the following files: · line 262

Quoted 4 lines
Documentation/filesystems/resctrl.rst +1 -1
 "mbm_assign_mode":
 	The supported monitoring modes. The enclosed brackets indicate which mode
-	is enabled.
+	is enabled. The MBM events (mbm_total_bytes and/or mbm_local_bytes) associated

Since there may be more events in future I think the "(mbm_total_bytes and/or mbm_local_bytes)" can be dropped.

Sure.

Quoted 5 lines
Quoted 5 lines
Documentation/filesystems/resctrl.rst +2 -0
+	with counters may reset when "mbm_assign_mode" is changed.
+
 	::
 
Quoted 8 lines

Documentation/filesystems/resctrl.rst with the following files: · line 284

Quoted 6 lines
Documentation/filesystems/resctrl.rst +1 -0
 	  # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
@@ -279,6 +281,15 @@ with the following files:
 	of counters available is described in the "num_mbm_cntrs" file. Changing the
 	mode may cause all counters on the resource to reset.
 
+	Moving to mbm_event mode require users to assign the counters to the events.

"Moving to mbm_event mode require" -> "mbm_event counter assignment mode requires"

Sure.

Quoted 62 lines
Quoted 62 lines
Documentation/filesystems/resctrl.rst +18 -0
+	Otherwise, the MBM event counters will return 'Unassigned' when read.
+
+	The mode is beneficial for AMD platforms that support more CTRL_MON
+	and MON groups than available hardware counters. By default, this
+	feature is enabled on AMD platforms with the ABMC (Assignable Bandwidth
+	Monitoring Counters) capability, ensuring counters remain assigned even
+	when the corresponding RMID is not actively used by any processor.
+
 	"default":
 
 	In default mode, resctrl assumes there is a hardware counter for each
@@ -288,6 +299,16 @@ with the following files:
 	result in misleading values or display "Unavailable" if no counter is assigned
 	to the event.
 
+	* To enable "mbm_event" monitoring mode:
+	  ::
+
+	    # echo "mbm_event" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
+
+	* To enable "default" monitoring mode:
+	  ::
+
+	    # echo "default" > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
+
 "num_mbm_cntrs":
 	The maximum number of counter IDs (total of available and assigned counters)
 	in each domain when the system supports mbm_event mode.
fs/resctrl/internal.h +2 -0
index 14d99c723ea5..adc9ff3efdfd 100644
@@ -414,6 +414,8 @@ void resctrl_unassign_cntr_event(struct rdt_resource *r, struct rdt_mon_domain *
 				 struct rdtgroup *rdtgrp, struct mon_evt *mevt);
 int mbm_cntr_get(struct rdt_resource *r, struct rdt_mon_domain *d,
 		 struct rdtgroup *rdtgrp, enum resctrl_event_id evtid);
+void resctrl_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d);
+void mbm_cntr_free_all(struct rdt_resource *r, struct rdt_mon_domain *d);
 
 #ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK
 int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);
fs/resctrl/monitor.c +12 -0
index 618c94cd1ad8..504b869570e6 100644
@@ -1045,6 +1045,33 @@ static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id)
 	memset(&d->cntr_cfg[cntr_id], 0, sizeof(struct mbm_cntr_cfg));
 }
 
+/**
+ * mbm_cntr_free_all() - Clear all the counter ID configuration details in the
+ *			 domain @d. Called when mbm_assign_mode is changed.
+ */
+void mbm_cntr_free_all(struct rdt_resource *r, struct rdt_mon_domain *d)
+{
+	memset(d->cntr_cfg, 0, sizeof(*d->cntr_cfg) * r->mon.num_mbm_cntrs);
+}
+
+/**
+ * resctrl_reset_rmid_all() - Reset all non-architecture states for all the
+ *			      supported RMIDs.
Quoted 8 lines

fs/resctrl/monitor.c static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id) · line 1061

Quoted 2 lines
fs/resctrl/monitor.c +2 -0
+ */
+void resctrl_reset_rmid_all(struct rdt_resource *r, struct rdt_mon_domain *d)

struct rdt_resource *r is unused? At this time it seems unnecessary to check if an MBM event belongs to particular resource since at this point I expect only L3 is possible. Even so, to be consistent and robust I think it would make flows easier to understand by always ensureing that mon_evt::rid matches expected resource.

Agree. But in this we dont access mon_evt structure here.

Quoted 14 lines

fs/resctrl/monitor.c static void mbm_cntr_free(struct rdt_mon_domain *d, int cntr_id) · line 1071

Quoted 11 lines
fs/resctrl/monitor.c +10 -0
+{
+	u32 idx_limit = resctrl_arch_system_num_rmid_idx();
+	enum resctrl_event_id evt;
+	int idx;
+
+	for_each_mbm_event_id(evt) {
+		if (!resctrl_is_mon_event_enabled(evt))
+			continue;
+		idx = MBM_STATE_IDX(evt);
+		memset(d->mbm_states[idx], 0, sizeof(struct mbm_state) * idx_limit);

sizeof(*d->mbm_states[0])?

Sure.

Quoted 36 lines
Quoted 36 lines
fs/resctrl/monitor.c +3 -0
+	}
+}
+
 /**
  * resctrl_alloc_config_cntr() - Allocate a counter ID and configure it for the
  * event pointed to by @mevt and the resctrl group @rdtgrp within the domain @d.
fs/resctrl/rdtgroup.c +22 -0
index 8c67e0897f25..6bb61fcf8673 100644
@@ -1876,6 +1876,77 @@ static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of,
 	return 0;
 }
 
+static ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of,
+					     char *buf, size_t nbytes, loff_t off)
+{
+	struct rdt_resource *r = rdt_kn_parent_priv(of->kn);
+	struct rdt_mon_domain *d;
+	int ret = 0;
+	bool enable;
+
+	/* Valid input requires a trailing newline */
+	if (nbytes == 0 || buf[nbytes - 1] != '\n')
+		return -EINVAL;
+
+	buf[nbytes - 1] = '\0';
+
+	cpus_read_lock();
+	mutex_lock(&rdtgroup_mutex);
+
+	rdt_last_cmd_clear();
+
+	if (!strcmp(buf, "default")) {
+		enable = 0;
+	} else if (!strcmp(buf, "mbm_event")) {
Quoted 9 lines

fs/resctrl/rdtgroup.c static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of, · line 1906

Quoted 6 lines
fs/resctrl/rdtgroup.c +6 -0
+		if (r->mon.mbm_cntr_assignable) {
+			enable = 1;
+		} else {
+			ret = -EINVAL;
+			rdt_last_cmd_puts("mbm_event mode is not supported\n");
+			goto write_exit;

write_exit -> out_unlock

Sure.

Quoted 61 lines
Quoted 17 lines
fs/resctrl/rdtgroup.c +17 -0
+		}
+	} else {
+		ret = -EINVAL;
+		rdt_last_cmd_puts("Unsupported assign mode\n");
+		goto write_exit;
+	}
+
+	if (enable != resctrl_arch_mbm_cntr_assign_enabled(r)) {
+		ret = resctrl_arch_mbm_cntr_assign_set(r, enable);
+		if (ret)
+			goto write_exit;
+
+		/* Update the visibility of BMEC related files */
+		resctrl_bmec_files_show(r, !enable);
+
+		/*
+		 * Initialize the default memory transaction values for

fs/resctrl/rdtgroup.c static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of, · line 1933

Quoted 10 lines
fs/resctrl/rdtgroup.c +10 -0
+		 * total and local events.
+		 */
+		if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
+			resctrl_set_mon_evt_cfg(QOS_L3_MBM_TOTAL_EVENT_ID,
+						MAX_EVT_CONFIG_BITS);
+		if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID))
+			resctrl_set_mon_evt_cfg(QOS_L3_MBM_LOCAL_EVENT_ID,
+						READS_TO_LOCAL_MEM |
+						READS_TO_LOCAL_S_MEM |
+						NON_TEMP_WRITE_TO_LOCAL_MEM);

Nice, yes, this belongs in resctrl fs.

Quoted 31 lines
fs/resctrl/rdtgroup.c +17 -1
+		/*
+		 * Reset all the non-achitectural RMID state and assignable counters.
+		 */
+		list_for_each_entry(d, &r->mon_domains, hdr.list) {
+			mbm_cntr_free_all(r, d);
+			resctrl_reset_rmid_all(r, d);
+		}
+	}
+
+write_exit:
+	mutex_unlock(&rdtgroup_mutex);
+	cpus_read_unlock();
+
+	return ret ?: nbytes;
+}
+
 static int resctrl_num_mbm_cntrs_show(struct kernfs_open_file *of,
 				      struct seq_file *s, void *v)
 {
@@ -2203,8 +2274,8 @@ static int resctrl_process_assign(struct rdt_resource *r, struct rdtgroup *rdtgr
 	struct mon_evt *mevt;
 	int assign_state;
 	char domain[10];
+	int ret = 0;
 	bool found;
-	int ret;
 
 	mevt = mbm_get_mon_event_by_name(r, event);
 	if (!mevt) {
@@ -2249,7 +2320,7 @@ static int resctrl_process_assign(struct rdt_resource *r, struct rdtgroup *rdtgr
 
Quoted 10 lines

fs/resctrl/rdtgroup.c static int resctrl_process_assign(struct rdt_resource *r, struct rdtgroup *rdtgr · line 2326

Quoted 7 lines
fs/resctrl/rdtgroup.c +1 -1
 	switch (assign_state) {
 	case ASSIGN_NONE:
-		ret = resctrl_unassign_cntr_event(r, d, rdtgrp, mevt);
+		resctrl_unassign_cntr_event(r, d, rdtgrp, mevt);
 		break;
 	case ASSIGN_EXCLUSIVE:
 		ret = resctrl_assign_cntr_event(r, d, rdtgrp, mevt);

Two stray hunks?

Yes. Fixed it.

Quoted 15 lines

fs/resctrl/rdtgroup.c static struct rftype res_common_files[] = { · line 2543

Quoted 12 lines
fs/resctrl/rdtgroup.c +2 -1
@@ -2463,9 +2534,10 @@ static struct rftype res_common_files[] = {
 	},
 	{
 		.name		= "mbm_assign_mode",
-		.mode		= 0444,
+		.mode		= 0644,
 		.kf_ops		= &rdtgroup_kf_single_ops,
 		.seq_show	= resctrl_mbm_assign_mode_show,
+		.write		= resctrl_mbm_assign_mode_write,
 		.fflags		= RFTYPE_MON_INFO | RFTYPE_RES_CACHE,
 	},
 	{

Reinette

Signature · 2 lines
Thanks
Babu Moger
author reviewer
#114 lore raw

Re: [PATCH v14 32/32] x86/resctrl: Configure mbm_event mode if supported

In reply to Reinette Chatre

Hi Reinette,

Quoted 4 lines · Reinette Chatre

Hi Babu,

On 6/13/25 2:05 PM, Babu Moger wrote:

Quoted 8 lines

arch/x86/kernel/cpu/resctrl/core.c static void domain_add_cpu_mon(int cpu, struct rdt_resource *r) · line 543

Quoted 5 lines
arch/x86/kernel/cpu/resctrl/core.c +1 -0
@@ -537,6 +540,10 @@ static void domain_add_cpu_mon(int cpu, struct rdt_resource *r)
 	d->ci_id = ci->id;
 	cpumask_set_cpu(cpu, &d->hdr.cpu_mask);
 
+	/* Update the mbm_mbm_assign state for the CPU if supported */

"mbm_mbm_assign" -> "mbm_assign_mode"?

Sure.

Signature · 2 lines
Thanks
Babu Moger
author reviewer
#103 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

In reply to Reinette Chatre

Hi Reinette,

Quoted 18 lines · Reinette Chatre

Hi Babu,

Quoted 15 lines · Babu
Quoted 7 lines · Reinette Chatre

Hi Babu,

Quoted 2 lines · Babu Moger

BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not work simultaneously.

Could you please elaborate why they do not work simultaneously?

Changed the changelog.

When mbm_event counter assignment mode is enabled, events are configured through the "event_filter" files under /sys/fs/resctrl/info/L3_MON/event_configs/.

Quoted 8 lines
Quoted 4 lines

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

A reasonable question here may be why not just keep using the existing (BMEC supporting) event configuration files for event configuration? Why are new event configuration files needed?

New interface that enables users to read and write memory transaction events using human-readable strings, simplifying configuration and improving usability.

In future it can be extended to create free form event names.

Quoted 8 lines
Quoted 5 lines

To avoid the confusion, hide BMEC-related files when mbm_event counter assignment mode is enabled and update the mon_features display accordingly.

Reinette

Signature · 2 lines
Thanks
Babu Moger
maintainer
#104 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

Hi Babu,

Quoted 26 lines · Babu

Hi Reinette,

Quoted 23 lines · Reinette Chatre

Hi Babu,

Quoted 19 lines · Babu
Quoted 7 lines · Reinette Chatre

Hi Babu,

Quoted 2 lines · Babu Moger

BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not work simultaneously.

Could you please elaborate why they do not work simultaneously?

Changed the changelog.

When mbm_event counter assignment mode is enabled, events are configured through the "event_filter" files under /sys/fs/resctrl/info/L3_MON/event_configs/.

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines
Quoted 3 lines

A reasonable question here may be why not just keep using the existing (BMEC supporting) event configuration files for event configuration? Why are new event configuration files needed?

New interface that enables users to read and write memory transaction events using human-readable strings, simplifying configuration and improving usability.

I find the "simplifying configuration and improving usability" a bit vague for a changelog. The cover letter already claims that ABMC and BMEC are incompatible and links to some email discussions. I think it will be helpful to summarize here why ABMC and BMEC are considered incompatible and then use that as motivation to hide BMEC. The motivation in this changelog is to "avoid confusion" but the motivation is stronger than that.

Quoted 7 lines

In future it can be extended to create free form event names.

Quoted 4 lines
Quoted 4 lines

To avoid the confusion, hide BMEC-related files when mbm_event counter assignment mode is enabled and update the mon_features display accordingly.

Reinette

author reviewer
#105 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

Hi Reinette,

Quoted 37 lines · Reinette Chatre

Hi Babu,

Quoted 26 lines · Babu

Hi Reinette,

Quoted 23 lines · Reinette Chatre

Hi Babu,

Quoted 19 lines · Babu
Quoted 7 lines · Reinette Chatre

Hi Babu,

Quoted 2 lines · Babu Moger

BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not work simultaneously.

Could you please elaborate why they do not work simultaneously?

Changed the changelog.

When mbm_event counter assignment mode is enabled, events are configured through the "event_filter" files under /sys/fs/resctrl/info/L3_MON/event_configs/.

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines
Quoted 3 lines

A reasonable question here may be why not just keep using the existing (BMEC supporting) event configuration files for event configuration? Why are new event configuration files needed?

New interface that enables users to read and write memory transaction events using human-readable strings, simplifying configuration and improving usability.

Quoted 7 lines

I find the "simplifying configuration and improving usability" a bit vague for a changelog. The cover letter already claims that ABMC and BMEC are incompatible and links to some email discussions. I think it will be helpful to summarize here why ABMC and BMEC are considered incompatible and then use that as motivation to hide BMEC. The motivation in this changelog is to "avoid confusion" but the motivation is stronger than that.

Changed the changelog. How does this look?

"The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under /sys/fs/resctrl/info/L3_MON/event_configs/. This mode allows users to read and write memory transaction events using human-readable strings, making the interface easier to use and more intuitive. Going forward, this mechanism can support assigning multiple counters to RMID, event pairs and may be extended to allow flexible, user-defined event names.

Given these changes, hide the BMEC-related files when the mbm_event counter assignment mode is enabled. Also, update the mon_features display accordingly."

Signature · 2 lines
Thanks
Babu Moger
#106 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

Hi Reinette,

Quoted 64 lines · Babu

Hi Reinette,

Quoted 37 lines · Reinette Chatre

Hi Babu,

Quoted 26 lines · Babu

Hi Reinette,

Quoted 23 lines · Reinette Chatre

Hi Babu,

Quoted 19 lines · Babu
Quoted 7 lines · Reinette Chatre

Hi Babu,

Quoted 2 lines · Babu Moger

BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not work simultaneously.

Could you please elaborate why they do not work simultaneously?

Changed the changelog.

When mbm_event counter assignment mode is enabled, events are configured through the "event_filter" files under /sys/fs/resctrl/info/L3_MON/event_configs/.

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines
Quoted 3 lines

A reasonable question here may be why not just keep using the existing (BMEC supporting) event configuration files for event configuration? Why are new event configuration files needed?

New interface that enables users to read and write memory transaction events using human-readable strings, simplifying configuration and improving usability.

Quoted 7 lines

I find the "simplifying configuration and improving usability" a bit vague for a changelog. The cover letter already claims that ABMC and BMEC are incompatible and links to some email discussions. I think it will be helpful to summarize here why ABMC and BMEC are considered incompatible and then use that as motivation to hide BMEC. The motivation in this changelog is to "avoid confusion" but the motivation is stronger than that.

Changed the changelog. How does this look?

"The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under /sys/fs/resctrl/info/L3_MON/event_configs/. This mode allows users to read and write memory transaction events using human-readable strings, making the interface easier to use and more intuitive. Going forward, this mechanism can support assigning multiple counters to RMID, event pairs and may be extended to allow flexible, user-defined event names.

Quoted 4 lines

Given these changes, hide the BMEC-related files when the mbm_event counter assignment mode is enabled. Also, update the mon_features display accordingly."

Here is another update.

fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under
/sys/fs/resctrl/info/L3_MON/event_configs/. This mode enables users to
configure memory transaction events using human-readable strings, providing a more intuitive and user-friendly interface. In the future, this mechanism could be extended to support assigning multiple counters to RMID-event pairs, as well as customizable, user-defined event names. Also, the presence of BMEC-related configuration files may cause confusion when the mbm_event counter assignment mode is enabled.

To address this, these files are now hidden when the mode is active. Additionally, the mon_features display has been updated to reflect this change.

maintainer
#107 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

Hi Babu,

Quoted 68 lines · Babu
Quoted 53 lines · Babu
Quoted 29 lines · Reinette Chatre
Quoted 20 lines · Babu
Quoted 19 lines · Reinette Chatre
Quoted 17 lines · Babu
Quoted 5 lines · Reinette Chatre
Quoted 2 lines · Babu Moger

BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not work simultaneously.

Could you please elaborate why they do not work simultaneously?

Changed the changelog.

When mbm_event counter assignment mode is enabled, events are configured through the "event_filter" files under /sys/fs/resctrl/info/L3_MON/event_configs/.

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines
Quoted 3 lines

A reasonable question here may be why not just keep using the existing (BMEC supporting) event configuration files for event configuration? Why are new event configuration files needed?

New interface that enables users to read and write memory transaction events using human-readable strings, simplifying configuration and improving usability.

Quoted 7 lines

I find the "simplifying configuration and improving usability" a bit vague for a changelog. The cover letter already claims that ABMC and BMEC are incompatible and links to some email discussions. I think it will be helpful to summarize here why ABMC and BMEC are considered incompatible and then use that as motivation to hide BMEC. The motivation in this changelog is to "avoid confusion" but the motivation is stronger than that.

Changed the changelog. How does this look?

"The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under /sys/fs/resctrl/info/L3_MON/event_configs/. This mode allows users to read and write memory transaction events using human-readable strings, making the interface easier to use and more intuitive. Going forward, this mechanism can support assigning multiple counters to RMID, event pairs and may be extended to allow flexible, user-defined event names.

Quoted 4 lines

Given these changes, hide the BMEC-related files when the mbm_event counter assignment mode is enabled. Also, update the mon_features display accordingly."

Here is another update.

fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under
/sys/fs/resctrl/info/L3_MON/event_configs/. This mode enables users to
configure memory transaction events using human-readable strings, providing a more intuitive and user-friendly interface. In the future, this mechanism could be extended to support assigning multiple counters to RMID-event pairs, as well as customizable, user-defined event names. Also, the presence of BMEC-related configuration files may cause confusion when the mbm_event counter assignment mode is enabled.

To address this, these files are now hidden when the mode is active. Additionally, the mon_features display has been updated to reflect this change.

I do not find a concrete motivation in this changelog. The terms "may cause confusion" and "providing a more intuitive and user-friendly interface." are vague and not something that I think provides a good motivation for disabling an entire interface.

I aim to write a draft below that I hope will help make this changelog more convincing. Please do improve it:

fs/resctrl: Disable BMEC event configuration when mbm_event mode is enabled

The BMEC (Bandwidth Monitoring Event Configuration) feature enables per-domain event configuration. With BMEC the MBM events are configured using the mbm_total_bytes_config or mbm_local_bytes_config files in /sys/fs/resctrl/info/L3_MON/ and the per-domain event configuration affects all monitor resource groups.

The mbm_event counter assignment mode enables counters to be assigned to RMID (i.e a monitor resource group), event pairs, with potentially unique
event configurations associated with every counter.

There may be systems that support both BMEC and mbm_event counter assignment mode, but resctrl supporting both concurrently will present a conflicting interface to the user with both per-domain and per RMID, event configurations active at the same time.

mbm_event counter assignment provides most flexibility to user space and aligns with Arm's counter support. On systems that support both, disable BMEC event configuration when mbm_event mode is enabled by hiding the the mbm_total_bytes_config or mbm_local_bytes_config files when mbm_event mode is enabled. Ensure mon_features always displays accurate information about monitor features.

Reinette

author reviewer
#108 lore raw

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

Hi Reinette,

Quoted 74 lines · Reinette Chatre

Hi Babu,

Quoted 37 lines · Babu
Quoted 22 lines · Babu
Quoted 5 lines · Reinette Chatre
Quoted 4 lines · Babu
Quoted 3 lines · Reinette Chatre
Quoted 2 lines · Babu
Quoted 1 line · Reinette Chatre

On 6/13/25 2:05 PM, Babu Moger wrote:

Changed the changelog. How does this look?

"The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under /sys/fs/resctrl/info/L3_MON/event_configs/. This mode allows users to read and write memory transaction events using human-readable strings, making the interface easier to use and more intuitive. Going forward, this mechanism can support assigning multiple counters to RMID, event pairs and may be extended to allow flexible, user-defined event names.

Quoted 4 lines

Given these changes, hide the BMEC-related files when the mbm_event counter assignment mode is enabled. Also, update the mon_features display accordingly."

Here is another update.

fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled

The default monitoring mode and with BMEC (Bandwidth Monitoring Event Configuration) support, events are configured using the files mbm_total_bytes_config or mbm_local_bytes_config in /sys/fs/resctrl/info/L3_MON/.

Quoted 7 lines

When the mbm_event counter assignment mode is enabled, event configuration is handled via the event_filter files under
/sys/fs/resctrl/info/L3_MON/event_configs/. This mode enables users to
configure memory transaction events using human-readable strings, providing a more intuitive and user-friendly interface. In the future, this mechanism could be extended to support assigning multiple counters to RMID-event pairs, as well as customizable, user-defined event names. Also, the presence of BMEC-related configuration files may cause confusion when the mbm_event counter assignment mode is enabled.

To address this, these files are now hidden when the mode is active. Additionally, the mon_features display has been updated to reflect this change.

I do not find a concrete motivation in this changelog. The terms "may cause confusion" and "providing a more intuitive and user-friendly interface." are vague and not something that I think provides a good motivation for disabling an entire interface.

I aim to write a draft below that I hope will help make this changelog more convincing. Please do improve it:

fs/resctrl: Disable BMEC event configuration when mbm_event mode is enabled

The BMEC (Bandwidth Monitoring Event Configuration) feature enables per-domain event configuration. With BMEC the MBM events are configured using the mbm_total_bytes_config or mbm_local_bytes_config files in /sys/fs/resctrl/info/L3_MON/ and the per-domain event configuration affects all monitor resource groups.

The mbm_event counter assignment mode enables counters to be assigned to RMID (i.e a monitor resource group), event pairs, with potentially unique
event configurations associated with every counter.

There may be systems that support both BMEC and mbm_event counter assignment mode, but resctrl supporting both concurrently will present a conflicting interface to the user with both per-domain and per RMID, event configurations active at the same time.

Quoted 7 lines

mbm_event counter assignment provides most flexibility to user space and aligns with Arm's counter support. On systems that support both, disable BMEC event configuration when mbm_event mode is enabled by hiding the the mbm_total_bytes_config or mbm_local_bytes_config files when mbm_event mode is enabled. Ensure mon_features always displays accurate information about monitor features.

Looks good.

Signature · 2 lines
Thanks
Babu Moger