The "mbm_cntr_assign" mode allows users to manually assign a hardware counter to a specific RMID and event pair. The events available for assignment are configurable. By default, each resctrl group supports two MBM events: mbm_total_bytes and mbm_local_bytes. Each event corresponds to an MBM configuration that specifies the bandwidth sources tracked by the event. Add definitions of supported bandwidth sources. Signed-off-by: Babu Moger <babu.moger@xxxxxxx> --- v13: Updated the changelog. Removed the definitions from resctrl_types.h and moved to internal.h. Removed mbm_assign_config definition. Configurations will be part of mon_evt list. Resolved conflicts caused by the recent FS/ARCH code restructure. The rdtgroup.c file has now been split between the FS and ARCH directories. v12: New patch to support event configurations via new counter_configs method. --- fs/resctrl/internal.h | 10 ++++++++++ fs/resctrl/rdtgroup.c | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 0dfd2efe68fc..019d00bf5adf 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -203,6 +203,16 @@ struct rdtgroup { struct pseudo_lock_region *plr; }; +/** + * struct mbm_evt_value - Specific type of memory events. + * @evt_name: Name of memory transaction type (read, write etc). + * @evt_val: Value representing the memory transaction. + */ +struct mbm_evt_value { + char evt_name[32]; + u32 evt_val; +}; + /* rdtgroup.flags */ #define RDT_DELETED 1 diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 72317a5adee2..b109e91096b0 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -75,6 +75,20 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +/* Number of memory transaction types that can be monitored */ +#define NUM_MBM_EVT_VALUES 7 + +/* Decoded values for each type of memory events */ +struct mbm_evt_value mbm_evt_values[NUM_MBM_EVT_VALUES] = { + {"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}, +}; + /* * Memory bandwidth monitoring event to use for the default CTRL_MON group * and each new CTRL_MON group created by the user. Only relevant when -- 2.34.1