[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f87053b76713a05fa4b5459dbd3af6af83d47c49.1752013061.git.babu.moger@amd.com>
Date: Tue, 8 Jul 2025 17:17:24 -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 15/34] fs/resctrl: Introduce event configuration field in struct mon_evt
When supported, mbm_event counter assignment mode allows the user to
configure events to track specific types of memory transactions.
Introduce the evt_cfg field in struct mon_evt to define the type of memory
transactions tracked by a monitoring event. Also add a helper function to
get the evt_cfg value.
Signed-off-by: Babu Moger <babu.moger@....com>
---
v15: Updated the changelog.
Removed resctrl_set_mon_evt_cfg().
Moved the event initialization to resctrl_mon_resource_init().
v14: This is updated patch from previous patch.
https://lore.kernel.org/lkml/95b7f4e9d72773e8fda327fc80b429646efc3a8a.1747349530.git.babu.moger@amd.com/
Removed mbm_mode as it is not required anymore.
Added resctrl_get_mon_evt_cfg() and resctrl_set_mon_evt_cfg().
v13: New patch to handle different event configuration types with
mbm_cntr_assign mode.
---
fs/resctrl/internal.h | 5 +++++
fs/resctrl/monitor.c | 10 ++++++++++
include/linux/resctrl.h | 2 ++
3 files changed, 17 insertions(+)
diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
index 445a41060724..ea5c9fa932aa 100644
--- a/fs/resctrl/internal.h
+++ b/fs/resctrl/internal.h
@@ -56,6 +56,10 @@ static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
* @evtid: event id
* @rid: index of the resource for this event
* @name: name of the event
+ * @evt_cfg: Event configuration value that represents the
+ * memory transactions (e.g., READS_TO_LOCAL_MEM,
+ * READS_TO_REMOTE_MEM) being tracked by @evtid.
+ * Only valid if @evtid is an MBM event.
* @configurable: true if the event is configurable
* @enabled: true if the event is enabled
*/
@@ -63,6 +67,7 @@ struct mon_evt {
enum resctrl_event_id evtid;
enum resctrl_res_level rid;
char *name;
+ u32 evt_cfg;
bool configurable;
bool enabled;
};
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 9fd1fb76f82f..11327bd8cf72 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -884,6 +884,11 @@ bool resctrl_is_mon_event_enabled(enum resctrl_event_id eventid)
mon_event_all[eventid].enabled;
}
+u32 resctrl_get_mon_evt_cfg(enum resctrl_event_id evtid)
+{
+ return mon_event_all[evtid].evt_cfg;
+}
+
/**
* resctrl_mon_resource_init() - Initialise global monitoring structures.
*
@@ -926,7 +931,12 @@ int resctrl_mon_resource_init(void)
if (r->mon.mbm_cntr_assignable) {
resctrl_enable_mon_event(QOS_L3_MBM_TOTAL_EVENT_ID);
+ mon_event_all[QOS_L3_MBM_TOTAL_EVENT_ID].evt_cfg = MAX_EVT_CONFIG_BITS;
+
resctrl_enable_mon_event(QOS_L3_MBM_LOCAL_EVENT_ID);
+ mon_event_all[QOS_L3_MBM_LOCAL_EVENT_ID].evt_cfg = READS_TO_LOCAL_MEM |
+ READS_TO_LOCAL_S_MEM |
+ NON_TEMP_WRITE_TO_LOCAL_MEM;
resctrl_file_fflags_init("num_mbm_cntrs",
RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
resctrl_file_fflags_init("available_mbm_cntrs",
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index e013caba6641..87daa4ca312d 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -409,6 +409,8 @@ static inline bool resctrl_is_mbm_event(enum resctrl_event_id eventid)
eventid <= QOS_L3_MBM_LOCAL_EVENT_ID);
}
+u32 resctrl_get_mon_evt_cfg(enum resctrl_event_id eventid);
+
/* Iterate over all memory bandwidth events */
#define for_each_mbm_event_id(eventid) \
for (eventid = QOS_L3_MBM_TOTAL_EVENT_ID; \
--
2.34.1
Powered by blists - more mailing lists