aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/perf_counter.c')
-rw-r--r--arch/x86/kernel/cpu/perf_counter.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 2eeaa99add1c..316b0c995f38 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -604,7 +604,7 @@ try_generic:
604 hwc->counter_base = x86_pmu.perfctr; 604 hwc->counter_base = x86_pmu.perfctr;
605 } 605 }
606 606
607 perf_counters_lapic_init(hwc->nmi); 607 perf_counters_lapic_init();
608 608
609 x86_pmu.disable(hwc, idx); 609 x86_pmu.disable(hwc, idx);
610 610
@@ -863,24 +863,15 @@ void set_perf_counter_pending(void)
863 apic->send_IPI_self(LOCAL_PENDING_VECTOR); 863 apic->send_IPI_self(LOCAL_PENDING_VECTOR);
864} 864}
865 865
866void perf_counters_lapic_init(int nmi) 866void perf_counters_lapic_init(void)
867{ 867{
868 u32 apic_val;
869
870 if (!x86_pmu_initialized()) 868 if (!x86_pmu_initialized())
871 return; 869 return;
872 870
873 /* 871 /*
874 * Enable the performance counter vector in the APIC LVT: 872 * Always use NMI for PMU
875 */ 873 */
876 apic_val = apic_read(APIC_LVTERR); 874 apic_write(APIC_LVTPC, APIC_DM_NMI);
877
878 apic_write(APIC_LVTERR, apic_val | APIC_LVT_MASKED);
879 if (nmi)
880 apic_write(APIC_LVTPC, APIC_DM_NMI);
881 else
882 apic_write(APIC_LVTPC, LOCAL_PERF_VECTOR);
883 apic_write(APIC_LVTERR, apic_val);
884} 875}
885 876
886static int __kprobes 877static int __kprobes
@@ -1054,7 +1045,7 @@ void __init init_hw_perf_counters(void)
1054 1045
1055 pr_info("... counter mask: %016Lx\n", perf_counter_mask); 1046 pr_info("... counter mask: %016Lx\n", perf_counter_mask);
1056 1047
1057 perf_counters_lapic_init(0); 1048 perf_counters_lapic_init();
1058 register_die_notifier(&perf_counter_nmi_notifier); 1049 register_die_notifier(&perf_counter_nmi_notifier);
1059} 1050}
1060 1051