public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: add nmi_exit to die_nmi
@ 2006-04-27 17:55 Corey Minyard
  2006-04-29 10:58 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Corey Minyard @ 2006-04-27 17:55 UTC (permalink / raw)
  To: ak, linux-kernel

Playing with NMI watchdog on x86_64, I discovered that it didn't
do what I expected.  It always panic-ed, even when it didn't
happen from interrupt context.  This patch solves that
problem for me.  Also, in this case, do_exit() will be called
with interrupts disabled, I believe.  Would it be wise to also
call local_irq_enable() after nmi_exit()?

Currently, on x86_64, any NMI watchdog timeout will cause a panic
because the irq count will always be set to be in an interrupt
when do_exit() is called from die_nmi().  If we add nmi_exit() to 
the die_nmi() call (since the nmi will never exit "normally")
it seems to solve this problem.  The following small program
can be used to trigger the NMI watchdog to reproduce this:
  main ()
  {
        iopl(3);
        for (;;) asm("cli");
  }

diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 0ebb281..872ddfc 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -472,6 +472,7 @@ void __kprobes die_nmi(char *str, struct
 		panic("nmi watchdog");
 	printk("console shuts up ...\n");
 	oops_end(flags);
+	nmi_exit();
 	do_exit(SIGSEGV);
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86_64: add nmi_exit to die_nmi
  2006-04-27 17:55 [PATCH] x86_64: add nmi_exit to die_nmi Corey Minyard
@ 2006-04-29 10:58 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2006-04-29 10:58 UTC (permalink / raw)
  To: minyard; +Cc: linux-kernel

On Thursday 27 April 2006 19:55, Corey Minyard wrote:
> Playing with NMI watchdog on x86_64, I discovered that it didn't
> do what I expected.  It always panic-ed, even when it didn't
> happen from interrupt context.  

Hmm, I don't think that's true. Or at least it worked at some point.
Ok maybe something regressed.


> This patch solves that 
> problem for me.  Also, in this case, do_exit() will be called
> with interrupts disabled, I believe.  Would it be wise to also
> call local_irq_enable() after nmi_exit()?


Probably yes. I added that with the the patch.

Thanks,
-Andi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-29 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-27 17:55 [PATCH] x86_64: add nmi_exit to die_nmi Corey Minyard
2006-04-29 10:58 ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox