All of lore.kernel.org
 help / color / mirror / Atom feed
* NMI is broken!
@ 2001-11-30  9:10 george anzinger
  2001-12-01  7:11 ` george anzinger
  0 siblings, 1 reply; 36+ messages in thread
From: george anzinger @ 2001-11-30  9:10 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, Ingo Molnar

It appears that the NMI generation set up code is NOT correctly setting
up the system to generate NMIs if the interrupt system is off!  Kernel
version 2.4.2 NMI worked correctly, 2.4.7 and later do not.  I have not
tested kernels 2.4.3 thru 2.4.6.  If the interrupt system is on, NMIs
are being correctly generated.

IMHO the check_nmi_watchdog() test is flawed in that it explicitly
enables interrupts prior to the test.  Below is a patch to fix this
issue.  When this patch is applied to the 2.4.2 kernel, the test works
correctly, however, 2.4.7 and above all report "NMI appears to be
stuck".  (Note, the check_nmi_watchdog() code is in io_apic.c in the
2.4.2 kernel and is called "nmi_irq_works()".)

Note that this is not just a testing issue, NMI is no longer pulling the
system out of deadlocks with any of the irq spinlocks.

I am afraid that I don't know enough or have the right documentation to
figure out what changed, but it appears that the change was about the
same time that the nmi.c module was introduced.

Here is the recommended patch for nmi.c:

--- linux-2.4.13-org/arch/i386/kernel/nmi.c	Tue Sep 25 00:34:57 2001
+++ linux/arch/i386/kernel/nmi.c	Fri Nov 30 00:31:03 2001
@@ -46,28 +54,30 @@
 int __init check_nmi_watchdog (void)
 {
 	irq_cpustat_t tmp[NR_CPUS];
-	int j, cpu;
+	int j, cpu, err = 0;
 
 	printk(KERN_INFO "testing NMI watchdog ... ");
 
 	memcpy(tmp, irq_stat, sizeof(tmp));
-	sti();
+	cli();
 	mdelay((10*1000)/nmi_hz); // wait 10 ticks
 
 	for (j = 0; j < smp_num_cpus; j++) {
 		cpu = cpu_logical_map(j);
 		if (nmi_count(cpu) - tmp[cpu].__nmi_count <= 5) {
 			printk("CPU#%d: NMI appears to be stuck!\n", cpu);
-			return -1;
+			err = -1;
 		}
 	}
-	printk("OK.\n");
+        if (! err ){
+                printk("OK.\n");
+        }
 
 	/* now that we know it works we can reduce NMI frequency to
 	   something more reasonable; makes a difference in some configs */
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		nmi_hz = 1;
-
+        sti();
 	return 0;
 }
 

-- 
George           george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/

^ permalink raw reply	[flat|nested] 36+ messages in thread
* nmi is broken?
@ 2011-04-21 19:21 OGAWA Hirofumi
  2011-04-23 22:50 ` OGAWA Hirofumi
  0 siblings, 1 reply; 36+ messages in thread
From: OGAWA Hirofumi @ 2011-04-21 19:21 UTC (permalink / raw)
  To: kvm

Hi,

I noticed recently NMI on guest kernel is not working well.  host/guest
kernel is 2.6.39-rc4, and using vmx.

And test code is something like the following:

	local_irq_disable();
	for (i = 0; i < 10; i++) {
		int cpu = get_cpu();
		printk("%s: nmi %u, lapic %u\n", __FUNCTION__,
			nmi_count(cpu), irq_stat[cpu].apic_timer_irqs);
		mdelay(1000);
		put_cpu();
	}

the result is both of nmi and lapic are not increased. If I used
-no-kvm-irqchip, it works fine (increase nmi only). So, it seems to be
the bug of kvm driver side.

Ideas?
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

end of thread, other threads:[~2011-05-04 16:15 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-30  9:10 NMI is broken! george anzinger
2001-12-01  7:11 ` george anzinger
  -- strict thread matches above, loose matches on Subject: below --
2011-04-21 19:21 nmi is broken? OGAWA Hirofumi
2011-04-23 22:50 ` OGAWA Hirofumi
2011-04-24  6:44   ` Avi Kivity
2011-04-24  9:17     ` OGAWA Hirofumi
2011-04-24  9:46       ` Jan Kiszka
2011-04-24 11:13         ` OGAWA Hirofumi
2011-04-24 11:15           ` OGAWA Hirofumi
2011-04-24 12:24     ` Jan Kiszka
2011-04-27  8:55       ` Avi Kivity
2011-04-27 12:09         ` Jan Kiszka
2011-04-28  1:28         ` OGAWA Hirofumi
2011-04-28  9:59           ` Avi Kivity
2011-04-28 13:44             ` OGAWA Hirofumi
2011-04-28 14:23               ` OGAWA Hirofumi
2011-05-01  1:45                 ` OGAWA Hirofumi
2011-05-02  8:46                   ` Avi Kivity
2011-05-02 14:30                     ` OGAWA Hirofumi
2011-05-03  9:36                       ` Avi Kivity
2011-05-03 10:07                         ` Avi Kivity
2011-05-03 13:25                           ` OGAWA Hirofumi
2011-05-03 13:35                             ` Avi Kivity
2011-05-03 16:57                               ` OGAWA Hirofumi
2011-05-03 17:09                                 ` Avi Kivity
2011-05-03 17:45                                   ` OGAWA Hirofumi
2011-05-04  8:27                                     ` Avi Kivity
2011-05-04 15:40                                       ` OGAWA Hirofumi
2011-05-04 16:15                                         ` Avi Kivity
2011-04-24 14:08     ` Jan Kiszka
2011-05-03  9:43       ` Avi Kivity
2011-05-03 10:37         ` Jan Kiszka
2011-05-03 13:31           ` Avi Kivity
2011-05-03 14:29             ` Jan Kiszka
2011-05-03 14:37               ` Avi Kivity
2011-05-03 15:01                 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.