[PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir

Babu Moger posted 34 patches 2 months, 1 week ago
There is a newer version of this series
[PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir
Posted by Babu Moger 2 months, 1 week ago
The "mbm_event" counter assignment mode allows users to assign a hardware
counter to an RMID, event pair and monitor the bandwidth as long as it is
assigned.

Introduce a user-configurable option that determines if a counter will
automatically be assigned to an RMID, event pair when its associated
monitor group is created via mkdir.

Suggested-by: Peter Newman <peternewman@google.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
v16: Fixed the return in resctrl_mbm_assign_on_mkdir_write().

v15: Fixed the static checker warning in resctrl_mbm_assign_on_mkdir_write() reported in
     https://lore.kernel.org/lkml/dd4a1021-b996-438e-941c-69dfcea5f22a@intel.com/

v14: Added rdtgroup_mutex in resctrl_mbm_assign_on_mkdir_show().
     Updated resctrl.rst for clarity.
     Fixed squashing of few previous changes.
     Added more code documentation.

v13: Added Suggested-by tag.
     Resolved conflicts caused by the recent FS/ARCH code restructure.
     The rdtgroup.c/monitor.c file has now been split between the FS and ARCH directories.

v12: New patch. Added after the discussion on the list.
     https://lore.kernel.org/lkml/CALPaoCh8siZKjL_3yvOYGL4cF_n_38KpUFgHVGbQ86nD+Q2_SA@mail.gmail.com/
---
 Documentation/filesystems/resctrl.rst | 16 ++++++++++
 fs/resctrl/monitor.c                  |  2 ++
 fs/resctrl/rdtgroup.c                 | 43 +++++++++++++++++++++++++++
 include/linux/resctrl.h               |  3 ++
 4 files changed, 64 insertions(+)

diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 37dbad4d50f7..165e0d315af7 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -354,6 +354,22 @@ with the following files:
 	  # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
 	   local_reads,local_non_temporal_writes
 
+"mbm_assign_on_mkdir":
+	Determines if a counter will automatically be assigned to an RMID, event pair
+	when its associated monitor group is created via mkdir. It is enabled by default
+	on boot and users can disable by writing to the interface.
+
+	"0":
+		Auto assignment is disabled.
+	"1":
+		Auto assignment is enabled.
+
+	Example::
+
+	  # echo 0 > /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
+	  # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
+	  0
+
 "max_threshold_occupancy":
 		Read/write file provides the largest value (in
 		bytes) at which a previously used LLC_occupancy
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 8efbeb910f77..6205bbfe08fb 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -1077,6 +1077,8 @@ int resctrl_mon_resource_init(void)
 		resctrl_file_fflags_init("available_mbm_cntrs",
 					 RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
 		resctrl_file_fflags_init("event_filter", RFTYPE_ASSIGN_CONFIG);
+		resctrl_file_fflags_init("mbm_assign_on_mkdir", RFTYPE_MON_INFO |
+					 RFTYPE_RES_CACHE);
 	}
 
 	return 0;
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index c3d6540c3280..bf04235d2603 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1895,6 +1895,42 @@ static int resctrl_available_mbm_cntrs_show(struct kernfs_open_file *of,
 	return ret;
 }
 
+static int resctrl_mbm_assign_on_mkdir_show(struct kernfs_open_file *of,
+					    struct seq_file *s, void *v)
+{
+	struct rdt_resource *r = rdt_kn_parent_priv(of->kn);
+
+	mutex_lock(&rdtgroup_mutex);
+	rdt_last_cmd_clear();
+
+	seq_printf(s, "%u\n", r->mon.mbm_assign_on_mkdir);
+
+	mutex_unlock(&rdtgroup_mutex);
+
+	return 0;
+}
+
+static ssize_t resctrl_mbm_assign_on_mkdir_write(struct kernfs_open_file *of,
+						 char *buf, size_t nbytes, loff_t off)
+{
+	struct rdt_resource *r = rdt_kn_parent_priv(of->kn);
+	bool value;
+	int ret;
+
+	ret = kstrtobool(buf, &value);
+	if (ret)
+		return ret;
+
+	mutex_lock(&rdtgroup_mutex);
+	rdt_last_cmd_clear();
+
+	r->mon.mbm_assign_on_mkdir = value;
+
+	mutex_unlock(&rdtgroup_mutex);
+
+	return nbytes;
+}
+
 /* rdtgroup information files for one cache resource. */
 static struct rftype res_common_files[] = {
 	{
@@ -1904,6 +1940,13 @@ static struct rftype res_common_files[] = {
 		.seq_show	= rdt_last_cmd_status_show,
 		.fflags		= RFTYPE_TOP_INFO,
 	},
+	{
+		.name		= "mbm_assign_on_mkdir",
+		.mode		= 0644,
+		.kf_ops		= &rdtgroup_kf_single_ops,
+		.seq_show	= resctrl_mbm_assign_on_mkdir_show,
+		.write		= resctrl_mbm_assign_on_mkdir_write,
+	},
 	{
 		.name		= "num_closids",
 		.mode		= 0444,
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 4d37827121a6..632b9ee5466a 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -277,12 +277,15 @@ enum resctrl_schema_fmt {
  *			monitoring events can be configured.
  * @num_mbm_cntrs:	Number of assignable counters.
  * @mbm_cntr_assignable:Is system capable of supporting counter assignment?
+ * @mbm_assign_on_mkdir:True if counters should automatically be assigned to MBM
+ *			events of monitor groups created via mkdir.
  */
 struct resctrl_mon {
 	int			num_rmid;
 	unsigned int		mbm_cfg_mask;
 	int			num_mbm_cntrs;
 	bool			mbm_cntr_assignable;
+	bool			mbm_assign_on_mkdir;
 };
 
 /**
-- 
2.34.1
Re: [PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir
Posted by Reinette Chatre 2 months, 1 week ago
Hi Babu,

On 7/25/25 11:29 AM, Babu Moger wrote:
> The "mbm_event" counter assignment mode allows users to assign a hardware
> counter to an RMID, event pair and monitor the bandwidth as long as it is
> assigned.

Above implies this addition is in support of "mbm_event" mode while the
implementation applies to any and all assignable counter modes, including
the "default" and for example the upcoming "soft-ABMC". It is clear to me
how this is used and interpreted when "mbm_event" mode is enabled, but not
for the others (more below).

> 
> Introduce a user-configurable option that determines if a counter will
> automatically be assigned to an RMID, event pair when its associated
> monitor group is created via mkdir.
> 
> Suggested-by: Peter Newman <peternewman@google.com>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---

...

> ---
>  Documentation/filesystems/resctrl.rst | 16 ++++++++++
>  fs/resctrl/monitor.c                  |  2 ++
>  fs/resctrl/rdtgroup.c                 | 43 +++++++++++++++++++++++++++
>  include/linux/resctrl.h               |  3 ++
>  4 files changed, 64 insertions(+)
> 
> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
> index 37dbad4d50f7..165e0d315af7 100644
> --- a/Documentation/filesystems/resctrl.rst
> +++ b/Documentation/filesystems/resctrl.rst
> @@ -354,6 +354,22 @@ with the following files:
>  	  # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
>  	   local_reads,local_non_temporal_writes
>  
> +"mbm_assign_on_mkdir":

Needs a "Exists when "mbm_event" counter assignment mode is supported."?
Also needs clarification on on behavior when "mbm_event" is enabled vs. disabled.

> +	Determines if a counter will automatically be assigned to an RMID, event pair

"will automatically be" -> "is automatically"
"RMID, event" -> "RMID, MBM event"

> +	when its associated monitor group is created via mkdir. It is enabled by default
> +	on boot and users can disable by writing to the interface.

"users can disable" -> "users can disable this capability" or "can be disabled"?

This implementation enables user to read/write this file/property when "mbm_event" mode is
disabled. Considering this explanation I do not think it is clear how this file reflects
system behavior when in "default" mode. There is no difference between mbm_assign_on_mkdir
enabled/disabled when in "default" mode, no? 
Should interactions with "mbm_assign_on_mkdir" be restricted to when
"mbm_event" mode is enabled? If so, the next question would likely be whether value
should change during "mbm_event" enable->disable or "disable->enable". Above states
clearly that it is enabled on boot and it may be reasonable to have it keep (but not always
expose) user's setting when switching between modes.

Restricting it to "mbm_event" mode now gives us some flexibility when soft-ABMC follows
on if/how it can/should support this. What do you think?

> +
> +	"0":
> +		Auto assignment is disabled.
> +	"1":
> +		Auto assignment is enabled.
> +
> +	Example::
> +
> +	  # echo 0 > /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
> +	  # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
> +	  0
> +
>  "max_threshold_occupancy":
>  		Read/write file provides the largest value (in
>  		bytes) at which a previously used LLC_occupancy
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 8efbeb910f77..6205bbfe08fb 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -1077,6 +1077,8 @@ int resctrl_mon_resource_init(void)
>  		resctrl_file_fflags_init("available_mbm_cntrs",
>  					 RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
>  		resctrl_file_fflags_init("event_filter", RFTYPE_ASSIGN_CONFIG);
> +		resctrl_file_fflags_init("mbm_assign_on_mkdir", RFTYPE_MON_INFO |
> +					 RFTYPE_RES_CACHE);
>  	}
>  
>  	return 0;
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index c3d6540c3280..bf04235d2603 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c

Please move resctrl_mbm_assign_on_mkdir_show() and resctrl_mbm_assign_on_mkdir_write() to monitor.c

Reinette
Re: [PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir
Posted by Moger, Babu 1 month, 4 weeks ago
Hi Reinette,

On 7/30/2025 3:08 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 7/25/25 11:29 AM, Babu Moger wrote:
>> The "mbm_event" counter assignment mode allows users to assign a hardware
>> counter to an RMID, event pair and monitor the bandwidth as long as it is
>> assigned.
> Above implies this addition is in support of "mbm_event" mode while the
> implementation applies to any and all assignable counter modes, including
> the "default" and for example the upcoming "soft-ABMC". It is clear to me
> how this is used and interpreted when "mbm_event" mode is enabled, but not
> for the others (more below).
>
>> Introduce a user-configurable option that determines if a counter will
>> automatically be assigned to an RMID, event pair when its associated
>> monitor group is created via mkdir.
>>
>> Suggested-by: Peter Newman <peternewman@google.com>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
> ...
>
>> ---
>>   Documentation/filesystems/resctrl.rst | 16 ++++++++++
>>   fs/resctrl/monitor.c                  |  2 ++
>>   fs/resctrl/rdtgroup.c                 | 43 +++++++++++++++++++++++++++
>>   include/linux/resctrl.h               |  3 ++
>>   4 files changed, 64 insertions(+)
>>
>> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
>> index 37dbad4d50f7..165e0d315af7 100644
>> --- a/Documentation/filesystems/resctrl.rst
>> +++ b/Documentation/filesystems/resctrl.rst
>> @@ -354,6 +354,22 @@ with the following files:
>>   	  # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
>>   	   local_reads,local_non_temporal_writes
>>   
>> +"mbm_assign_on_mkdir":
> Needs a "Exists when "mbm_event" counter assignment mode is supported."?
> Also needs clarification on on behavior when "mbm_event" is enabled vs. disabled.
I think we should allow it to modify  only when "mbm_event" is enabled.
>
>> +	Determines if a counter will automatically be assigned to an RMID, event pair
> "will automatically be" -> "is automatically"
> "RMID, event" -> "RMID, MBM event"
Sure.
>> +	when its associated monitor group is created via mkdir. It is enabled by default
>> +	on boot and users can disable by writing to the interface.
> "users can disable" -> "users can disable this capability" or "can be disabled"?
Sure.
>
> This implementation enables user to read/write this file/property when "mbm_event" mode is
> disabled. Considering this explanation I do not think it is clear how this file reflects
> system behavior when in "default" mode. There is no difference between mbm_assign_on_mkdir
> enabled/disabled when in "default" mode, no?
Yes. So, we should only allow modifications only when mbm_event mode is 
enabled.
> Should interactions with "mbm_assign_on_mkdir" be restricted to when
> "mbm_event" mode is enabled? If so, the next question would likely be whether value
Yes.
> should change during "mbm_event" enable->disable or "disable->enable". Above states
> clearly that it is enabled on boot and it may be reasonable to have it keep (but not always
> expose) user's setting when switching between modes.
>
> Restricting it to "mbm_event" mode now gives us some flexibility when soft-ABMC follows
> on if/how it can/should support this. What do you think?

Yes. We should restrict it to modify only when mbm_event mode is enabled.

And always enable it when switching from

"mbm_event" disable -> enable:  r->mon.mbm_assign_on_mkdir = true;

"mbm_event" enable -> enable: "no need to modify as the value does not affect the behavior."

>
>> +
>> +	"0":
>> +		Auto assignment is disabled.
>> +	"1":
>> +		Auto assignment is enabled.
>> +
>> +	Example::
>> +
>> +	  # echo 0 > /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
>> +	  # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir
>> +	  0
>> +
>>   "max_threshold_occupancy":
>>   		Read/write file provides the largest value (in
>>   		bytes) at which a previously used LLC_occupancy
>> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
>> index 8efbeb910f77..6205bbfe08fb 100644
>> --- a/fs/resctrl/monitor.c
>> +++ b/fs/resctrl/monitor.c
>> @@ -1077,6 +1077,8 @@ int resctrl_mon_resource_init(void)
>>   		resctrl_file_fflags_init("available_mbm_cntrs",
>>   					 RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
>>   		resctrl_file_fflags_init("event_filter", RFTYPE_ASSIGN_CONFIG);
>> +		resctrl_file_fflags_init("mbm_assign_on_mkdir", RFTYPE_MON_INFO |
>> +					 RFTYPE_RES_CACHE);
>>   	}
>>   
>>   	return 0;
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index c3d6540c3280..bf04235d2603 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
> Please move resctrl_mbm_assign_on_mkdir_show() and resctrl_mbm_assign_on_mkdir_write() to monitor.c

Sure.

Thanks

Babu

Re: [PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir
Posted by Reinette Chatre 1 month, 4 weeks ago
Hi Babu,

On 8/8/25 1:29 PM, Moger, Babu wrote:
> Hi Reinette,
> 
> On 7/30/2025 3:08 PM, Reinette Chatre wrote:
>> Hi Babu,
>>
>> On 7/25/25 11:29 AM, Babu Moger wrote:
>>> The "mbm_event" counter assignment mode allows users to assign a hardware
>>> counter to an RMID, event pair and monitor the bandwidth as long as it is
>>> assigned.
>> Above implies this addition is in support of "mbm_event" mode while the
>> implementation applies to any and all assignable counter modes, including
>> the "default" and for example the upcoming "soft-ABMC". It is clear to me
>> how this is used and interpreted when "mbm_event" mode is enabled, but not
>> for the others (more below).
>>
>>> Introduce a user-configurable option that determines if a counter will
>>> automatically be assigned to an RMID, event pair when its associated
>>> monitor group is created via mkdir.
>>>
>>> Suggested-by: Peter Newman <peternewman@google.com>
>>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>>> ---
>> ...
>>
>>> ---
>>>   Documentation/filesystems/resctrl.rst | 16 ++++++++++
>>>   fs/resctrl/monitor.c                  |  2 ++
>>>   fs/resctrl/rdtgroup.c                 | 43 +++++++++++++++++++++++++++
>>>   include/linux/resctrl.h               |  3 ++
>>>   4 files changed, 64 insertions(+)
>>>
>>> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
>>> index 37dbad4d50f7..165e0d315af7 100644
>>> --- a/Documentation/filesystems/resctrl.rst
>>> +++ b/Documentation/filesystems/resctrl.rst
>>> @@ -354,6 +354,22 @@ with the following files:
>>>         # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
>>>          local_reads,local_non_temporal_writes
>>>   +"mbm_assign_on_mkdir":
>> Needs a "Exists when "mbm_event" counter assignment mode is supported."?
>> Also needs clarification on on behavior when "mbm_event" is enabled vs. disabled.
> I think we should allow it to modify  only when "mbm_event" is enabled.
>>
>>> +    Determines if a counter will automatically be assigned to an RMID, event pair
>> "will automatically be" -> "is automatically"
>> "RMID, event" -> "RMID, MBM event"
> Sure.
>>> +    when its associated monitor group is created via mkdir. It is enabled by default
>>> +    on boot and users can disable by writing to the interface.
>> "users can disable" -> "users can disable this capability" or "can be disabled"?
> Sure.
>>
>> This implementation enables user to read/write this file/property when "mbm_event" mode is
>> disabled. Considering this explanation I do not think it is clear how this file reflects
>> system behavior when in "default" mode. There is no difference between mbm_assign_on_mkdir
>> enabled/disabled when in "default" mode, no?
> Yes. So, we should only allow modifications only when mbm_event mode is enabled.
>> Should interactions with "mbm_assign_on_mkdir" be restricted to when
>> "mbm_event" mode is enabled? If so, the next question would likely be whether value
> Yes.
>> should change during "mbm_event" enable->disable or "disable->enable". Above states
>> clearly that it is enabled on boot and it may be reasonable to have it keep (but not always
>> expose) user's setting when switching between modes.
>>
>> Restricting it to "mbm_event" mode now gives us some flexibility when soft-ABMC follows
>> on if/how it can/should support this. What do you think?
> 
> Yes. We should restrict it to modify only when mbm_event mode is enabled.

I agree. I also think it should not be displayed with mbm_event mode is disabled. This is
because it indicates to user space that counters are automatically assigned to RMID, event
pairs and since "default" mode depends on hardware doing this it may not be accurate when, for
example, ABMC is disabled. Alternative is to add a third value, for example "enabled", "disabled", and
"undefined"(?). This sounds a bit awkward though so I think simplest may be to have this file
also be consistent with the others and return error when mbm_event mode is disabled.

> 
> And always enable it when switching from
> 
> "mbm_event" disable -> enable:  r->mon.mbm_assign_on_mkdir = true;
> 
> "mbm_event" enable -> enable: "no need to modify as the value does not affect the behavior."
> 

ok, please note this may need an update to the doc that currently only states "enabled by
default on boot" to indicate it is also automatically enabled when enabling mbm_event mode.

Reinette
Re: [PATCH v16 27/34] fs/resctrl: Introduce mbm_assign_on_mkdir to enable assignments on mkdir
Posted by Moger, Babu 1 month, 4 weeks ago
Hi Reinette.

On 8/8/2025 4:00 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 8/8/25 1:29 PM, Moger, Babu wrote:
>> Hi Reinette,
>>
>> On 7/30/2025 3:08 PM, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 7/25/25 11:29 AM, Babu Moger wrote:
>>>> The "mbm_event" counter assignment mode allows users to assign a hardware
>>>> counter to an RMID, event pair and monitor the bandwidth as long as it is
>>>> assigned.
>>> Above implies this addition is in support of "mbm_event" mode while the
>>> implementation applies to any and all assignable counter modes, including
>>> the "default" and for example the upcoming "soft-ABMC". It is clear to me
>>> how this is used and interpreted when "mbm_event" mode is enabled, but not
>>> for the others (more below).
>>>
>>>> Introduce a user-configurable option that determines if a counter will
>>>> automatically be assigned to an RMID, event pair when its associated
>>>> monitor group is created via mkdir.
>>>>
>>>> Suggested-by: Peter Newman <peternewman@google.com>
>>>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>>>> ---
>>> ...
>>>
>>>> ---
>>>>    Documentation/filesystems/resctrl.rst | 16 ++++++++++
>>>>    fs/resctrl/monitor.c                  |  2 ++
>>>>    fs/resctrl/rdtgroup.c                 | 43 +++++++++++++++++++++++++++
>>>>    include/linux/resctrl.h               |  3 ++
>>>>    4 files changed, 64 insertions(+)
>>>>
>>>> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
>>>> index 37dbad4d50f7..165e0d315af7 100644
>>>> --- a/Documentation/filesystems/resctrl.rst
>>>> +++ b/Documentation/filesystems/resctrl.rst
>>>> @@ -354,6 +354,22 @@ with the following files:
>>>>          # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_total_bytes/event_filter
>>>>           local_reads,local_non_temporal_writes
>>>>    +"mbm_assign_on_mkdir":
>>> Needs a "Exists when "mbm_event" counter assignment mode is supported."?
>>> Also needs clarification on on behavior when "mbm_event" is enabled vs. disabled.
>> I think we should allow it to modify  only when "mbm_event" is enabled.
>>>> +    Determines if a counter will automatically be assigned to an RMID, event pair
>>> "will automatically be" -> "is automatically"
>>> "RMID, event" -> "RMID, MBM event"
>> Sure.
>>>> +    when its associated monitor group is created via mkdir. It is enabled by default
>>>> +    on boot and users can disable by writing to the interface.
>>> "users can disable" -> "users can disable this capability" or "can be disabled"?
>> Sure.
>>> This implementation enables user to read/write this file/property when "mbm_event" mode is
>>> disabled. Considering this explanation I do not think it is clear how this file reflects
>>> system behavior when in "default" mode. There is no difference between mbm_assign_on_mkdir
>>> enabled/disabled when in "default" mode, no?
>> Yes. So, we should only allow modifications only when mbm_event mode is enabled.
>>> Should interactions with "mbm_assign_on_mkdir" be restricted to when
>>> "mbm_event" mode is enabled? If so, the next question would likely be whether value
>> Yes.
>>> should change during "mbm_event" enable->disable or "disable->enable". Above states
>>> clearly that it is enabled on boot and it may be reasonable to have it keep (but not always
>>> expose) user's setting when switching between modes.
>>>
>>> Restricting it to "mbm_event" mode now gives us some flexibility when soft-ABMC follows
>>> on if/how it can/should support this. What do you think?
>> Yes. We should restrict it to modify only when mbm_event mode is enabled.
> I agree. I also think it should not be displayed with mbm_event mode is disabled. This is
> because it indicates to user space that counters are automatically assigned to RMID, event
> pairs and since "default" mode depends on hardware doing this it may not be accurate when, for
> example, ABMC is disabled. Alternative is to add a third value, for example "enabled", "disabled", and
> "undefined"(?). This sounds a bit awkward though so I think simplest may be to have this file
> also be consistent with the others and return error when mbm_event mode is disabled.


Yes. We can do that.


>
>> And always enable it when switching from
>>
>> "mbm_event" disable -> enable:  r->mon.mbm_assign_on_mkdir = true;
>>
>> "mbm_event" enable -> enable: "no need to modify as the value does not affect the behavior."
>>
> ok, please note this may need an update to the doc that currently only states "enabled by
> default on boot" to indicate it is also automatically enabled when enabling mbm_event mode.


Will add texts about it.

Thanks

Babu