Skip to content

Commit 936c663

Browse files
author
Ingo Molnar
committed
Merge branch 'perf/x86' into perf/core, because it's ready
Signed-off-by: Ingo Molnar <[email protected]>
2 parents 072e5a1 + 50f16a8 commit 936c663

File tree

11 files changed

+1514
-63
lines changed

11 files changed

+1514
-63
lines changed

arch/arm/kernel/hw_breakpoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
648648
* Per-cpu breakpoints are not supported by our stepping
649649
* mechanism.
650650
*/
651-
if (!bp->hw.bp_target)
651+
if (!bp->hw.target)
652652
return -EINVAL;
653653

654654
/*

arch/arm64/kernel/hw_breakpoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
527527
* Disallow per-task kernel breakpoints since these would
528528
* complicate the stepping code.
529529
*/
530-
if (info->ctrl.privilege == AARCH64_BREAKPOINT_EL1 && bp->hw.bp_target)
530+
if (info->ctrl.privilege == AARCH64_BREAKPOINT_EL1 && bp->hw.target)
531531
return -EINVAL;
532532

533533
return 0;

arch/x86/include/asm/cpufeature.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <asm/disabled-features.h>
1313
#endif
1414

15-
#define NCAPINTS 11 /* N 32-bit words worth of info */
15+
#define NCAPINTS 13 /* N 32-bit words worth of info */
1616
#define NBUGINTS 1 /* N 32-bit bug flags */
1717

1818
/*
@@ -226,6 +226,7 @@
226226
#define X86_FEATURE_ERMS ( 9*32+ 9) /* Enhanced REP MOVSB/STOSB */
227227
#define X86_FEATURE_INVPCID ( 9*32+10) /* Invalidate Processor Context ID */
228228
#define X86_FEATURE_RTM ( 9*32+11) /* Restricted Transactional Memory */
229+
#define X86_FEATURE_CQM ( 9*32+12) /* Cache QoS Monitoring */
229230
#define X86_FEATURE_MPX ( 9*32+14) /* Memory Protection Extension */
230231
#define X86_FEATURE_AVX512F ( 9*32+16) /* AVX-512 Foundation */
231232
#define X86_FEATURE_RDSEED ( 9*32+18) /* The RDSEED instruction */
@@ -242,6 +243,12 @@
242243
#define X86_FEATURE_XGETBV1 (10*32+ 2) /* XGETBV with ECX = 1 */
243244
#define X86_FEATURE_XSAVES (10*32+ 3) /* XSAVES/XRSTORS */
244245

246+
/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (edx), word 11 */
247+
#define X86_FEATURE_CQM_LLC (11*32+ 1) /* LLC QoS if 1 */
248+
249+
/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (edx), word 12 */
250+
#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0) /* LLC occupancy monitoring if 1 */
251+
245252
/*
246253
* BUG word(s)
247254
*/

arch/x86/include/asm/processor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ struct cpuinfo_x86 {
109109
/* in KB - valid for CPUS which support this call: */
110110
int x86_cache_size;
111111
int x86_cache_alignment; /* In bytes */
112+
/* Cache QoS architectural values: */
113+
int x86_cache_max_rmid; /* max index */
114+
int x86_cache_occ_scale; /* scale to bytes */
112115
int x86_power;
113116
unsigned long loops_per_jiffy;
114117
/* cpuid returned max cores value: */

arch/x86/kernel/cpu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd_iommu.o
3939
endif
4040
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o
4141
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
42-
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o
42+
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o perf_event_intel_cqm.o
4343

4444
obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += perf_event_intel_uncore.o \
4545
perf_event_intel_uncore_snb.o \

arch/x86/kernel/cpu/common.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,30 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
646646
c->x86_capability[10] = eax;
647647
}
648648

649+
/* Additional Intel-defined flags: level 0x0000000F */
650+
if (c->cpuid_level >= 0x0000000F) {
651+
u32 eax, ebx, ecx, edx;
652+
653+
/* QoS sub-leaf, EAX=0Fh, ECX=0 */
654+
cpuid_count(0x0000000F, 0, &eax, &ebx, &ecx, &edx);
655+
c->x86_capability[11] = edx;
656+
if (cpu_has(c, X86_FEATURE_CQM_LLC)) {
657+
/* will be overridden if occupancy monitoring exists */
658+
c->x86_cache_max_rmid = ebx;
659+
660+
/* QoS sub-leaf, EAX=0Fh, ECX=1 */
661+
cpuid_count(0x0000000F, 1, &eax, &ebx, &ecx, &edx);
662+
c->x86_capability[12] = edx;
663+
if (cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) {
664+
c->x86_cache_max_rmid = ecx;
665+
c->x86_cache_occ_scale = ebx;
666+
}
667+
} else {
668+
c->x86_cache_max_rmid = -1;
669+
c->x86_cache_occ_scale = -1;
670+
}
671+
}
672+
649673
/* AMD-defined flags: level 0x80000001 */
650674
xlvl = cpuid_eax(0x80000000);
651675
c->extended_cpuid_level = xlvl;
@@ -834,6 +858,20 @@ static void generic_identify(struct cpuinfo_x86 *c)
834858
detect_nopl(c);
835859
}
836860

861+
static void x86_init_cache_qos(struct cpuinfo_x86 *c)
862+
{
863+
/*
864+
* The heavy lifting of max_rmid and cache_occ_scale are handled
865+
* in get_cpu_cap(). Here we just set the max_rmid for the boot_cpu
866+
* in case CQM bits really aren't there in this CPU.
867+
*/
868+
if (c != &boot_cpu_data) {
869+
boot_cpu_data.x86_cache_max_rmid =
870+
min(boot_cpu_data.x86_cache_max_rmid,
871+
c->x86_cache_max_rmid);
872+
}
873+
}
874+
837875
/*
838876
* This does the hard work of actually picking apart the CPU stuff...
839877
*/
@@ -923,6 +961,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)
923961

924962
init_hypervisor(c);
925963
x86_init_rdrand(c);
964+
x86_init_cache_qos(c);
926965

927966
/*
928967
* Clear/Set all flags overriden by options, need do it

0 commit comments

Comments
 (0)