diff options
author | Don Zickus <dzickus@redhat.com> | 2006-09-26 04:52:27 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:27 -0400 |
commit | 2fbe7b25c8edaf2d10e6c1a4cc9f8afe714c4764 (patch) | |
tree | e4012ae3cd4519cba1836668237f077c60fb1086 /arch/i386/oprofile/nmi_int.c | |
parent | 957dc87c1bd849440f0eef27e2ade67387001e13 (diff) |
[PATCH] i386/x86-64: Remove un/set_nmi_callback and reserve/release_lapic_nmi functions
Removes the un/set_nmi_callback and reserve/release_lapic_nmi functions as
they are no longer needed. The various subsystems are modified to register
with the die_notifier instead.
Also includes compile fixes by Andrew Morton.
Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/oprofile/nmi_int.c')
-rw-r--r-- | arch/i386/oprofile/nmi_int.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c index 8710ca081b1e..b3610188bcf0 100644 --- a/arch/i386/oprofile/nmi_int.c +++ b/arch/i386/oprofile/nmi_int.c | |||
@@ -17,14 +17,15 @@ | |||
17 | #include <asm/nmi.h> | 17 | #include <asm/nmi.h> |
18 | #include <asm/msr.h> | 18 | #include <asm/msr.h> |
19 | #include <asm/apic.h> | 19 | #include <asm/apic.h> |
20 | #include <asm/kdebug.h> | ||
20 | 21 | ||
21 | #include "op_counter.h" | 22 | #include "op_counter.h" |
22 | #include "op_x86_model.h" | 23 | #include "op_x86_model.h" |
23 | 24 | ||
24 | static struct op_x86_model_spec const * model; | 25 | static struct op_x86_model_spec const * model; |
25 | static struct op_msrs cpu_msrs[NR_CPUS]; | 26 | static struct op_msrs cpu_msrs[NR_CPUS]; |
26 | static unsigned long saved_lvtpc[NR_CPUS]; | 27 | static unsigned long saved_lvtpc[NR_CPUS]; |
27 | 28 | ||
28 | static int nmi_start(void); | 29 | static int nmi_start(void); |
29 | static void nmi_stop(void); | 30 | static void nmi_stop(void); |
30 | 31 | ||
@@ -82,13 +83,24 @@ static void exit_driverfs(void) | |||
82 | #define exit_driverfs() do { } while (0) | 83 | #define exit_driverfs() do { } while (0) |
83 | #endif /* CONFIG_PM */ | 84 | #endif /* CONFIG_PM */ |
84 | 85 | ||
85 | 86 | int profile_exceptions_notify(struct notifier_block *self, | |
86 | static int nmi_callback(struct pt_regs * regs, int cpu) | 87 | unsigned long val, void *data) |
87 | { | 88 | { |
88 | return model->check_ctrs(regs, &cpu_msrs[cpu]); | 89 | struct die_args *args = (struct die_args *)data; |
90 | int ret = NOTIFY_DONE; | ||
91 | int cpu = smp_processor_id(); | ||
92 | |||
93 | switch(val) { | ||
94 | case DIE_NMI: | ||
95 | if (model->check_ctrs(args->regs, &cpu_msrs[cpu])) | ||
96 | ret = NOTIFY_STOP; | ||
97 | break; | ||
98 | default: | ||
99 | break; | ||
100 | } | ||
101 | return ret; | ||
89 | } | 102 | } |
90 | 103 | ||
91 | |||
92 | static void nmi_cpu_save_registers(struct op_msrs * msrs) | 104 | static void nmi_cpu_save_registers(struct op_msrs * msrs) |
93 | { | 105 | { |
94 | unsigned int const nr_ctrs = model->num_counters; | 106 | unsigned int const nr_ctrs = model->num_counters; |
@@ -174,27 +186,29 @@ static void nmi_cpu_setup(void * dummy) | |||
174 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 186 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
175 | } | 187 | } |
176 | 188 | ||
189 | static struct notifier_block profile_exceptions_nb = { | ||
190 | .notifier_call = profile_exceptions_notify, | ||
191 | .next = NULL, | ||
192 | .priority = 0 | ||
193 | }; | ||
177 | 194 | ||
178 | static int nmi_setup(void) | 195 | static int nmi_setup(void) |
179 | { | 196 | { |
197 | int err=0; | ||
198 | |||
180 | if (!allocate_msrs()) | 199 | if (!allocate_msrs()) |
181 | return -ENOMEM; | 200 | return -ENOMEM; |
182 | 201 | ||
183 | /* We walk a thin line between law and rape here. | 202 | if ((err = register_die_notifier(&profile_exceptions_nb))){ |
184 | * We need to be careful to install our NMI handler | ||
185 | * without actually triggering any NMIs as this will | ||
186 | * break the core code horrifically. | ||
187 | */ | ||
188 | if (reserve_lapic_nmi() < 0) { | ||
189 | free_msrs(); | 203 | free_msrs(); |
190 | return -EBUSY; | 204 | return err; |
191 | } | 205 | } |
206 | |||
192 | /* We need to serialize save and setup for HT because the subset | 207 | /* We need to serialize save and setup for HT because the subset |
193 | * of msrs are distinct for save and setup operations | 208 | * of msrs are distinct for save and setup operations |
194 | */ | 209 | */ |
195 | on_each_cpu(nmi_save_registers, NULL, 0, 1); | 210 | on_each_cpu(nmi_save_registers, NULL, 0, 1); |
196 | on_each_cpu(nmi_cpu_setup, NULL, 0, 1); | 211 | on_each_cpu(nmi_cpu_setup, NULL, 0, 1); |
197 | set_nmi_callback(nmi_callback); | ||
198 | nmi_enabled = 1; | 212 | nmi_enabled = 1; |
199 | return 0; | 213 | return 0; |
200 | } | 214 | } |
@@ -250,8 +264,7 @@ static void nmi_shutdown(void) | |||
250 | { | 264 | { |
251 | nmi_enabled = 0; | 265 | nmi_enabled = 0; |
252 | on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1); | 266 | on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1); |
253 | unset_nmi_callback(); | 267 | unregister_die_notifier(&profile_exceptions_nb); |
254 | release_lapic_nmi(); | ||
255 | free_msrs(); | 268 | free_msrs(); |
256 | } | 269 | } |
257 | 270 | ||