[patch, -rc5-mm1] lock validator: disable NMI watchdog if CONFIG_LOCKDEP, i386

Ingo Molnar
2006-05-30T12:29:31Z

* Mike Galbraith <efault@gmx.de> wrote:

> > > BUG: warning at kernel/lockdep.c:2398/check_flags()
> >
> > this one could be related to NMI. We are already disabling NMI on
> > x86_64, but i thought i had it fixed up for i386 - apparently not.
>
> Booted with nmi_watchdog=0, no warning and no deadlock.

ok, great. The patch below turns off NMI on i386 automatically.

-------------------
Subject: lock validator: disable NMI watchdog if CONFIG_LOCKDEP, i386
From: Ingo Molnar <mingo@elte.hu>

The NMI watchdog uses spinlocks (notifier chains, etc.),
so it's not lockdep-safe at the moment.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/i386/kernel/nmi.c | 11 +++++++++++
1 file changed, 11 insertions(+)

Index: linux/arch/i386/kernel/nmi.c
===================================================================
--- linux.orig/arch/i386/kernel/nmi.c
+++ linux/arch/i386/kernel/nmi.c
@@ -741,6 +741,17 @@ static void stop_intel_arch_watchdog(voi

void setup_apic_nmi_watchdog (void *unused)
{
+#ifdef CONFIG_LOCKDEP
+ /*
+ * The NMI watchdog uses spinlocks (notifier chains, etc.),
+ * so it's not lockdep-safe:
+ */
+ nmi_watchdog = NMI_NONE;
+ printk("lockdep: disabled NMI watchdog.\n");
+
+ return;
+#endif
+
/* only support LOCAL and IO APICs for now */
if ((nmi_watchdog != NMI_LOCAL_APIC) &&
(nmi_watchdog != NMI_IO_APIC))