From d8ff15053e9e73be89cab4faea7182e99c06d0e7 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Sun, 13 Apr 2003 20:31:33 -0700 Subject: [PATCH] [PATCH] lapic_nmi_watchdog resume fix 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index b74137219ce73..e8910adcd6bb9 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c @@ -181,11 +181,13 @@ void enable_lapic_nmi_watchdog(void) #ifdef CONFIG_PM #include +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; } -- 2.53.0