]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/x86/kernel/cpu/perf_event_intel.c
perf, x86: Clear the LBRs on init
[net-next-2.6.git] / arch / x86 / kernel / cpu / perf_event_intel.c
index 224c952071f9ce184d21da39d23481f81cd8fe9e..c135ed735b223f1640f581598a5158ca8f8e73f5 100644 (file)
@@ -767,6 +767,20 @@ static __initconst struct x86_pmu core_pmu = {
        .event_constraints      = intel_core_event_constraints,
 };
 
+static void intel_pmu_cpu_starting(int cpu)
+{
+       init_debug_store_on_cpu(cpu);
+       /*
+        * Deal with CPUs that don't clear their LBRs on power-up.
+        */
+       intel_pmu_lbr_reset();
+}
+
+static void intel_pmu_cpu_dying(int cpu)
+{
+       fini_debug_store_on_cpu(cpu);
+}
+
 static __initconst struct x86_pmu intel_pmu = {
        .name                   = "Intel",
        .handle_irq             = intel_pmu_handle_irq,
@@ -788,8 +802,8 @@ static __initconst struct x86_pmu intel_pmu = {
        .max_period             = (1ULL << 31) - 1,
        .get_event_constraints  = intel_get_event_constraints,
 
-       .cpu_starting           = init_debug_store_on_cpu,
-       .cpu_dying              = fini_debug_store_on_cpu,
+       .cpu_starting           = intel_pmu_cpu_starting,
+       .cpu_dying              = intel_pmu_cpu_dying,
 };
 
 static void intel_clovertown_quirks(void)