Skip to content

Commit 8f6b6ad

Browse files
aeglbp3tk0v
authored andcommitted
x86,fs/resctrl: Fill in details of events for performance and energy GUIDs
The telemetry event aggregators of the Intel Clearwater Forest CPU support two RMID-based feature types: "energy" with GUID 0x26696143¹, and "perf" with GUID 0x26557651². The event counter offsets in an aggregator's MMIO space are arranged in groups for each RMID. E.g., the "energy" counters for GUID 0x26696143 are arranged like this: MMIO offset:0x0000 Counter for RMID 0 PMT_EVENT_ENERGY MMIO offset:0x0008 Counter for RMID 0 PMT_EVENT_ACTIVITY MMIO offset:0x0010 Counter for RMID 1 PMT_EVENT_ENERGY MMIO offset:0x0018 Counter for RMID 1 PMT_EVENT_ACTIVITY ... MMIO offset:0x23F0 Counter for RMID 575 PMT_EVENT_ENERGY MMIO offset:0x23F8 Counter for RMID 575 PMT_EVENT_ACTIVITY After all counters there are three status registers that provide indications of how many times an aggregator was unable to process event counts, the time stamp for the most recent loss of data, and the time stamp of the most recent successful update. MMIO offset:0x2400 AGG_DATA_LOSS_COUNT MMIO offset:0x2408 AGG_DATA_LOSS_TIMESTAMP MMIO offset:0x2410 LAST_UPDATE_TIMESTAMP Define event_group structures for both of these aggregator types and define the events tracked by the aggregators in the file system code. PMT_EVENT_ENERGY and PMT_EVENT_ACTIVITY are produced in fixed point format. File system code must output as floating point values. ¹https://github.com/intel/Intel-PMT/blob/main/xml/CWF/OOBMSM/RMID-ENERGY/cwf_aggregator.xml ²https://github.com/intel/Intel-PMT/blob/main/xml/CWF/OOBMSM/RMID-PERF/cwf_aggregator.xml [ bp: Massage commit message. ] Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lore.kernel.org/20251217172121.12030-1-tony.luck@intel.com
1 parent 1fb2daa commit 8f6b6ad

3 files changed

Lines changed: 97 additions & 15 deletions

File tree

arch/x86/kernel/cpu/resctrl/intel_aet.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,33 @@
1111

1212
#define pr_fmt(fmt) "resctrl: " fmt
1313

14+
#include <linux/compiler_types.h>
1415
#include <linux/err.h>
1516
#include <linux/init.h>
1617
#include <linux/intel_pmt_features.h>
1718
#include <linux/intel_vsec.h>
1819
#include <linux/resctrl.h>
20+
#include <linux/resctrl_types.h>
1921
#include <linux/stddef.h>
22+
#include <linux/types.h>
2023

2124
#include "internal.h"
2225

26+
/**
27+
* struct pmt_event - Telemetry event.
28+
* @id: Resctrl event id.
29+
* @idx: Counter index within each per-RMID block of counters.
30+
* @bin_bits: Zero for integer valued events, else number bits in fraction
31+
* part of fixed-point.
32+
*/
33+
struct pmt_event {
34+
enum resctrl_event_id id;
35+
unsigned int idx;
36+
unsigned int bin_bits;
37+
};
38+
39+
#define EVT(_id, _idx, _bits) { .id = _id, .idx = _idx, .bin_bits = _bits }
40+
2341
/**
2442
* struct event_group - Events with the same feature type ("energy" or "perf") and GUID.
2543
* @pfname: PMT feature name ("energy" or "perf") of this event group.
@@ -29,14 +47,62 @@
2947
* data for all telemetry regions of type @pfname.
3048
* Valid if the system supports the event group,
3149
* NULL otherwise.
50+
* @guid: Unique number per XML description file.
51+
* @mmio_size: Number of bytes of MMIO registers for this group.
52+
* @num_events: Number of events in this group.
53+
* @evts: Array of event descriptors.
3254
*/
3355
struct event_group {
3456
/* Data fields for additional structures to manage this group. */
3557
const char *pfname;
3658
struct pmt_feature_group *pfg;
59+
60+
/* Remaining fields initialized from XML file. */
61+
u32 guid;
62+
size_t mmio_size;
63+
unsigned int num_events;
64+
struct pmt_event evts[] __counted_by(num_events);
65+
};
66+
67+
#define XML_MMIO_SIZE(num_rmids, num_events, num_extra_status) \
68+
(((num_rmids) * (num_events) + (num_extra_status)) * sizeof(u64))
69+
70+
/*
71+
* Link: https://github.com/intel/Intel-PMT/blob/main/xml/CWF/OOBMSM/RMID-ENERGY/cwf_aggregator.xml
72+
*/
73+
static struct event_group energy_0x26696143 = {
74+
.pfname = "energy",
75+
.guid = 0x26696143,
76+
.mmio_size = XML_MMIO_SIZE(576, 2, 3),
77+
.num_events = 2,
78+
.evts = {
79+
EVT(PMT_EVENT_ENERGY, 0, 18),
80+
EVT(PMT_EVENT_ACTIVITY, 1, 18),
81+
}
82+
};
83+
84+
/*
85+
* Link: https://github.com/intel/Intel-PMT/blob/main/xml/CWF/OOBMSM/RMID-PERF/cwf_aggregator.xml
86+
*/
87+
static struct event_group perf_0x26557651 = {
88+
.pfname = "perf",
89+
.guid = 0x26557651,
90+
.mmio_size = XML_MMIO_SIZE(576, 7, 3),
91+
.num_events = 7,
92+
.evts = {
93+
EVT(PMT_EVENT_STALLS_LLC_HIT, 0, 0),
94+
EVT(PMT_EVENT_C1_RES, 1, 0),
95+
EVT(PMT_EVENT_UNHALTED_CORE_CYCLES, 2, 0),
96+
EVT(PMT_EVENT_STALLS_LLC_MISS, 3, 0),
97+
EVT(PMT_EVENT_AUTO_C6_RES, 4, 0),
98+
EVT(PMT_EVENT_UNHALTED_REF_CYCLES, 5, 0),
99+
EVT(PMT_EVENT_UOPS_RETIRED, 6, 0),
100+
}
37101
};
38102

39103
static struct event_group *known_event_groups[] = {
104+
&energy_0x26696143,
105+
&perf_0x26557651,
40106
};
41107

42108
#define for_each_event_group(_peg) \

fs/resctrl/monitor.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -965,27 +965,32 @@ static void dom_data_exit(struct rdt_resource *r)
965965
mutex_unlock(&rdtgroup_mutex);
966966
}
967967

968+
#define MON_EVENT(_eventid, _name, _res, _fp) \
969+
[_eventid] = { \
970+
.name = _name, \
971+
.evtid = _eventid, \
972+
.rid = _res, \
973+
.is_floating_point = _fp, \
974+
}
975+
968976
/*
969977
* All available events. Architecture code marks the ones that
970978
* are supported by a system using resctrl_enable_mon_event()
971979
* to set .enabled.
972980
*/
973981
struct mon_evt mon_event_all[QOS_NUM_EVENTS] = {
974-
[QOS_L3_OCCUP_EVENT_ID] = {
975-
.name = "llc_occupancy",
976-
.evtid = QOS_L3_OCCUP_EVENT_ID,
977-
.rid = RDT_RESOURCE_L3,
978-
},
979-
[QOS_L3_MBM_TOTAL_EVENT_ID] = {
980-
.name = "mbm_total_bytes",
981-
.evtid = QOS_L3_MBM_TOTAL_EVENT_ID,
982-
.rid = RDT_RESOURCE_L3,
983-
},
984-
[QOS_L3_MBM_LOCAL_EVENT_ID] = {
985-
.name = "mbm_local_bytes",
986-
.evtid = QOS_L3_MBM_LOCAL_EVENT_ID,
987-
.rid = RDT_RESOURCE_L3,
988-
},
982+
MON_EVENT(QOS_L3_OCCUP_EVENT_ID, "llc_occupancy", RDT_RESOURCE_L3, false),
983+
MON_EVENT(QOS_L3_MBM_TOTAL_EVENT_ID, "mbm_total_bytes", RDT_RESOURCE_L3, false),
984+
MON_EVENT(QOS_L3_MBM_LOCAL_EVENT_ID, "mbm_local_bytes", RDT_RESOURCE_L3, false),
985+
MON_EVENT(PMT_EVENT_ENERGY, "core_energy", RDT_RESOURCE_PERF_PKG, true),
986+
MON_EVENT(PMT_EVENT_ACTIVITY, "activity", RDT_RESOURCE_PERF_PKG, true),
987+
MON_EVENT(PMT_EVENT_STALLS_LLC_HIT, "stalls_llc_hit", RDT_RESOURCE_PERF_PKG, false),
988+
MON_EVENT(PMT_EVENT_C1_RES, "c1_res", RDT_RESOURCE_PERF_PKG, false),
989+
MON_EVENT(PMT_EVENT_UNHALTED_CORE_CYCLES, "unhalted_core_cycles", RDT_RESOURCE_PERF_PKG, false),
990+
MON_EVENT(PMT_EVENT_STALLS_LLC_MISS, "stalls_llc_miss", RDT_RESOURCE_PERF_PKG, false),
991+
MON_EVENT(PMT_EVENT_AUTO_C6_RES, "c6_res", RDT_RESOURCE_PERF_PKG, false),
992+
MON_EVENT(PMT_EVENT_UNHALTED_REF_CYCLES, "unhalted_ref_cycles", RDT_RESOURCE_PERF_PKG, false),
993+
MON_EVENT(PMT_EVENT_UOPS_RETIRED, "uops_retired", RDT_RESOURCE_PERF_PKG, false),
989994
};
990995

991996
void resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu, unsigned int binary_bits)

include/linux/resctrl_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ enum resctrl_event_id {
5050
QOS_L3_MBM_TOTAL_EVENT_ID = 0x02,
5151
QOS_L3_MBM_LOCAL_EVENT_ID = 0x03,
5252

53+
/* Intel Telemetry Events */
54+
PMT_EVENT_ENERGY,
55+
PMT_EVENT_ACTIVITY,
56+
PMT_EVENT_STALLS_LLC_HIT,
57+
PMT_EVENT_C1_RES,
58+
PMT_EVENT_UNHALTED_CORE_CYCLES,
59+
PMT_EVENT_STALLS_LLC_MISS,
60+
PMT_EVENT_AUTO_C6_RES,
61+
PMT_EVENT_UNHALTED_REF_CYCLES,
62+
PMT_EVENT_UOPS_RETIRED,
63+
5364
/* Must be the last */
5465
QOS_NUM_EVENTS,
5566
};

0 commit comments

Comments
 (0)