blob: 1f11cf0a307f448e777f5a132e0de15ebc4ca7a3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
2 * @file nmi_int.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
10#include <linux/init.h>
11#include <linux/notifier.h>
12#include <linux/smp.h>
13#include <linux/oprofile.h>
14#include <linux/sysdev.h>
15#include <linux/slab.h>
Andi Kleen1cfcea12006-07-10 17:06:21 +020016#include <linux/moduleparam.h>
Christoph Hellwig1eeb66a2007-05-08 00:27:03 -070017#include <linux/kdebug.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/nmi.h>
19#include <asm/msr.h>
20#include <asm/apic.h>
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +010021
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include "op_counter.h"
23#include "op_x86_model.h"
Don Zickus2fbe7b22006-09-26 10:52:27 +020024
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +010025static struct op_x86_model_spec const *model;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026static struct op_msrs cpu_msrs[NR_CPUS];
27static unsigned long saved_lvtpc[NR_CPUS];
Don Zickus2fbe7b22006-09-26 10:52:27 +020028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029static int nmi_start(void);
30static void nmi_stop(void);
31
32/* 0 == registered but off, 1 == registered and on */
33static int nmi_enabled = 0;
34
35#ifdef CONFIG_PM
36
Pavel Machek438510f2005-04-16 15:25:24 -070037static int nmi_suspend(struct sys_device *dev, pm_message_t state)
Linus Torvalds1da177e2005-04-16 15:20:36 -070038{
39 if (nmi_enabled == 1)
40 nmi_stop();
41 return 0;
42}
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044static int nmi_resume(struct sys_device *dev)
45{
46 if (nmi_enabled == 1)
47 nmi_start();
48 return 0;
49}
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051static struct sysdev_class oprofile_sysclass = {
Kay Sieversaf5ca3f2007-12-20 02:09:39 +010052 .name = "oprofile",
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 .resume = nmi_resume,
54 .suspend = nmi_suspend,
55};
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057static struct sys_device device_oprofile = {
58 .id = 0,
59 .cls = &oprofile_sysclass,
60};
61
Robert P. J. Day405ae7d2007-02-17 19:13:42 +010062static int __init init_sysfs(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070063{
64 int error;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +010065
66 error = sysdev_class_register(&oprofile_sysclass);
67 if (!error)
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 error = sysdev_register(&device_oprofile);
69 return error;
70}
71
Robert P. J. Day405ae7d2007-02-17 19:13:42 +010072static void exit_sysfs(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070073{
74 sysdev_unregister(&device_oprofile);
75 sysdev_class_unregister(&oprofile_sysclass);
76}
77
78#else
Robert P. J. Day405ae7d2007-02-17 19:13:42 +010079#define init_sysfs() do { } while (0)
80#define exit_sysfs() do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070081#endif /* CONFIG_PM */
82
Adrian Bunkc7c19f82006-09-26 10:52:27 +020083static int profile_exceptions_notify(struct notifier_block *self,
84 unsigned long val, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085{
Don Zickus2fbe7b22006-09-26 10:52:27 +020086 struct die_args *args = (struct die_args *)data;
87 int ret = NOTIFY_DONE;
88 int cpu = smp_processor_id();
89
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +010090 switch (val) {
Don Zickus2fbe7b22006-09-26 10:52:27 +020091 case DIE_NMI:
92 if (model->check_ctrs(args->regs, &cpu_msrs[cpu]))
93 ret = NOTIFY_STOP;
94 break;
95 default:
96 break;
97 }
98 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099}
Don Zickus2fbe7b22006-09-26 10:52:27 +0200100
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100101static void nmi_cpu_save_registers(struct op_msrs *msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102{
103 unsigned int const nr_ctrs = model->num_counters;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100104 unsigned int const nr_ctrls = model->num_controls;
105 struct op_msr *counters = msrs->counters;
106 struct op_msr *controls = msrs->controls;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 unsigned int i;
108
109 for (i = 0; i < nr_ctrs; ++i) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100110 if (counters[i].addr) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200111 rdmsr(counters[i].addr,
112 counters[i].saved.low,
113 counters[i].saved.high);
114 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 }
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117 for (i = 0; i < nr_ctrls; ++i) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100118 if (controls[i].addr) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200119 rdmsr(controls[i].addr,
120 controls[i].saved.low,
121 controls[i].saved.high);
122 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 }
124}
125
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100126static void nmi_save_registers(void *dummy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127{
128 int cpu = smp_processor_id();
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100129 struct op_msrs *msrs = &cpu_msrs[cpu];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 nmi_cpu_save_registers(msrs);
131}
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133static void free_msrs(void)
134{
135 int i;
KAMEZAWA Hiroyukic8912592006-03-28 01:56:39 -0800136 for_each_possible_cpu(i) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 kfree(cpu_msrs[i].counters);
138 cpu_msrs[i].counters = NULL;
139 kfree(cpu_msrs[i].controls);
140 cpu_msrs[i].controls = NULL;
141 }
142}
143
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144static int allocate_msrs(void)
145{
146 int success = 1;
147 size_t controls_size = sizeof(struct op_msr) * model->num_controls;
148 size_t counters_size = sizeof(struct op_msr) * model->num_counters;
149
150 int i;
Chris Wright0939c172007-06-01 00:46:39 -0700151 for_each_possible_cpu(i) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL);
153 if (!cpu_msrs[i].counters) {
154 success = 0;
155 break;
156 }
157 cpu_msrs[i].controls = kmalloc(controls_size, GFP_KERNEL);
158 if (!cpu_msrs[i].controls) {
159 success = 0;
160 break;
161 }
162 }
163
164 if (!success)
165 free_msrs();
166
167 return success;
168}
169
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100170static void nmi_cpu_setup(void *dummy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171{
172 int cpu = smp_processor_id();
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100173 struct op_msrs *msrs = &cpu_msrs[cpu];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174 spin_lock(&oprofilefs_lock);
175 model->setup_ctrs(msrs);
176 spin_unlock(&oprofilefs_lock);
177 saved_lvtpc[cpu] = apic_read(APIC_LVTPC);
178 apic_write(APIC_LVTPC, APIC_DM_NMI);
179}
180
Don Zickus2fbe7b22006-09-26 10:52:27 +0200181static struct notifier_block profile_exceptions_nb = {
182 .notifier_call = profile_exceptions_notify,
183 .next = NULL,
184 .priority = 0
185};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
187static int nmi_setup(void)
188{
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100189 int err = 0;
Andi Kleen6c977aa2007-05-21 14:31:45 +0200190 int cpu;
Don Zickus2fbe7b22006-09-26 10:52:27 +0200191
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 if (!allocate_msrs())
193 return -ENOMEM;
194
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100195 err = register_die_notifier(&profile_exceptions_nb);
196 if (err) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 free_msrs();
Don Zickus2fbe7b22006-09-26 10:52:27 +0200198 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199 }
Don Zickus2fbe7b22006-09-26 10:52:27 +0200200
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 /* We need to serialize save and setup for HT because the subset
202 * of msrs are distinct for save and setup operations
203 */
Andi Kleen6c977aa2007-05-21 14:31:45 +0200204
205 /* Assume saved/restored counters are the same on all CPUs */
206 model->fill_in_addresses(&cpu_msrs[0]);
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100207 for_each_possible_cpu(cpu) {
Chris Wright0939c172007-06-01 00:46:39 -0700208 if (cpu != 0) {
209 memcpy(cpu_msrs[cpu].counters, cpu_msrs[0].counters,
210 sizeof(struct op_msr) * model->num_counters);
211
212 memcpy(cpu_msrs[cpu].controls, cpu_msrs[0].controls,
213 sizeof(struct op_msr) * model->num_controls);
214 }
215
Andi Kleen6c977aa2007-05-21 14:31:45 +0200216 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 on_each_cpu(nmi_save_registers, NULL, 0, 1);
218 on_each_cpu(nmi_cpu_setup, NULL, 0, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 nmi_enabled = 1;
220 return 0;
221}
222
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100223static void nmi_restore_registers(struct op_msrs *msrs)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224{
225 unsigned int const nr_ctrs = model->num_counters;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100226 unsigned int const nr_ctrls = model->num_controls;
227 struct op_msr *counters = msrs->counters;
228 struct op_msr *controls = msrs->controls;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 unsigned int i;
230
231 for (i = 0; i < nr_ctrls; ++i) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100232 if (controls[i].addr) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200233 wrmsr(controls[i].addr,
234 controls[i].saved.low,
235 controls[i].saved.high);
236 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 }
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 for (i = 0; i < nr_ctrs; ++i) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100240 if (counters[i].addr) {
Don Zickuscb9c4482006-09-26 10:52:26 +0200241 wrmsr(counters[i].addr,
242 counters[i].saved.low,
243 counters[i].saved.high);
244 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 }
246}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100248static void nmi_cpu_shutdown(void *dummy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
250 unsigned int v;
251 int cpu = smp_processor_id();
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100252 struct op_msrs *msrs = &cpu_msrs[cpu];
253
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 /* restoring APIC_LVTPC can trigger an apic error because the delivery
255 * mode and vector nr combination can be illegal. That's by design: on
256 * power on apic lvt contain a zero vector nr which are legal only for
257 * NMI delivery mode. So inhibit apic err before restoring lvtpc
258 */
259 v = apic_read(APIC_LVTERR);
260 apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
261 apic_write(APIC_LVTPC, saved_lvtpc[cpu]);
262 apic_write(APIC_LVTERR, v);
263 nmi_restore_registers(msrs);
264}
265
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266static void nmi_shutdown(void)
267{
268 nmi_enabled = 0;
269 on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1);
Don Zickus2fbe7b22006-09-26 10:52:27 +0200270 unregister_die_notifier(&profile_exceptions_nb);
Stephane Eranian0f8e45a2007-10-17 18:04:32 +0200271 model->shutdown(cpu_msrs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 free_msrs();
273}
274
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100275static void nmi_cpu_start(void *dummy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276{
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100277 struct op_msrs const *msrs = &cpu_msrs[smp_processor_id()];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 model->start(msrs);
279}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280
281static int nmi_start(void)
282{
283 on_each_cpu(nmi_cpu_start, NULL, 0, 1);
284 return 0;
285}
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100286
287static void nmi_cpu_stop(void *dummy)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288{
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100289 struct op_msrs const *msrs = &cpu_msrs[smp_processor_id()];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 model->stop(msrs);
291}
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100292
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293static void nmi_stop(void)
294{
295 on_each_cpu(nmi_cpu_stop, NULL, 0, 1);
296}
297
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298struct op_counter_config counter_config[OP_MAX_COUNTER];
299
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100300static int nmi_create_files(struct super_block *sb, struct dentry *root)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301{
302 unsigned int i;
303
304 for (i = 0; i < model->num_counters; ++i) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100305 struct dentry *dir;
Markus Armbruster0c6856f2006-06-26 00:24:34 -0700306 char buf[4];
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100307
308 /* quick little hack to _not_ expose a counter if it is not
Don Zickuscb9c4482006-09-26 10:52:26 +0200309 * available for use. This should protect userspace app.
310 * NOTE: assumes 1:1 mapping here (that counters are organized
311 * sequentially in their struct assignment).
312 */
313 if (unlikely(!avail_to_resrv_perfctr_nmi_bit(i)))
314 continue;
315
Markus Armbruster0c6856f2006-06-26 00:24:34 -0700316 snprintf(buf, sizeof(buf), "%d", i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 dir = oprofilefs_mkdir(sb, root, buf);
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100318 oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled);
319 oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event);
320 oprofilefs_create_ulong(sb, dir, "count", &counter_config[i].count);
321 oprofilefs_create_ulong(sb, dir, "unit_mask", &counter_config[i].unit_mask);
322 oprofilefs_create_ulong(sb, dir, "kernel", &counter_config[i].kernel);
323 oprofilefs_create_ulong(sb, dir, "user", &counter_config[i].user);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 }
325
326 return 0;
327}
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100328
Andi Kleen1cfcea12006-07-10 17:06:21 +0200329static int p4force;
330module_param(p4force, int, 0);
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100331
332static int __init p4_init(char **cpu_type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333{
334 __u8 cpu_model = boot_cpu_data.x86_model;
335
Andi Kleen1cfcea12006-07-10 17:06:21 +0200336 if (!p4force && (cpu_model > 6 || cpu_model == 5))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 return 0;
338
339#ifndef CONFIG_SMP
340 *cpu_type = "i386/p4";
341 model = &op_p4_spec;
342 return 1;
343#else
344 switch (smp_num_siblings) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100345 case 1:
346 *cpu_type = "i386/p4";
347 model = &op_p4_spec;
348 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100350 case 2:
351 *cpu_type = "i386/p4-ht";
352 model = &op_p4_ht2_spec;
353 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 }
355#endif
356
357 printk(KERN_INFO "oprofile: P4 HyperThreading detected with > 2 threads\n");
358 printk(KERN_INFO "oprofile: Reverting to timer mode.\n");
359 return 0;
360}
361
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100362static int __init ppro_init(char **cpu_type)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363{
364 __u8 cpu_model = boot_cpu_data.x86_model;
365
Benjamin LaHaise64471eb2006-05-15 09:44:24 -0700366 if (cpu_model == 14)
367 *cpu_type = "i386/core";
Arjan van de Vene107ebe2008-01-18 22:49:33 +0100368 else if (cpu_model == 15 || cpu_model == 23)
Benjamin LaHaisef04b92e2006-09-16 16:35:46 -0700369 *cpu_type = "i386/core_2";
Benjamin LaHaise64471eb2006-05-15 09:44:24 -0700370 else if (cpu_model > 0xd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 return 0;
Benjamin LaHaise64471eb2006-05-15 09:44:24 -0700372 else if (cpu_model == 9) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373 *cpu_type = "i386/p6_mobile";
374 } else if (cpu_model > 5) {
375 *cpu_type = "i386/piii";
376 } else if (cpu_model > 2) {
377 *cpu_type = "i386/pii";
378 } else {
379 *cpu_type = "i386/ppro";
380 }
381
382 model = &op_ppro_spec;
383 return 1;
384}
385
Robert P. J. Day405ae7d2007-02-17 19:13:42 +0100386/* in order to get sysfs right */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387static int using_nmi;
388
David Gibson96d08212005-09-06 15:17:26 -0700389int __init op_nmi_init(struct oprofile_operations *ops)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390{
391 __u8 vendor = boot_cpu_data.x86_vendor;
392 __u8 family = boot_cpu_data.x86;
393 char *cpu_type;
394
395 if (!cpu_has_apic)
396 return -ENODEV;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100397
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398 switch (vendor) {
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100399 case X86_VENDOR_AMD:
400 /* Needs to be at least an Athlon (or hammer in 32bit mode) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100402 switch (family) {
403 default:
404 return -ENODEV;
405 case 6:
406 model = &op_athlon_spec;
407 cpu_type = "i386/athlon";
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 break;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100409 case 0xf:
410 model = &op_athlon_spec;
411 /* Actually it could be i386/hammer too, but give
412 user space an consistent name. */
413 cpu_type = "x86-64/hammer";
414 break;
415 case 0x10:
416 model = &op_athlon_spec;
417 cpu_type = "x86-64/family10";
418 break;
419 }
420 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100422 case X86_VENDOR_INTEL:
423 switch (family) {
424 /* Pentium IV */
425 case 0xf:
426 if (!p4_init(&cpu_type))
427 return -ENODEV;
428 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100430 /* A P6-class processor */
431 case 6:
432 if (!ppro_init(&cpu_type))
433 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 break;
435
436 default:
437 return -ENODEV;
Carlos R. Mafrab75f53d2008-01-30 13:32:33 +0100438 }
439 break;
440
441 default:
442 return -ENODEV;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443 }
444
Robert P. J. Day405ae7d2007-02-17 19:13:42 +0100445 init_sysfs();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 using_nmi = 1;
447 ops->create_files = nmi_create_files;
448 ops->setup = nmi_setup;
449 ops->shutdown = nmi_shutdown;
450 ops->start = nmi_start;
451 ops->stop = nmi_stop;
452 ops->cpu_type = cpu_type;
453 printk(KERN_INFO "oprofile: using NMI interrupt.\n");
454 return 0;
455}
456
David Gibson96d08212005-09-06 15:17:26 -0700457void op_nmi_exit(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458{
459 if (using_nmi)
Robert P. J. Day405ae7d2007-02-17 19:13:42 +0100460 exit_sysfs();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461}