From: Fenghua Yu <fenghuay@nvidia.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
Tony Luck <tony.luck@intel.com>, Ben Horgan <ben.horgan@arm.com>,
James Morse <james.morse@arm.com>, Will Deacon <will@kernel.org>,
Dave Martin <Dave.Martin@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Shaopeng Tan <tan.shaopeng@fujitsu.com>,
Chen Yu <yu.c.chen@intel.com>, Babu Moger <babu.moger@amd.com>,
Drew Fustini <fustini@kernel.org>,
Vikram Sethi <vsethi@nvidia.com>,
Shanker Donthineni <sdonthineni@nvidia.com>,
Newton Liu <newtonl@nvidia.com>,
Richard Cheng <icheng@nvidia.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Fenghua Yu <fenghuay@nvidia.com>
Subject: [PATCH RFC v3 04/15] resctrl: Add node-scope MBM total event
Date: Mon, 9 Nov 2026 13:24:16 -0800 [thread overview]
Message-ID: <20261109212427.1409204-5-fenghuay@nvidia.com> (raw)
In-Reply-To: <20261109212427.1409204-1-fenghuay@nvidia.com>
Some MPAM systems count total memory bandwidth on a memory-side MSC that
is scoped to a NUMA node rather than the L3 cache. Add a new
QOS_NODE_MBM_TOTAL_EVENT_ID event for this node-scoped total, backed by
the MBA resource, and register it in the mon_event_all[] table.
Keep the new event id contiguous with the existing L3 MBM events so the
for_each_mbm_event_id() range and the per-domain software MBM state
arrays continue to be sized from the first to the last MBM event. Extend
resctrl_is_mbm_event() to recognise it, and add helpers
resctrl_is_mbm_total_event() and resctrl_mbm_total_event_id() so callers
can select the node-scoped total when it is enabled and fall back to the
L3 total otherwise.
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
---
fs/resctrl/monitor.c | 2 ++
include/linux/resctrl.h | 27 +++++++++++++++++++++++----
include/linux/resctrl_types.h | 15 ++++++++++++++-
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 5865a509174c..ea9d92b6b581 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -1040,6 +1040,8 @@ struct mon_evt mon_event_all[QOS_NUM_EVENTS] = {
MON_EVENT(QOS_L3_OCCUP_EVENT_ID, "llc_occupancy", RDT_RESOURCE_L3, false),
MON_EVENT(QOS_L3_MBM_TOTAL_EVENT_ID, "mbm_total_bytes", RDT_RESOURCE_L3, false),
MON_EVENT(QOS_L3_MBM_LOCAL_EVENT_ID, "mbm_local_bytes", RDT_RESOURCE_L3, false),
+ MON_EVENT(QOS_NODE_MBM_TOTAL_EVENT_ID, "mbm_total_bytes",
+ RDT_RESOURCE_MBA, false),
MON_EVENT(PMT_EVENT_ENERGY, "core_energy", RDT_RESOURCE_PERF_PKG, true),
MON_EVENT(PMT_EVENT_ACTIVITY, "activity", RDT_RESOURCE_PERF_PKG, true),
MON_EVENT(PMT_EVENT_STALLS_LLC_HIT, "stalls_llc_hit", RDT_RESOURCE_PERF_PKG, false),
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index f2c3621b006e..195c0948b26d 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -633,16 +633,35 @@ bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt);
static inline bool resctrl_is_mbm_event(enum resctrl_event_id eventid)
{
- return (eventid >= QOS_L3_MBM_TOTAL_EVENT_ID &&
- eventid <= QOS_L3_MBM_LOCAL_EVENT_ID);
+ return ((eventid >= QOS_L3_MBM_TOTAL_EVENT_ID &&
+ eventid <= QOS_L3_MBM_LOCAL_EVENT_ID) ||
+ eventid == QOS_NODE_MBM_TOTAL_EVENT_ID);
+}
+
+static inline bool resctrl_is_mbm_total_event(enum resctrl_event_id eventid)
+{
+ return eventid == QOS_L3_MBM_TOTAL_EVENT_ID ||
+ eventid == QOS_NODE_MBM_TOTAL_EVENT_ID;
+}
+
+static inline enum resctrl_event_id resctrl_mbm_total_event_id(void)
+{
+ if (resctrl_is_mon_event_enabled(QOS_NODE_MBM_TOTAL_EVENT_ID))
+ return QOS_NODE_MBM_TOTAL_EVENT_ID;
+
+ return QOS_L3_MBM_TOTAL_EVENT_ID;
}
u32 resctrl_get_mon_evt_cfg(enum resctrl_event_id eventid);
-/* Iterate over all memory bandwidth events */
+/*
+ * Iterate over all memory bandwidth events. The node-scope total event is
+ * contiguous with the L3 events, so it is covered by the same range. Loop
+ * bodies must skip events that are not enabled.
+ */
#define for_each_mbm_event_id(eventid) \
for (eventid = QOS_L3_MBM_TOTAL_EVENT_ID; \
- eventid <= QOS_L3_MBM_LOCAL_EVENT_ID; eventid++)
+ eventid <= QOS_NODE_MBM_TOTAL_EVENT_ID; eventid++)
/* Iterate over memory bandwidth arrays in domain structures */
#define for_each_mbm_idx(idx) \
diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h
index a5f56faa18d2..996ae8763b0a 100644
--- a/include/linux/resctrl_types.h
+++ b/include/linux/resctrl_types.h
@@ -50,6 +50,13 @@ enum resctrl_event_id {
QOS_L3_MBM_TOTAL_EVENT_ID = 0x02,
QOS_L3_MBM_LOCAL_EVENT_ID = 0x03,
+ /*
+ * Total memory bandwidth counted on a NUMA node scope MSC (e.g. a
+ * memory-side MSC above the L3). Kept contiguous with the other MPAM
+ * events so arch code can size per-event arrays by the last MPAM event.
+ */
+ QOS_NODE_MBM_TOTAL_EVENT_ID = 0x04,
+
/* Intel Telemetry Events */
PMT_EVENT_ENERGY,
PMT_EVENT_ACTIVITY,
@@ -65,7 +72,13 @@ enum resctrl_event_id {
QOS_NUM_EVENTS,
};
-#define QOS_NUM_L3_MBM_EVENTS (QOS_L3_MBM_LOCAL_EVENT_ID - QOS_L3_MBM_TOTAL_EVENT_ID + 1)
+/*
+ * Number of software MBM state slots per monitoring domain. The MBM events
+ * (L3 total, L3 local and the node-scope total) are contiguous, so the last
+ * one bounds the array. The node-scope total event is only ever enabled on
+ * Arm/MPAM; on x86 its slot is simply left unused.
+ */
+#define QOS_NUM_L3_MBM_EVENTS (QOS_NODE_MBM_TOTAL_EVENT_ID - QOS_L3_MBM_TOTAL_EVENT_ID + 1)
#define MBM_STATE_IDX(evt) ((evt) - QOS_L3_MBM_TOTAL_EVENT_ID)
#endif /* __LINUX_RESCTRL_TYPES_H */
--
2.53.0
next prev parent reply other threads:[~2026-11-09 21:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 21:24 [PATCH RFC v3 00/15] arm,fs/resctrl: ARM MPAM memory-level MSC and CPU-less NUMA nodes Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 01/15] resctrl: De-hardcode L3 monitor infrastructure Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 02/15] resctrl: Expose MBA MBM counter assignment sysfs Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 03/15] resctrl: name node-scoped monitor domains mon_NODE_<id> Fenghua Yu
2026-11-09 21:24 ` Fenghua Yu [this message]
2026-11-09 21:24 ` [PATCH RFC v3 05/15] resctrl: Make MBM paths resource-aware Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 06/15] arm_mpam: Support memory-level MSCs and ABMC per class Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 07/15] arm_mpam: Refine L3 topology and class selection Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 08/15] arm_mpam: Include all MSC components during domain setup Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 09/15] fs/resctrl: Take memory hotplug lock whenever taking CPU hotplug lock Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 10/15] arm_mpam: Handle CPU-less numa nodes Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 11/15] arm_mpam: resctrl: Add NUMA node notifier for domain online/offline Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 12/15] Documentation: resctrl: document mbm_NODE_assignments Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 13/15] Documentation: arm64: mpam: document memory-level MB control and NUMA nodes Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 14/15] Documentation: resctrl: document NUMA-node MBA domains and mon_NODE monitoring Fenghua Yu
2026-11-09 21:24 ` [PATCH RFC v3 15/15] arm_mpam: Add KUnit test for CPU-less NUMA node affinity Fenghua Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109212427.1409204-5-fenghuay@nvidia.com \
--to=fenghuay@nvidia.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=ben.horgan@arm.com \
--cc=catalin.marinas@arm.com \
--cc=fustini@kernel.org \
--cc=icheng@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=newtonl@nvidia.com \
--cc=reinette.chatre@intel.com \
--cc=sdonthineni@nvidia.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tony.luck@intel.com \
--cc=vsethi@nvidia.com \
--cc=will@kernel.org \
--cc=yu.c.chen@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®