Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3994

kernel-2.6.18-194.11.1.el5.src.rpm

From: Aristeu Rozanski <aris@redhat.com>
Date: Wed, 20 Aug 2008 13:17:05 -0400
Subject: [x86] nmi: use setup/stop routines in suspend/resume
Message-id: 20080820171651.026217000@redhat.com
O-Subject: [RHEL5.3 PATCH 19/25] nmi: use setup_apic_nmi_watchdog and stop_apic_nmi_watchdog in suspend/resume on i386
Bugzilla: 447618

https://bugzilla.redhat.com/show_bug.cgi?id=447618

Change{setup,stop}_apic_nmi_watchdog on suspend/resume functions

upstream: 4038f901cf102a40715b900984ed7540a9fa637f

diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 98ea080..628eb28 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -313,17 +313,20 @@ void enable_timer_nmi_watchdog(void)
 
 static int nmi_pm_active; /* nmi_active before suspend */
 
+void stop_apic_nmi_watchdog(void);
 static int lapic_nmi_suspend(struct sys_device *dev, pm_message_t state)
 {
 	nmi_pm_active = nmi_active;
-	disable_lapic_nmi_watchdog();
+	stop_apic_nmi_watchdog();
 	return 0;
 }
 
 static int lapic_nmi_resume(struct sys_device *dev)
 {
-	if (nmi_pm_active > 0)
-		enable_lapic_nmi_watchdog();
+	if (nmi_pm_active > 0) {
+		setup_apic_nmi_watchdog();
+		touch_nmi_watchdog();
+	}
 	return 0;
 }
 
@@ -409,6 +412,21 @@ void setup_apic_nmi_watchdog (void)
 	}
 }
 
+void stop_apic_nmi_watchdog(void)
+{
+	/* only support LOCAL and IO APICs for now */
+	if ((nmi_watchdog != NMI_LOCAL_APIC) &&
+	    (nmi_watchdog != NMI_IO_APIC))
+		return;
+	if (__get_cpu_var(wd_enabled) == 0)
+		return;
+	if (nmi_watchdog == NMI_LOCAL_APIC)
+		lapic_watchdog_stop();
+	__get_cpu_var(wd_enabled) = 0;
+	if (atomic_dec_and_test(&nmi_watchdog_active))
+		nmi_active = 0;
+}
+
 /*
  * the best way to detect whether a CPU has a 'hard lockup' problem
  * is to check it's local APIC timer IRQ counts. If they are not