Re: [PATCH v15 33/34] fs/resctrl: Introduce the interface to switch between monitor modes

From: Reinette Chatre
Date: Fri Jul 18 2025 - 00:03:36 EST


Hi Babu,

On 7/8/25 3:17 PM, Babu Moger wrote:
> 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.
>
> Introduce mbm_assign_mode resctrl file to switch between mbm_event and
> default modes.
>
> 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:

"monitoring mode" -> "counter assignment 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.
>
> Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
> ---

...

> ---
> Documentation/filesystems/resctrl.rst | 22 +++++++-
> fs/resctrl/internal.h | 2 +
> fs/resctrl/monitor.c | 27 ++++++++++
> fs/resctrl/rdtgroup.c | 72 ++++++++++++++++++++++++++-
> 4 files changed, 121 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
> index 2b2acb55d8b1..b8a4dbe061ea 100644
> --- a/Documentation/filesystems/resctrl.rst
> +++ b/Documentation/filesystems/resctrl.rst
> @@ -259,7 +259,8 @@ with the following files:
>
> "mbm_assign_mode":
> The supported counter assignment modes. The enclosed brackets indicate which mode
> - is enabled.
> + is enabled. The MBM events associated with counters may reset when "mbm_assign_mode"
> + is changed.
> ::
>
> # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
> @@ -279,6 +280,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 counter assignment mode requires users to assign the counters
> + to the events. 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 +298,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:

"monitoring mode" -> "counter assignment 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 counters (total of available and assigned counters) in
> each domain when the system supports mbm_event mode.

Reinette