[PATCH][2.6] Oprofile, fix nmi_timer_int detection

From: Zwane Mwaikambo
Date: Sun Feb 08 2004 - 16:24:58 EST


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.

Index: linux-2.6.2/arch/i386/kernel/nmi.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.2/arch/i386/kernel/nmi.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 nmi.c
--- linux-2.6.2/arch/i386/kernel/nmi.c 4 Feb 2004 07:43:40 -0000 1.1.1.1
+++ linux-2.6.2/arch/i386/kernel/nmi.c 5 Feb 2004 21:49:58 -0000
@@ -42,7 +42,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)
@@ -462,6 +462,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);
Index: linux-2.6.2/arch/i386/oprofile/nmi_timer_int.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.2/arch/i386/oprofile/nmi_timer_int.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 nmi_timer_int.c
--- linux-2.6.2/arch/i386/oprofile/nmi_timer_int.c 4 Feb 2004 07:43:41 -0000 1.1.1.1
+++ linux-2.6.2/arch/i386/oprofile/nmi_timer_int.c 5 Feb 2004 18:45:04 -0000
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/