[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a08cb0b35f3f7aa759cad20cea0733f9480cb34.1752013061.git.babu.moger@amd.com>
Date: Tue, 8 Jul 2025 17:17:34 -0500
From: Babu Moger <babu.moger@....com>
To: <corbet@....net>, <tony.luck@...el.com>, <reinette.chatre@...el.com>,
<james.morse@....com>, <tglx@...utronix.de>, <mingo@...hat.com>,
<bp@...en8.de>, <dave.hansen@...ux.intel.com>
CC: <Dave.Martin@....com>, <x86@...nel.org>, <hpa@...or.com>,
<akpm@...ux-foundation.org>, <paulmck@...nel.org>, <rostedt@...dmis.org>,
<Neeraj.Upadhyay@....com>, <david@...hat.com>, <arnd@...db.de>,
<fvdl@...gle.com>, <seanjc@...gle.com>, <jpoimboe@...nel.org>,
<pawan.kumar.gupta@...ux.intel.com>, <xin@...or.com>,
<manali.shukla@....com>, <babu.moger@....com>, <tao1.su@...ux.intel.com>,
<sohil.mehta@...el.com>, <kai.huang@...el.com>, <xiaoyao.li@...el.com>,
<peterz@...radead.org>, <xin3.li@...el.com>, <kan.liang@...ux.intel.com>,
<mario.limonciello@....com>, <thomas.lendacky@....com>, <perry.yuan@....com>,
<gautham.shenoy@....com>, <chang.seok.bae@...el.com>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<peternewman@...gle.com>, <eranian@...gle.com>
Subject: [PATCH v15 25/34] fs/resctrl: Add definitions for MBM event configuration
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@....com>
---
v15: Updated the changelog.
Moved NUM_MBM_TRANSACTIONS to include/linux/resctrl_types.h
Changed struct mbm_config_value to struct mbm_transaction.
v14: Changed the term memory events to memory transactions to be consistant.
Changed the name of the structure to mbm_config_value(from mbm_evt_value).
Changed name to memory trasactions where applicable.
Changes subject line to fs/resctrl.
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 | 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.
+ */
+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 */
+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 */
--
2.34.1
Powered by blists - more mailing lists