From: Philippe Elie From: Zwane Mwaikambo The nmi_timer_int oprofile driver was enabling itself unconditionally if an SMP kernel was being used on a UP system without an IOAPIC. Tested on a P5 using NMI timer int driver and UP system using timer int driver both running an SMP kernel. 2004-02-11 Zwane Mwaikambo * arch/i386/kernel/nmi.c: export nmi_active * arch/i386/oprofile/nmi_timer_int.c: use it to check if owe can use an nmi interrupt --- 25-akpm/arch/i386/kernel/nmi.c | 3 ++- 25-akpm/arch/i386/oprofile/nmi_timer_int.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff -puN arch/i386/kernel/nmi.c~oprofile-nmi_timer_int-fix arch/i386/kernel/nmi.c --- 25/arch/i386/kernel/nmi.c~oprofile-nmi_timer_int-fix Wed Feb 11 18:36:39 2004 +++ 25-akpm/arch/i386/kernel/nmi.c Wed Feb 11 18:36:39 2004 @@ -51,7 +51,7 @@ extern void show_registers(struct pt_reg * be enabled * -1: the lapic NMI watchdog is disabled, but can be enabled */ -static int nmi_active; +int nmi_active; #define K7_EVNTSEL_ENABLE (1 << 22) #define K7_EVNTSEL_INT (1 << 20) @@ -486,6 +486,7 @@ void nmi_watchdog_tick (struct pt_regs * } } +EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(disable_lapic_nmi_watchdog); EXPORT_SYMBOL(enable_lapic_nmi_watchdog); diff -puN arch/i386/oprofile/nmi_timer_int.c~oprofile-nmi_timer_int-fix arch/i386/oprofile/nmi_timer_int.c --- 25/arch/i386/oprofile/nmi_timer_int.c~oprofile-nmi_timer_int-fix Wed Feb 11 18:36:39 2004 +++ 25-akpm/arch/i386/oprofile/nmi_timer_int.c Wed Feb 11 18:36:39 2004 @@ -48,9 +48,13 @@ static struct oprofile_operations nmi_ti .cpu_type = "timer" }; - int __init nmi_timer_init(struct oprofile_operations ** ops) { + extern int nmi_active; + + if (nmi_active <= 0) + return -ENODEV; + *ops = &nmi_timer_ops; printk(KERN_INFO "oprofile: using NMI timer interrupt.\n"); return 0; _