Skip to contentSkip to conversation

x86,fs/resctrl: Add event group descriptions for Intel Diamond Rapids

PATCH Superseded Tony Luck 2 participants 2 messages Sep 29 – Sep 30

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tony Luck

author maintainer
#0 lore raw

PATCH v2 1/1 x86,fs/resctrl: Add event group descriptions for Intel Diamond Rapids

Intel Diamond Rapids exposes Application Energy Telemetry through two new PMT aggregator GUIDs: one covering the "energy" feature, and one covering the "perf" feature, both documented in the Intel-PMT XML repository [1].

The "perf" aggregator references two events not previously enumerated by resctrl: retired instructions (INST_RETIRED), and a count of unhalted core clock cycles perceived by hardware as contributing to instruction execution (PCNT).

Add definitions for both aggregators, and add the two new events to the resctrl filesystem so they can be exposed to user space.

---
v2:
Reinette kindly wrote a much better commit message. Code unchanged.

 include/linux/resctrl_types.h           |  2 ++
 arch/x86/kernel/cpu/resctrl/intel_aet.c | 34 +++++++++++++++++++++++++
 fs/resctrl/monitor.c                    |  2 ++
 3 files changed, 38 insertions(+)
include/linux/resctrl_types.h +2 -0
index a5f56faa18d2..e2e2cf3d9ff6 100644
@@ -60,6 +60,8 @@ enum resctrl_event_id {
 	PMT_EVENT_AUTO_C6_RES,
 	PMT_EVENT_UNHALTED_REF_CYCLES,
 	PMT_EVENT_UOPS_RETIRED,
+	PMT_EVENT_INST_RETIRED,
+	PMT_EVENT_PCNT,
 
 	/* Must be the last */
 	QOS_NUM_EVENTS,
arch/x86/kernel/cpu/resctrl/intel_aet.c +34 -0
index c22c3cf5167d..3555b0aa33ce 100644
@@ -125,9 +125,43 @@ static struct event_group perf_0x26557651 = {
 	}
 };
 
+/*
+ * Link: https://github.com/intel/Intel-PMT/blob/main/xml/DMR/OOBMSM/RMID-ENERGY/dmr_aggregator.xml
+ */
+static struct event_group energy_0x47903099 = {
+	.pfname		= "energy",
+	.guid		= 0x47903099,
+	.num_rmid	= 256,
+	.mmio_size	= XML_MMIO_SIZE(256, 2, 3),
+	.num_events	= 2,
+	.evts		= {
+		EVT(PMT_EVENT_ENERGY, 0, 18),
+		EVT(PMT_EVENT_ACTIVITY, 1, 18),
+	}
+};
+
+/*
+ * Link: https://github.com/intel/Intel-PMT/blob/main/xml/DMR/OOBMSM/RMID-PERF/dmr_aggregator.xml
+ */
+static struct event_group perf_0x1415910A = {
+	.pfname		= "perf",
+	.guid		= 0x1415910A,
+	.num_rmid	= 256,
+	.mmio_size	= XML_MMIO_SIZE(256, 4, 3),
+	.num_events	= 4,
+	.evts		= {
+		EVT(PMT_EVENT_UNHALTED_REF_CYCLES, 0, 0),
+		EVT(PMT_EVENT_UNHALTED_CORE_CYCLES, 1, 0),
+		EVT(PMT_EVENT_INST_RETIRED, 2, 0),
+		EVT(PMT_EVENT_PCNT, 3, 0),
+	}
+};
+
 static struct event_group *known_event_groups[] = {
 	&energy_0x26696143,
+	&energy_0x47903099,
 	&perf_0x26557651,
+	&perf_0x1415910A,
 };
 
 #define for_each_event_group(_peg)						\
fs/resctrl/monitor.c +2 -0
index 73413cb128ea..04e4ea612b7c 100644
@@ -1041,6 +1041,8 @@ struct mon_evt mon_event_all[QOS_NUM_EVENTS] = {
 	MON_EVENT(PMT_EVENT_AUTO_C6_RES,		"c6_res",		RDT_RESOURCE_PERF_PKG,	false),
 	MON_EVENT(PMT_EVENT_UNHALTED_REF_CYCLES,	"unhalted_ref_cycles",	RDT_RESOURCE_PERF_PKG,	false),
 	MON_EVENT(PMT_EVENT_UOPS_RETIRED,		"uops_retired",		RDT_RESOURCE_PERF_PKG,	false),
+	MON_EVENT(PMT_EVENT_INST_RETIRED,		"inst_retired",		RDT_RESOURCE_PERF_PKG,	false),
+	MON_EVENT(PMT_EVENT_PCNT,			"pcnt",			RDT_RESOURCE_PERF_PKG,	false),
 };
 
 bool resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu,
Signature · 1 line
2.55.0
maintainer
#1 lore raw

Hi Tony,

On 9/29/26 10:18 AM, Tony Luck wrote:

...

Quoted 4 lines
arch/x86/kernel/cpu/resctrl/intel_aet.c +0 -0
index c22c3cf5167d..3555b0aa33ce 100644

...

Quoted 14 lines
arch/x86/kernel/cpu/resctrl/intel_aet.c +13 -0
+/*
+ * Link: https://github.com/intel/Intel-PMT/blob/main/xml/DMR/OOBMSM/RMID-PERF/dmr_aggregator.xml
+ */
+static struct event_group perf_0x1415910A = {
+	.pfname		= "perf",
+	.guid		= 0x1415910A,
+	.num_rmid	= 256,
+	.mmio_size	= XML_MMIO_SIZE(256, 4, 3),
+	.num_events	= 4,
+	.evts		= {
+		EVT(PMT_EVENT_UNHALTED_REF_CYCLES, 0, 0),
+		EVT(PMT_EVENT_UNHALTED_CORE_CYCLES, 1, 0),
+		EVT(PMT_EVENT_INST_RETIRED, 2, 0),

arch/x86/kernel/cpu/resctrl/intel_aet.c static struct event_group perf_0x26557651 = { · line 165

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/intel_aet.c +6 -0
+		EVT(PMT_EVENT_PCNT, 3, 0),
+	}
+};
+
 static struct event_group *known_event_groups[] = {
 	&energy_0x26696143,
+	&energy_0x47903099,
 	&perf_0x26557651,
+	&perf_0x1415910A,
 };

I asked our internal AI to take a look and it pointed out that this is the first GUID with a character hex digit. Having the GUID be uppercase makes diagnostics a bit harder because all messages print GUIDs with lowercase:

	pr_warn("Bad package %u in guid 0x%x\n", tr->plat_info.package_id,
		tr->guid);
	pr_warn("MMIO space wrong size (%zu bytes) for guid 0x%x. Expected %zu bytes.\n",
		tr->size, e->guid, e->mmio_size);
	pr_info("No events enabled in %s %s:0x%x\n", r->name, e->pfname, e->guid);
	pr_info("%s %s:0x%x monitoring detected\n", r->name, e->pfname, e->guid);

Going from log message to source code is thus not "grep friendly". This is a valid point.

With event_group name and its guid value switched to lower case | Reviewed-by: Reinette Chatre <[email protected]>

Reinette