Skip to contentSkip to conversation

perf,x86: add Intel Memory Bandwidth Monitoring (MBM) PMU

PATCH Superseded Kanaka Juvva 1 participant 1 message Jun 16, 2015

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 perf,x86: add Intel Memory Bandwidth Monitoring (MBM) PMU

This patch adds Memory Bandwidth Monitoring events to the exitsing intel_cqm pmu in the Linux Kernel.

Intel MBM builds on Cache Monitoring Technology (CMT) infrastructure to allow monitoring of bandwidth from one level of the cache hierarchy to the next - in this case focusing on the L3 cache, which is typically backed directly by system memory. As a result of this implementation, memory bandwidth can be monitored.

MBM counters are available in Intel Xeon CPUs. The following events are implemented in the kernel and expose two MBM counters via perf_event interface:

- llc_local_bw: bandwidth consumption of all coress on socket
- llc_total_bw: bandwidth consumption of all cores on socket + bandwidth for QPI accesses

At present, the MBM events are checked at one second interval provided by the HRTIMER of the MBM event. MBM counters can overflow atmost once in a second and thus must be read atleast once in a second. Overflow is detected and handled. Cumulative average value is calculated for each bandwidth type upon reading a new value from the MSR.

---
 arch/x86/include/asm/cpufeature.h          |   2 +
 arch/x86/kernel/cpu/common.c               |   5 +-
 arch/x86/kernel/cpu/perf_event_intel_cqm.c | 619 +++++++++++++++++++++++++++--
 3 files changed, 585 insertions(+), 41 deletions(-)
arch/x86/include/asm/cpufeature.h +2 -0
index 3d6606f..26505f6 100644
@@ -248,6 +248,8 @@
 
 /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (edx), word 11 */
 #define X86_FEATURE_CQM_LLC	(11*32+ 1) /* LLC QoS if 1 */
+#define X86_FEATURE_CQM_MBM_TOTAL (12*32+1) /* LLC Total MBM monitoring  */
+#define X86_FEATURE_CQM_MBM_LOCAL (12*32+2) /* LLC Local MBM monitoring  */
 
 /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (edx), word 12 */
 #define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0) /* LLC occupancy monitoring if 1 */
arch/x86/kernel/cpu/common.c +4 -1
index a62cf04..d046f46 100644
@@ -660,7 +660,10 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 			/* QoS sub-leaf, EAX=0Fh, ECX=1 */
 			cpuid_count(0x0000000F, 1, &eax, &ebx, &ecx, &edx);
 			c->x86_capability[12] = edx;
-			if (cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) {
+			if ((cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC))
+			      || ((cpu_has(c, X86_FEATURE_CQM_MBM_TOTAL))
+			      ||  (cpu_has(c, X86_FEATURE_CQM_MBM_LOCAL)))) {
+
 				c->x86_cache_max_rmid = ecx;
 				c->x86_cache_occ_scale = ebx;
 			}
arch/x86/kernel/cpu/perf_event_intel_cqm.c +579 -40

875 lines not on this page · raw message

Signature · 1 line
2.1.0