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

[Xen-devel] [PATCH 1/2] x86/VPMU: Disable VPMU when NMI watchdog is on



NMI watchdog sets APIC_LVTPC register to generate an NMI when PMU counter
overflow occurs. This may be overwritten by VPMU code later, effectively
turning off the watchdog.

We should disable VPMU when NMI watchdog is running.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vpmu.c        |  9 ++++++++-
 xen/arch/x86/nmi.c             | 10 +++++++++-
 xen/include/asm-x86/hvm/vpmu.h |  1 +
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c
index 63b2158..ee05840 100644
--- a/xen/arch/x86/hvm/vpmu.c
+++ b/xen/arch/x86/hvm/vpmu.c
@@ -24,6 +24,7 @@
 #include <asm/regs.h>
 #include <asm/types.h>
 #include <asm/msr.h>
+#include <asm/nmi.h>
 #include <asm/hvm/support.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vmcs.h>
@@ -37,7 +38,7 @@
  * "vpmu=off" : vpmu generally disabled
  * "vpmu=bts" : vpmu enabled and Intel BTS feature switched on.
  */
-static unsigned int __read_mostly opt_vpmu_enabled;
+unsigned int __read_mostly opt_vpmu_enabled;
 static void parse_vpmu_param(char *s);
 custom_param("vpmu", parse_vpmu_param);
 
@@ -59,6 +60,12 @@ static void __init parse_vpmu_param(char *s)
         }
         /* fall through */
     case 1:
+        if ( opt_watchdog )
+        {
+            printk("NMI watchdog is enabled. Disabling VPMU\n");
+            opt_vpmu_enabled = 0;
+            break;
+        }
         opt_vpmu_enabled |= VPMU_BOOT_ENABLED;
         break;
     }
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 98c1e15..a0ade45 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -33,6 +33,7 @@
 #include <asm/debugger.h>
 #include <asm/div64.h>
 #include <asm/apic.h>
+#include <asm/hvm/vpmu.h>
 
 unsigned int nmi_watchdog = NMI_NONE;
 static unsigned int nmi_hz = HZ;
@@ -52,7 +53,7 @@ static void __init parse_watchdog(char *s)
     if ( !*s )
     {
         opt_watchdog = 1;
-        return;
+        goto out;
     }
 
     switch ( parse_bool(s) )
@@ -67,6 +68,13 @@ static void __init parse_watchdog(char *s)
 
     if ( !strcmp(s, "force") )
         watchdog_force = opt_watchdog = 1;
+
+ out:
+    if ( opt_watchdog && opt_vpmu_enabled )
+    {
+        printk("NMI watchdog is enabled. Disabling VPMU\n");
+        opt_vpmu_enabled = 0;
+    }
 }
 custom_param("watchdog", parse_watchdog);
 
diff --git a/xen/include/asm-x86/hvm/vpmu.h b/xen/include/asm-x86/hvm/vpmu.h
index ddc2748..3fee537 100644
--- a/xen/include/asm-x86/hvm/vpmu.h
+++ b/xen/include/asm-x86/hvm/vpmu.h
@@ -29,6 +29,7 @@
 #define VPMU_BOOT_ENABLED 0x1    /* vpmu generally enabled. */
 #define VPMU_BOOT_BTS     0x2    /* Intel BTS feature wanted. */
 
+extern unsigned int opt_vpmu_enabled;
 
 #define msraddr_to_bitpos(x) (((x)&0xffff) + ((x)>>31)*0x2000)
 #define vcpu_vpmu(vcpu)   (&((vcpu)->arch.hvm_vcpu.vpmu))
-- 
1.8.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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