From: Tim Deegan Subject: [PATCH] NMI watchdog: don't try to run too slow. Date: Fri, 17 Oct 2008 15:24:58 +0100 Message-ID: <20081017142458.GL3780@york.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oTHb8nViIGeoXxdp" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --oTHb8nViIGeoXxdp Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline The way MSR writes of performance counters works means that Intel CPUs running faster than about 2.1GHz can't set the NMI timer to 1Hz. Signed-off-by: Tim Deegan --oTHb8nViIGeoXxdp Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=watchdog2 diff -r 4129f0f2f2ba xen/arch/x86/nmi.c --- a/xen/arch/x86/nmi.c Fri Oct 17 14:15:37 2008 +0100 +++ b/xen/arch/x86/nmi.c Fri Oct 17 15:14:13 2008 +0100 @@ -122,10 +122,15 @@ int __init check_nmi_watchdog (void) printk("\n"); - /* now that we know it works we can reduce NMI frequency to - something more reasonable; makes a difference in some configs */ + /* Now that we know it works we can reduce NMI frequency to + * something more reasonable; makes a difference in some configs. + * There's a limit to how slow we can go because writing the perfctr + * MSRs only sets the low 32 bits, with the top 8 bits sign-extended + * from those, so it's not possible to set up a delay larger than + * 2^31 cycles and smaller than (2^40 - 2^31) cycles. + * (Intel SDM, section 18.22.2) */ if ( nmi_watchdog == NMI_LOCAL_APIC ) - nmi_hz = 1; + nmi_hz = max(1ul, cpu_khz >> 20); return 0; } --oTHb8nViIGeoXxdp Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --oTHb8nViIGeoXxdp--