aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-09-09 17:53:59 -0400
committerIngo Molnar <mingo@kernel.org>2015-09-18 03:20:22 -0400
commitd0dc8494cd6904f8ad035d9ad97f313948f35d0c (patch)
tree2d75bb8c78333700c0ddba069911d6fe394475a4
parent5e176213a6b2bc5146820c79542d37290434a3c4 (diff)
perf/x86/intel/pebs: Add PEBS frontend profiling for Skylake
Skylake has a new FRONTEND_LATENCY PEBS event to accurately profile frontend problems (like ITLB or decoding issues). The new event is configured through a separate MSR, which selects a range of sub events. Define the extra MSR as a extra reg and export support for it through sysfs. To avoid duplicating the existing tables use a new function to add new entries to existing tables. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1435707205-6676-4-git-send-email-andi@firstfloor.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/msr-index.h2
-rw-r--r--arch/x86/kernel/cpu/perf_event.h1
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c11
3 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index c1c0a1c14344..54390bc140dd 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -141,6 +141,8 @@
141#define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10) 141#define DEBUGCTLMSR_BTS_OFF_USR (1UL << 10)
142#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11) 142#define DEBUGCTLMSR_FREEZE_LBRS_ON_PMI (1UL << 11)
143 143
144#define MSR_PEBS_FRONTEND 0x000003f7
145
144#define MSR_IA32_POWER_CTL 0x000001fc 146#define MSR_IA32_POWER_CTL 0x000001fc
145 147
146#define MSR_IA32_MC0_CTL 0x00000400 148#define MSR_IA32_MC0_CTL 0x00000400
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 5edf6d868fc1..165be83a7fa4 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -47,6 +47,7 @@ enum extra_reg_type {
47 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */ 47 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
48 EXTRA_REG_LBR = 2, /* lbr_select */ 48 EXTRA_REG_LBR = 2, /* lbr_select */
49 EXTRA_REG_LDLAT = 3, /* ld_lat_threshold */ 49 EXTRA_REG_LDLAT = 3, /* ld_lat_threshold */
50 EXTRA_REG_FE = 4, /* fe_* */
50 51
51 EXTRA_REG_MAX /* number of entries needed */ 52 EXTRA_REG_MAX /* number of entries needed */
52}; 53};
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 1d84b41ba932..ef74c9d05f82 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -205,6 +205,7 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {
205 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), 205 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0),
206 INTEL_UEVENT_EXTRA_REG(0x01bb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), 206 INTEL_UEVENT_EXTRA_REG(0x01bb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1),
207 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), 207 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
208 INTEL_UEVENT_EXTRA_REG(0x01c6, MSR_PEBS_FRONTEND, 0x3fff17, FE),
208 EVENT_EXTRA_END 209 EVENT_EXTRA_END
209}; 210};
210 211
@@ -2891,6 +2892,8 @@ PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63");
2891 2892
2892PMU_FORMAT_ATTR(ldlat, "config1:0-15"); 2893PMU_FORMAT_ATTR(ldlat, "config1:0-15");
2893 2894
2895PMU_FORMAT_ATTR(frontend, "config1:0-23");
2896
2894static struct attribute *intel_arch3_formats_attr[] = { 2897static struct attribute *intel_arch3_formats_attr[] = {
2895 &format_attr_event.attr, 2898 &format_attr_event.attr,
2896 &format_attr_umask.attr, 2899 &format_attr_umask.attr,
@@ -2907,6 +2910,11 @@ static struct attribute *intel_arch3_formats_attr[] = {
2907 NULL, 2910 NULL,
2908}; 2911};
2909 2912
2913static struct attribute *skl_format_attr[] = {
2914 &format_attr_frontend.attr,
2915 NULL,
2916};
2917
2910static __initconst const struct x86_pmu core_pmu = { 2918static __initconst const struct x86_pmu core_pmu = {
2911 .name = "core", 2919 .name = "core",
2912 .handle_irq = x86_pmu_handle_irq, 2920 .handle_irq = x86_pmu_handle_irq,
@@ -3516,7 +3524,8 @@ __init int intel_pmu_init(void)
3516 3524
3517 x86_pmu.hw_config = hsw_hw_config; 3525 x86_pmu.hw_config = hsw_hw_config;
3518 x86_pmu.get_event_constraints = hsw_get_event_constraints; 3526 x86_pmu.get_event_constraints = hsw_get_event_constraints;
3519 x86_pmu.cpu_events = hsw_events_attrs; 3527 x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr,
3528 skl_format_attr);
3520 WARN_ON(!x86_pmu.format_attrs); 3529 WARN_ON(!x86_pmu.format_attrs);
3521 x86_pmu.cpu_events = hsw_events_attrs; 3530 x86_pmu.cpu_events = hsw_events_attrs;
3522 pr_cont("Skylake events, "); 3531 pr_cont("Skylake events, ");