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

Babu Moger posted 32 patches 3 months, 4 weeks ago
There is a newer version of this series
[PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Babu Moger 3 months, 4 weeks ago
BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not
work simultaneously.

When mbm_event mode is enabled, hide BMEC-related files to avoid confusion
and update the mon_features display accordingly.

The files /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config and
/sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config will not be visible
when mbm_event mode is enabled.

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v14: Updated the changelog for change in mbm_assign_modes.
     Added check in rdt_mon_features_show to hide bmec related feature.

v13: New patch to hide BMEC related files.
---
 fs/resctrl/rdtgroup.c | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 92bb8f3adfae..8c67e0897f25 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1164,7 +1164,8 @@ static int rdt_mon_features_show(struct kernfs_open_file *of,
 		if (mevt->rid != r->rid || !mevt->enabled)
 			continue;
 		seq_printf(seq, "%s\n", mevt->name);
-		if (mevt->configurable)
+		if (mevt->configurable &&
+		    !resctrl_arch_mbm_cntr_assign_enabled(r))
 			seq_printf(seq, "%s_config\n", mevt->name);
 	}
 
@@ -1813,6 +1814,38 @@ static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of,
 	return ret ?: nbytes;
 }
 
+/**
+ * resctrl_bmec_files_show() — Controls the visibility of BMEC-related resctrl
+ * files. When @show is true, the files are displayed; when false, the files
+ * are hidden.
+ */
+static void resctrl_bmec_files_show(struct rdt_resource *r, bool show)
+{
+	struct kernfs_node *kn_config, *l3_mon_kn;
+	char name[32];
+
+	sprintf(name, "%s_MON", r->name);
+	l3_mon_kn = kernfs_find_and_get(kn_info, name);
+	if (!l3_mon_kn)
+		return;
+
+	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_total_bytes_config");
+	if (kn_config) {
+		kernfs_get(kn_config);
+		kernfs_show(kn_config, show);
+		kernfs_put(kn_config);
+	}
+
+	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_local_bytes_config");
+	if (kn_config) {
+		kernfs_get(kn_config);
+		kernfs_show(kn_config, show);
+		kernfs_put(kn_config);
+	}
+
+	kernfs_put(l3_mon_kn);
+}
+
 static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of,
 					struct seq_file *s, void *v)
 {
@@ -2808,6 +2841,13 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
 			ret = resctrl_mkdir_counter_configs(r, name);
 			if (ret)
 				goto out_destroy;
+
+			/*
+			 * Hide BMEC related files if mbm_event mode
+			 * is enabled.
+			 */
+			if (resctrl_arch_mbm_cntr_assign_enabled(r))
+				resctrl_bmec_files_show(r, false);
 		}
 	}
 
-- 
2.34.1

Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Reinette Chatre 3 months, 2 weeks ago
Hi Babu,

On 6/13/25 2:05 PM, Babu Moger wrote:
> BMEC (Bandwidth Monitoring Event Configuration) and mbm_event mode do not
> work simultaneously.

Could you please elaborate why they do not work simultaneously?

> 
> When mbm_event mode is enabled, hide BMEC-related files to avoid confusion
> and update the mon_features display accordingly.
> 
> The files /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config and
> /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config will not be visible
> when mbm_event mode is enabled.
> 
> Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v14: Updated the changelog for change in mbm_assign_modes.
>      Added check in rdt_mon_features_show to hide bmec related feature.
> 
> v13: New patch to hide BMEC related files.
> ---
>  fs/resctrl/rdtgroup.c | 42 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 92bb8f3adfae..8c67e0897f25 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -1164,7 +1164,8 @@ static int rdt_mon_features_show(struct kernfs_open_file *of,
>  		if (mevt->rid != r->rid || !mevt->enabled)
>  			continue;
>  		seq_printf(seq, "%s\n", mevt->name);
> -		if (mevt->configurable)
> +		if (mevt->configurable &&
> +		    !resctrl_arch_mbm_cntr_assign_enabled(r))
>  			seq_printf(seq, "%s_config\n", mevt->name);
>  	}
>  
> @@ -1813,6 +1814,38 @@ static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of,
>  	return ret ?: nbytes;
>  }
>  
> +/**
> + * resctrl_bmec_files_show() — Controls the visibility of BMEC-related resctrl
> + * files. When @show is true, the files are displayed; when false, the files
> + * are hidden.
> + */
> +static void resctrl_bmec_files_show(struct rdt_resource *r, bool show)
> +{
> +	struct kernfs_node *kn_config, *l3_mon_kn;
> +	char name[32];
> +
> +	sprintf(name, "%s_MON", r->name);
> +	l3_mon_kn = kernfs_find_and_get(kn_info, name);

Similar to comment about resctrl_mkdir_counter_configs() (resctrl_mkdir_event_configs())
I think this can be avoided by calling resctrl_bmec_files_show() from 
rdtgroup_mkdir_info_resdir().

> +	if (!l3_mon_kn)
> +		return;
> +
> +	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_total_bytes_config");
> +	if (kn_config) {
> +		kernfs_get(kn_config);

Be careful ... kernfs_find_and_get() already took a reference. Additional
kernfs_get() is not needed.

> +		kernfs_show(kn_config, show);
> +		kernfs_put(kn_config);
> +	}
> +
> +	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_local_bytes_config");
> +	if (kn_config) {
> +		kernfs_get(kn_config);
> +		kernfs_show(kn_config, show);
> +		kernfs_put(kn_config);
> +	}
> +
> +	kernfs_put(l3_mon_kn);
> +}
> +
>  static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of,
>  					struct seq_file *s, void *v)
>  {
> @@ -2808,6 +2841,13 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
>  			ret = resctrl_mkdir_counter_configs(r, name);
>  			if (ret)
>  				goto out_destroy;
> +
> +			/*
> +			 * Hide BMEC related files if mbm_event mode
> +			 * is enabled.
> +			 */
> +			if (resctrl_arch_mbm_cntr_assign_enabled(r))
> +				resctrl_bmec_files_show(r, false);
>  		}
>  	}
>  

Reinette
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Moger, Babu 3 months, 1 week ago
Hi Reinette,


On 6/25/25 18:39, Reinette Chatre wrote:
> Hi Babu,
> 
> On 6/13/25 2:05 PM, Babu Moger wrote:
>> 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/.

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

> 
>>
>> When mbm_event mode is enabled, hide BMEC-related files to avoid confusion
>> and update the mon_features display accordingly.
>>
>> The files /sys/fs/resctrl/info/L3_MON/mbm_total_bytes_config and
>> /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config will not be visible
>> when mbm_event mode is enabled.
>>
>> Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>> v14: Updated the changelog for change in mbm_assign_modes.
>>      Added check in rdt_mon_features_show to hide bmec related feature.
>>
>> v13: New patch to hide BMEC related files.
>> ---
>>  fs/resctrl/rdtgroup.c | 42 +++++++++++++++++++++++++++++++++++++++++-
>>  1 file changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index 92bb8f3adfae..8c67e0897f25 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
>> @@ -1164,7 +1164,8 @@ static int rdt_mon_features_show(struct kernfs_open_file *of,
>>  		if (mevt->rid != r->rid || !mevt->enabled)
>>  			continue;
>>  		seq_printf(seq, "%s\n", mevt->name);
>> -		if (mevt->configurable)
>> +		if (mevt->configurable &&
>> +		    !resctrl_arch_mbm_cntr_assign_enabled(r))
>>  			seq_printf(seq, "%s_config\n", mevt->name);
>>  	}
>>  
>> @@ -1813,6 +1814,38 @@ static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of,
>>  	return ret ?: nbytes;
>>  }
>>  
>> +/**
>> + * resctrl_bmec_files_show() — Controls the visibility of BMEC-related resctrl
>> + * files. When @show is true, the files are displayed; when false, the files
>> + * are hidden.
>> + */
>> +static void resctrl_bmec_files_show(struct rdt_resource *r, bool show)
>> +{
>> +	struct kernfs_node *kn_config, *l3_mon_kn;
>> +	char name[32];
>> +
>> +	sprintf(name, "%s_MON", r->name);
>> +	l3_mon_kn = kernfs_find_and_get(kn_info, name);
> 
> Similar to comment about resctrl_mkdir_counter_configs() (resctrl_mkdir_event_configs())
> I think this can be avoided by calling resctrl_bmec_files_show() from 
> rdtgroup_mkdir_info_resdir().

Sure.

> 
>> +	if (!l3_mon_kn)
>> +		return;
>> +
>> +	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_total_bytes_config");
>> +	if (kn_config) {
>> +		kernfs_get(kn_config);
> 
> Be careful ... kernfs_find_and_get() already took a reference. Additional
> kernfs_get() is not needed.

Sure.

> 
>> +		kernfs_show(kn_config, show);
>> +		kernfs_put(kn_config);
>> +	}
>> +
>> +	kn_config = kernfs_find_and_get(l3_mon_kn, "mbm_local_bytes_config");
>> +	if (kn_config) {
>> +		kernfs_get(kn_config);
>> +		kernfs_show(kn_config, show);
>> +		kernfs_put(kn_config);
>> +	}
>> +
>> +	kernfs_put(l3_mon_kn);
>> +}
>> +
>>  static int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of,
>>  					struct seq_file *s, void *v)
>>  {
>> @@ -2808,6 +2841,13 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
>>  			ret = resctrl_mkdir_counter_configs(r, name);
>>  			if (ret)
>>  				goto out_destroy;
>> +
>> +			/*
>> +			 * Hide BMEC related files if mbm_event mode
>> +			 * is enabled.
>> +			 */
>> +			if (resctrl_arch_mbm_cntr_assign_enabled(r))
>> +				resctrl_bmec_files_show(r, false);
>>  		}
>>  	}
>>  
> 
> Reinette
> 

-- 
Thanks
Babu Moger
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Reinette Chatre 3 months, 1 week ago
Hi Babu,

On 7/2/25 9:42 AM, Moger, Babu wrote:
> On 6/25/25 18:39, Reinette Chatre wrote:
>> Hi Babu,
>>
>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>> 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/.

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?

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

Reinette
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Moger, Babu 3 months, 1 week ago
Hi Reinette,

On 7/2/25 12:21, Reinette Chatre wrote:
> Hi Babu,
> 
> On 7/2/25 9:42 AM, Moger, Babu wrote:
>> On 6/25/25 18:39, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>>> 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/.
> 
> 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.

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

-- 
Thanks
Babu Moger
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Reinette Chatre 3 months, 1 week ago
Hi Babu,

On 7/2/25 12:04 PM, Moger, Babu wrote:
> Hi Reinette,
> 
> On 7/2/25 12:21, Reinette Chatre wrote:
>> Hi Babu,
>>
>> On 7/2/25 9:42 AM, Moger, Babu wrote:
>>> On 6/25/25 18:39, Reinette Chatre wrote:
>>>> Hi Babu,
>>>>
>>>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>>>> 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/.
>>
>> 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.

> 
> In future it can be extended to create free form event names.
> 
>>
>>>
>>> To avoid the confusion, hide BMEC-related files when mbm_event counter
>>> assignment mode is enabled and update the mon_features display accordingly.

Reinette
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Moger, Babu 3 months ago
Hi Reinette,


On 7/3/25 11:21, Reinette Chatre wrote:
> Hi Babu,
> 
> On 7/2/25 12:04 PM, Moger, Babu wrote:
>> Hi Reinette,
>>
>> On 7/2/25 12:21, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 7/2/25 9:42 AM, Moger, Babu wrote:
>>>> On 6/25/25 18:39, Reinette Chatre wrote:
>>>>> Hi Babu,
>>>>>
>>>>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>>>>> 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/.
>>>
>>> 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.
> 

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."

-- 
Thanks
Babu Moger
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Moger, Babu 3 months ago
Hi Reinette,

On 7/7/2025 5:35 PM, Moger, Babu wrote:
> Hi Reinette,
> 
> 
> On 7/3/25 11:21, Reinette Chatre wrote:
>> Hi Babu,
>>
>> On 7/2/25 12:04 PM, Moger, Babu wrote:
>>> Hi Reinette,
>>>
>>> On 7/2/25 12:21, Reinette Chatre wrote:
>>>> Hi Babu,
>>>>
>>>> On 7/2/25 9:42 AM, Moger, Babu wrote:
>>>>> On 6/25/25 18:39, Reinette Chatre wrote:
>>>>>> Hi Babu,
>>>>>>
>>>>>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>>>>>> 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/.
>>>>
>>>> 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.
>>
> 
> 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."
> 

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.
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Reinette Chatre 3 months ago
Hi Babu,

On 7/8/25 6:27 AM, Moger, Babu wrote:
> On 7/7/2025 5:35 PM, Moger, Babu wrote:
>> On 7/3/25 11:21, Reinette Chatre wrote:
>>> On 7/2/25 12:04 PM, Moger, Babu wrote:
>>>> On 7/2/25 12:21, Reinette Chatre wrote:
>>>>> On 7/2/25 9:42 AM, Moger, Babu wrote:
>>>>>> On 6/25/25 18:39, Reinette Chatre wrote:
>>>>>>> On 6/13/25 2:05 PM, Babu Moger wrote:
>>>>>>>> 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/.
>>>>>
>>>>> 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.
>>>
>>
>> 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."
>>
> 
> 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.

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
Re: [PATCH v14 30/32] fs/resctrl: Hide the BMEC related files when mbm_event mode is enabled
Posted by Moger, Babu 3 months ago
Hi Reinette,

On 7/8/25 10:21, Reinette Chatre wrote:
> Hi Babu,
> 
> On 7/8/25 6:27 AM, Moger, Babu wrote:
>> On 7/7/2025 5:35 PM, Moger, Babu wrote:
>>> On 7/3/25 11:21, Reinette Chatre wrote:
>>>> On 7/2/25 12:04 PM, Moger, Babu wrote:
>>>>> On 7/2/25 12:21, Reinette Chatre wrote:
>>>>>> On 7/2/25 9:42 AM, Moger, Babu wrote:
>>>>>>> On 6/25/25 18:39, Reinette Chatre wrote:
>>>>>>>> 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.
>>>
>>> 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.
> 
> 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.
> 	

Looks good.

-- 
Thanks
Babu Moger