11 #include <linux/errno.h>
13 #include <linux/perf_event.h>
15 #ifdef CONFIG_OPROFILE_NMI_TIMER
18 static int ctr_running;
29 struct perf_sample_data *
data,
32 event->hw.interrupts = 0;
36 static int nmi_timer_start_cpu(
int cpu)
42 nmi_timer_callback,
NULL);
44 return PTR_ERR(
event);
48 if (
event && ctr_running)
54 static void nmi_timer_stop_cpu(
int cpu)
58 if (
event && ctr_running)
65 int cpu = (
unsigned long)data;
69 nmi_timer_start_cpu(cpu);
72 nmi_timer_stop_cpu(cpu);
82 static int nmi_timer_start(
void)
89 nmi_timer_start_cpu(cpu);
95 static
void nmi_timer_stop(
void)
101 nmi_timer_stop_cpu(cpu);
106 static
void nmi_timer_shutdown(
void)
112 unregister_cpu_notifier(&nmi_timer_cpu_nb);
114 event =
per_cpu(nmi_timer_events, cpu);
125 static int nmi_timer_setup(
void)
136 err = register_cpu_notifier(&nmi_timer_cpu_nb);
141 err = nmi_timer_start_cpu(cpu);
146 nmi_timer_shutdown();
156 err = nmi_timer_setup();
159 nmi_timer_shutdown();
162 ops->
setup = nmi_timer_setup;
164 ops->
start = nmi_timer_start;
165 ops->
stop = nmi_timer_stop;