[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86: fix boot-time watchdog test



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxx>
# Date 1308909369 -3600
# Node ID c2969926c99d2c085b4c0f54ba11d6dfbd38b796
# Parent  b240183197720129a8d83847bc5592d6dff3d530
x86: fix boot-time watchdog test.

Since the perf counter that the LAPIC NMI watchdog uses only
runs while the core isn't halted, and all APs are idle at
this point in the boot process, it's possible that remote
CPUs won't see any NMIs during the 10-tick waiting period.
Force all CPUs to busy-wait so we know the timers are running.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>

diff -r b24018319772 -r c2969926c99d xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c        Thu Jun 23 18:34:55 2011 +0100
+++ b/xen/arch/x86/nmi.c        Fri Jun 24 10:56:09 2011 +0100
@@ -95,6 +95,11 @@ int nmi_active;
     (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \
      P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE)
 
+static void __init wait_for_nmis(void *p)
+{
+    mdelay((10*1000)/nmi_hz); /* wait 10 ticks */
+}
+
 int __init check_nmi_watchdog (void)
 {
     static unsigned int __initdata prev_nmi_count[NR_CPUS];
@@ -108,7 +113,12 @@ int __init check_nmi_watchdog (void)
     for_each_online_cpu ( cpu )
         prev_nmi_count[cpu] = nmi_count(cpu);
     local_irq_enable();
-    mdelay((10*1000)/nmi_hz); /* wait 10 ticks */
+
+    /* Wait for 10 ticks.  Busy-wait on all CPUs: the LAPIC counter that
+     * the NMI watchdog uses only runs while the core's not halted */
+    if ( nmi_watchdog == NMI_LOCAL_APIC )
+        smp_call_function(wait_for_nmis, NULL, 0);
+    wait_for_nmis(NULL);
 
     for_each_online_cpu ( cpu )
     {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.