x86/resctrl: Correct MBM total and local values
authorFenghua Yu <fenghua.yu@intel.com>
Wed, 14 Oct 2020 00:49:27 +0000 (00:49 +0000)
committerBorislav Petkov <bp@suse.de>
Tue, 27 Oct 2020 17:57:22 +0000 (18:57 +0100)
commit4868a61d498af3627c3b571aa48107a845001e51
tree50d045d4d80dde9aa5f3a4349ad333d48aa184f6
parentd1b22e36e3188f47dbf8aaef54d9e79df8e91f4c
x86/resctrl: Correct MBM total and local values

Intel Memory Bandwidth Monitoring (MBM) counters may report system
memory bandwidth incorrectly on some Intel processors. The errata SKX99
for Skylake server, BDF102 for Broadwell server, and the correction
factor table are documented in Documentation/x86/resctrl.rst.

Intel MBM counters track metrics according to the assigned Resource
Monitor ID (RMID) for that logical core. The IA32_QM_CTR register
(MSR 0xC8E) used to report these metrics, may report incorrect system
bandwidth for certain RMID values.

Due to the errata, system memory bandwidth may not match what is
reported.

To work around the errata, correct MBM total and local readings using a
correction factor table. If rmid > rmid threshold, MBM total and local
values should be multiplied by the correction factor.

 [ bp: Mark mbm_cf_table[] __initdata. ]

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20201014004927.1839452-3-fenghua.yu@intel.com
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/monitor.c