* [PATCH][2.5.71] x86-64 apic/nmi cleanups
@ 2003-06-16 15:11 mikpe
2003-06-16 15:25 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: mikpe @ 2003-06-16 15:11 UTC (permalink / raw)
To: ak; +Cc: linux-kernel
Andi,
The driver model conversion left x86-64's apic.c and nmi.c with
obsolete #includes and comments, and some poor code formatting.
nmi.c also lacks the 'nmi_pm_active' change which went into
i386 recently. It's needed to prevent enabling the watchdog
after resume if it was disabled before suspend: this happens
if another driver has claimed the HW and disabled the watchdog.
This won't hit until you remove the #if 0 in lapic_nmi_resume(),
however. (Why do you need that?)
Patch below fixes these issues. (Against 2.5.71 + x86_64-2.5.71-1)
/Mikael
diff -ruN linux-2.5.71-andi/arch/x86_64/kernel/apic.c linux-2.5.71-mikpe/arch/x86_64/kernel/apic.c
--- linux-2.5.71-andi/arch/x86_64/kernel/apic.c 2003-06-16 16:08:35.000000000 +0200
+++ linux-2.5.71-mikpe/arch/x86_64/kernel/apic.c 2003-06-16 16:17:38.000000000 +0200
@@ -441,9 +441,6 @@
#ifdef CONFIG_PM
-#include <linux/device.h>
-#include <linux/module.h>
-
static struct {
/* 'active' is true if the local APIC was enabled by us and
not the BIOS; this signifies that we are also responsible
@@ -540,7 +537,6 @@
.suspend = lapic_suspend,
};
-/* not static, needed by child devices */
static struct sys_device device_lapic = {
.id = 0,
.cls = &lapic_sysclass,
diff -ruN linux-2.5.71-andi/arch/x86_64/kernel/nmi.c linux-2.5.71-mikpe/arch/x86_64/kernel/nmi.c
--- linux-2.5.71-andi/arch/x86_64/kernel/nmi.c 2003-06-16 16:08:35.000000000 +0200
+++ linux-2.5.71-mikpe/arch/x86_64/kernel/nmi.c 2003-06-16 16:20:29.000000000 +0200
@@ -141,20 +141,22 @@
/* tell do_nmi() and others that we're not active any more */
nmi_watchdog = 0;
}
+
void enable_lapic_nmi_watchdog(void)
- {
+{
if (nmi_active < 0) {
nmi_watchdog = NMI_LOCAL_APIC;
setup_apic_nmi_watchdog();
}
- }
+}
#ifdef CONFIG_PM
-#include <linux/device.h>
+static int nmi_pm_active; /* nmi_active before suspend */
static int lapic_nmi_suspend(struct sys_device *dev, u32 state)
{
+ nmi_pm_active = nmi_active;
disable_lapic_nmi_watchdog();
return 0;
}
@@ -162,7 +164,8 @@
static int lapic_nmi_resume(struct sys_device *dev)
{
#if 0
- enable_lapic_nmi_watchdog();
+ if (nmi_pm_active > 0)
+ enable_lapic_nmi_watchdog();
#endif
return 0;
}
@@ -174,7 +177,7 @@
};
static struct sys_device device_lapic_nmi = {
- .id = 0,
+ .id = 0,
.cls = &nmi_sysclass,
};
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][2.5.71] x86-64 apic/nmi cleanups
2003-06-16 15:11 [PATCH][2.5.71] x86-64 apic/nmi cleanups mikpe
@ 2003-06-16 15:25 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2003-06-16 15:25 UTC (permalink / raw)
To: mikpe; +Cc: ak, linux-kernel, pavel
On Mon, Jun 16, 2003 at 05:11:41PM +0200, mikpe@csd.uu.se wrote:
> Andi,
>
> The driver model conversion left x86-64's apic.c and nmi.c with
> obsolete #includes and comments, and some poor code formatting.
Most of this is already in the patchkit.
>
> nmi.c also lacks the 'nmi_pm_active' change which went into
> i386 recently. It's needed to prevent enabling the watchdog
> after resume if it was disabled before suspend: this happens
> if another driver has claimed the HW and disabled the watchdog.
> This won't hit until you remove the #if 0 in lapic_nmi_resume(),
> however. (Why do you need that?)
I think it came from Pavel. I will remove it for now and merged that
change.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-16 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 15:11 [PATCH][2.5.71] x86-64 apic/nmi cleanups mikpe
2003-06-16 15:25 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®