Re: [PATCH v15 25/34] fs/resctrl: Add definitions for MBM event configuration
From: Reinette Chatre
Date: Thu Jul 17 2025 - 23:56:35 EST
Hi Babu,
On 7/8/25 3:17 PM, Babu Moger wrote:
> The "mbm_event" counter assignment mode allows the user to assign a
> hardware counter to an RMID, event pair and monitor the bandwidth as long
> as it is assigned. The user can specify the memory transaction(s) for the
> counter to track.
>
> Add the definitions for supported memory transactions (e.g., read, write,
> etc.) the counter can be configured with.
>
> Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
> ---
...
> ---
> fs/resctrl/internal.h | 11 +++++++++++
> fs/resctrl/monitor.c | 11 +++++++++++
> include/linux/resctrl_types.h | 3 +++
> 3 files changed, 25 insertions(+)
>
> diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
> index fb4fec4a4cdc..63526400e632 100644
> --- a/fs/resctrl/internal.h
> +++ b/fs/resctrl/internal.h
> @@ -216,6 +216,17 @@ struct rdtgroup {
> struct pseudo_lock_region *plr;
> };
>
> +/**
> + * struct mbm_transaction - Memory transaction an MBM event can be configured with.
> + * @name: Name of memory transaction (read, write ...).
> + * @val: The bit used to represent the memory transaction within an
> + * event's configuration.
Please include something similar to the mon_evt::evt_cfg kernel-doc to help reader
know where bit values come from. For example,
* @val: The bit (eg. READS_TO_LOCAL_MEM or READS_TO_REMOTE_MEM) used to represent
* the memory transaction within an event's configuration.
> + */
> +struct mbm_transaction {
> + char name[32];
> + u32 val;
> +};
> +
> /* rdtgroup.flags */
> #define RDT_DELETED 1
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 35faca7ff3b1..1670163649e7 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -920,6 +920,17 @@ u32 resctrl_get_mon_evt_cfg(enum resctrl_event_id evtid)
> return mon_event_all[evtid].evt_cfg;
> }
>
> +/* Decoded values for each type of memory transactions */
"transactions" -> "transaction."?
> +struct mbm_transaction mbm_transactions[NUM_MBM_TRANSACTIONS] = {
> + {"local_reads", READS_TO_LOCAL_MEM},
> + {"remote_reads", READS_TO_REMOTE_MEM},
> + {"local_non_temporal_writes", NON_TEMP_WRITE_TO_LOCAL_MEM},
> + {"remote_non_temporal_writes", NON_TEMP_WRITE_TO_REMOTE_MEM},
> + {"local_reads_slow_memory", READS_TO_LOCAL_S_MEM},
> + {"remote_reads_slow_memory", READS_TO_REMOTE_S_MEM},
> + {"dirty_victim_writes_all", DIRTY_VICTIMS_TO_ALL_MEM},
> +};
> +
> /**
> * resctrl_mon_resource_init() - Initialise global monitoring structures.
> *
> diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h
> index d98351663c2c..acfe07860b34 100644
> --- a/include/linux/resctrl_types.h
> +++ b/include/linux/resctrl_types.h
> @@ -34,6 +34,9 @@
> /* Max event bits supported */
> #define MAX_EVT_CONFIG_BITS GENMASK(6, 0)
>
> +/* Number of memory transactions that an MBM event can be configured with */
> +#define NUM_MBM_TRANSACTIONS 7
> +
> /* Event IDs */
> enum resctrl_event_id {
> /* Must match value of first event below */
Reinette