[PATCH] 2.5.67 lapic_nmi_watchdog resume fix

From: mikpe@csd.uu.se
Date: Sun Apr 13 2003 - 08:13:15 EST


Linus,

I managed to add a bug to the local APIC NMI watchdog's
resume procedure in the driver model conversion for 2.5.67.
The problem is that the resume procedure simply calls the
enable procedure. If the NMI watchdog has been disabled by
another driver (like oprofile or perfctr), then the NMI
watchdog will incorrectly be re-enabled.

I discovered this when updating the perfctr driver for 2.5.67
and seeing unexpected NMIs after a resume from apm --suspend.

We can fix this by unregistering the NMI watchdog from the
driver model when disabling it (like the code did before the
driver model changes), or by remembering the previous state
at suspend and checking it at resume. The patch below uses
the second, simpler, approach. Tested, please apply.

/Mikael

--- linux-2.5.67-perfctr/arch/i386/kernel/nmi.c.~1~ 2003-04-08 01:47:25.000000000 +0200
+++ linux-2.5.67-perfctr/arch/i386/kernel/nmi.c 2003-04-12 23:26:35.000000000 +0200
@@ -181,11 +181,13 @@
 #ifdef CONFIG_PM
 
 #include <linux/device.h>
+static int nmi_pm_active; /* nmi_active before suspend */
 
 static int lapic_nmi_suspend(struct device *dev, u32 state, u32 level)
 {
         if (level != SUSPEND_POWER_DOWN)
                 return 0;
+ nmi_pm_active = nmi_active;
         disable_lapic_nmi_watchdog();
         return 0;
 }
@@ -194,7 +196,8 @@
 {
         if (level != RESUME_POWER_ON)
                 return 0;
- enable_lapic_nmi_watchdog();
+ if (nmi_pm_active > 0)
+ enable_lapic_nmi_watchdog();
         return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:28 EST