Skip to content

Commit 78335aa

Browse files
babumogerbp3tk0v
authored andcommitted
x86/cpufeatures: Add Bandwidth Monitoring Event Configuration feature flag
Newer AMD processors support the new feature Bandwidth Monitoring Event Configuration (BMEC). The feature support is identified via CPUID Fn8000_0020_EBX_x0[3]: EVT_CFG - Bandwidth Monitoring Event Configuration (BMEC) The bandwidth monitoring events mbm_total_bytes and mbm_local_bytes are set to count all the total and local reads/writes, respectively. With the introduction of slow memory, the two counters are not enough to count all the different types of memory events. Therefore, BMEC provides the option to configure mbm_total_bytes and mbm_local_bytes to count the specific type of events. Each BMEC event has a configuration MSR which contains one field for each bandwidth type that can be used to configure the bandwidth event to track any combination of supported bandwidth types. The event will count requests from every bandwidth type bit that is set in the corresponding configuration register. Following are the types of events supported: ==== ======================================================== Bits Description ==== ======================================================== 6 Dirty Victims from the QOS domain to all types of memory 5 Reads to slow memory in the non-local NUMA domain 4 Reads to slow memory in the local NUMA domain 3 Non-temporal writes to non-local NUMA domain 2 Non-temporal writes to local NUMA domain 1 Reads to memory in the non-local NUMA domain 0 Reads to memory in the local NUMA domain ==== ======================================================== By default, the mbm_total_bytes configuration is set to 0x7F to count all the event types and the mbm_local_bytes configuration is set to 0x15 to count all the local memory events. Feature description is available in the specification, "AMD64 Technology Platform Quality of Service Extensions, Revision: 1.03 Publication" at https://bugzilla.kernel.org/attachment.cgi?id=301365 Signed-off-by: Babu Moger <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a5b6996 commit 78335aa

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
#define X86_FEATURE_CALL_DEPTH (11*32+19) /* "" Call depth tracking for RSB stuffing */
309309
#define X86_FEATURE_MSR_TSX_CTRL (11*32+20) /* "" MSR IA32_TSX_CTRL (Intel) implemented */
310310
#define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */
311+
#define X86_FEATURE_BMEC (11*32+22) /* "" Bandwidth Monitoring Event Configuration */
311312

312313
/* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
313314
#define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */

arch/x86/kernel/cpu/cpuid-deps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static const struct cpuid_dep cpuid_deps[] = {
6868
{ X86_FEATURE_CQM_OCCUP_LLC, X86_FEATURE_CQM_LLC },
6969
{ X86_FEATURE_CQM_MBM_TOTAL, X86_FEATURE_CQM_LLC },
7070
{ X86_FEATURE_CQM_MBM_LOCAL, X86_FEATURE_CQM_LLC },
71+
{ X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_TOTAL },
72+
{ X86_FEATURE_BMEC, X86_FEATURE_CQM_MBM_LOCAL },
7173
{ X86_FEATURE_AVX512_BF16, X86_FEATURE_AVX512VL },
7274
{ X86_FEATURE_AVX512_FP16, X86_FEATURE_AVX512BW },
7375
{ X86_FEATURE_ENQCMD, X86_FEATURE_XSAVES },

arch/x86/kernel/cpu/scattered.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static const struct cpuid_bit cpuid_bits[] = {
4646
{ X86_FEATURE_PROC_FEEDBACK, CPUID_EDX, 11, 0x80000007, 0 },
4747
{ X86_FEATURE_MBA, CPUID_EBX, 6, 0x80000008, 0 },
4848
{ X86_FEATURE_SMBA, CPUID_EBX, 2, 0x80000020, 0 },
49+
{ X86_FEATURE_BMEC, CPUID_EBX, 3, 0x80000020, 0 },
4950
{ X86_FEATURE_PERFMON_V2, CPUID_EAX, 0, 0x80000022, 0 },
5051
{ X86_FEATURE_AMD_LBR_V2, CPUID_EAX, 1, 0x80000022, 0 },
5152
{ 0, 0, 0, 0, 0 }

0 commit comments

Comments
 (0)