aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event_intel.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-03 06:02:30 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-10 07:23:32 -0500
commitcaff2befffe899e63df5cc760b7ed01cfd902685 (patch)
treefe07f997bd67d1e5ae3122db789d7e7361ddca28 /arch/x86/kernel/cpu/perf_event_intel.c
parent69fef0d2e2c2c049ef4207a52e78b50d527bd85a (diff)
perf, x86: Implement simple LBR support
Implement simple suport Intel Last-Branch-Record, it supports all hardware that implements FREEZE_LBRS_ON_PMI, but does not (yet) implement the LBR config register. The Intel LBR is a FIFO of From,To addresses describing the last few branches the hardware took. This patch does not add perf interface to the LBR, but merely provides an interface for internal use. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: paulus@samba.org Cc: eranian@google.com Cc: robert.richter@amd.com Cc: fweisbec@gmail.com LKML-Reference: <20100304140100.544191154@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event_intel.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 11446412e4c..44f6ed42a93 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -480,6 +480,7 @@ static void intel_pmu_disable_all(void)
480 intel_pmu_disable_bts(); 480 intel_pmu_disable_bts();
481 481
482 intel_pmu_pebs_disable_all(); 482 intel_pmu_pebs_disable_all();
483 intel_pmu_lbr_disable_all();
483} 484}
484 485
485static void intel_pmu_enable_all(void) 486static void intel_pmu_enable_all(void)
@@ -499,6 +500,7 @@ static void intel_pmu_enable_all(void)
499 } 500 }
500 501
501 intel_pmu_pebs_enable_all(); 502 intel_pmu_pebs_enable_all();
503 intel_pmu_lbr_enable_all();
502} 504}
503 505
504static inline u64 intel_pmu_get_status(void) 506static inline u64 intel_pmu_get_status(void)
@@ -674,6 +676,8 @@ again:
674 inc_irq_stat(apic_perf_irqs); 676 inc_irq_stat(apic_perf_irqs);
675 ack = status; 677 ack = status;
676 678
679 intel_pmu_lbr_read();
680
677 /* 681 /*
678 * PEBS overflow sets bit 62 in the global status register 682 * PEBS overflow sets bit 62 in the global status register
679 */ 683 */
@@ -848,6 +852,8 @@ static __init int intel_pmu_init(void)
848 memcpy(hw_cache_event_ids, core2_hw_cache_event_ids, 852 memcpy(hw_cache_event_ids, core2_hw_cache_event_ids,
849 sizeof(hw_cache_event_ids)); 853 sizeof(hw_cache_event_ids));
850 854
855 intel_pmu_lbr_init_core();
856
851 x86_pmu.event_constraints = intel_core2_event_constraints; 857 x86_pmu.event_constraints = intel_core2_event_constraints;
852 pr_cont("Core2 events, "); 858 pr_cont("Core2 events, ");
853 break; 859 break;
@@ -857,13 +863,18 @@ static __init int intel_pmu_init(void)
857 memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids, 863 memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
858 sizeof(hw_cache_event_ids)); 864 sizeof(hw_cache_event_ids));
859 865
866 intel_pmu_lbr_init_nhm();
867
860 x86_pmu.event_constraints = intel_nehalem_event_constraints; 868 x86_pmu.event_constraints = intel_nehalem_event_constraints;
861 pr_cont("Nehalem/Corei7 events, "); 869 pr_cont("Nehalem/Corei7 events, ");
862 break; 870 break;
871
863 case 28: /* Atom */ 872 case 28: /* Atom */
864 memcpy(hw_cache_event_ids, atom_hw_cache_event_ids, 873 memcpy(hw_cache_event_ids, atom_hw_cache_event_ids,
865 sizeof(hw_cache_event_ids)); 874 sizeof(hw_cache_event_ids));
866 875
876 intel_pmu_lbr_init_atom();
877
867 x86_pmu.event_constraints = intel_gen_event_constraints; 878 x86_pmu.event_constraints = intel_gen_event_constraints;
868 pr_cont("Atom events, "); 879 pr_cont("Atom events, ");
869 break; 880 break;
@@ -873,6 +884,8 @@ static __init int intel_pmu_init(void)
873 memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, 884 memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
874 sizeof(hw_cache_event_ids)); 885 sizeof(hw_cache_event_ids));
875 886
887 intel_pmu_lbr_init_nhm();
888
876 x86_pmu.event_constraints = intel_westmere_event_constraints; 889 x86_pmu.event_constraints = intel_westmere_event_constraints;
877 pr_cont("Westmere events, "); 890 pr_cont("Westmere events, ");
878 break; 891 break;