]> git.hungrycats.org Git - linux/commitdiff
[PATCH] lapic_nmi_watchdog resume fix
authorMikael Pettersson <mikpe@csd.uu.se>
Mon, 14 Apr 2003 03:31:33 +0000 (20:31 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Mon, 14 Apr 2003 03:31:33 +0000 (20:31 -0700)
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.

arch/i386/kernel/nmi.c

index b74137219ce73347f59fddcc1c2b34fa8100fad4..e8910adcd6bb957c015287f6769f66872fc952ba 100644 (file)
@@ -181,11 +181,13 @@ void enable_lapic_nmi_watchdog(void)
 #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 @@ static int lapic_nmi_resume(struct device *dev, u32 level)
 {
        if (level != RESUME_POWER_ON)
                return 0;
-       enable_lapic_nmi_watchdog();
+       if (nmi_pm_active > 0)
+               enable_lapic_nmi_watchdog();
        return 0;
 }