Re: [PATCH v4 4/7] x86,fs/resctrl: Add monitor property 'mbm_cntr_assign_fixed'

From: Reinette Chatre

Date: Fri Mar 27 2026 - 12:22:32 EST


Hi Ben,

Now that the patch no longer touches x86 code the subject prefix can just
be "fs/resctrl:".

On 3/26/26 10:25 AM, Ben Horgan wrote:
> Commit
>
> 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring modes")
>
> introduced CONFIG_RESCTRL_ASSIGN_FIXED but left adding the Kconfig
> entry until it was necessary. The counter assignment mode is fixed in
> MPAM, even when there are assignable counters, and so addressing this
> is needed to support MPAM.
>
> To avoid the burden of another Kconfig entry, replace
> CONFIG_RESCTRL_ASSIGN_FIXED with a new property in 'struct resctrl_mon',
> 'mbm_cntr_assign_fixed'.

Can append "to be set by architecture."

>
> To enable better user reporting check the new property in
> resctrl_mbm_assign_mode_write().

How about:
Do not request the architecture to change the counter assignment
mode if it does not support doing so. Provide insight to user space
about why such a request fails.

>
> Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
> ---
> Changes since v2:
> Change to a resctrl_mon property rather than a arch hook
> Update the commit message to mention the property
> ---
> fs/resctrl/monitor.c | 8 +++++++-
> include/linux/resctrl.h | 2 ++
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 8fec3dea33c3..6afa2af26ff7 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -1454,7 +1454,7 @@ int resctrl_mbm_assign_mode_show(struct kernfs_open_file *of,
> else
> seq_puts(s, "[default]\n");
>
> - if (!IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) {
> + if (!r->mon.mbm_cntr_assign_fixed) {
> if (enabled)
> seq_puts(s, "default\n");
> else
> @@ -1505,6 +1505,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_open_file *of, char *buf,
> }
>
> if (enable != resctrl_arch_mbm_cntr_assign_enabled(r)) {
> + if (r->mon.mbm_cntr_assign_fixed) {
> + ret = -EINVAL;
> + rdt_last_cmd_puts("Counter assignment mode is not configurable\n");
> + goto out_unlock;
> + }
> +
> ret = resctrl_arch_mbm_cntr_assign_set(r, enable);
> if (ret)
> goto out_unlock;
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 06e8c72e8660..a986daf5f2ef 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -294,6 +294,7 @@ enum resctrl_schema_fmt {
> * @mbm_assign_on_mkdir: True if counters should automatically be assigned to MBM
> * events of monitor groups created via mkdir.
> * @mbm_cntr_configurable: True if assignable counters are configurable.
> + * @mbm_cntr_assign_fixed: True if the counter assignment mode is fix.

"is fix" -> "is fixed"?

> */
> struct resctrl_mon {
> u32 num_rmid;
> @@ -302,6 +303,7 @@ struct resctrl_mon {
> bool mbm_cntr_assignable;
> bool mbm_assign_on_mkdir;
> bool mbm_cntr_configurable;
> + bool mbm_cntr_assign_fixed;
> };
>
> /**

Reinette