WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86/mce: assorted fixes

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86/mce: assorted fixes
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Tue, 15 Jun 2010 13:11:08 +0100
Delivery-date: Tue, 15 Jun 2010 05:11:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
- correct various range checks (avoids bogus warnings on domains
  modifying virtualized MSRs)
- correct consistency check (so that APs get checked instead of the
  BP [against uninitialized data])
- reduce verbosity (capabilities printed only once, but then all of
  the relevant values)

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2010-06-15.orig/xen/arch/x86/cpu/mcheck/mce.h       2010-06-14 
08:49:36.000000000 +0200
+++ 2010-06-15/xen/arch/x86/cpu/mcheck/mce.h    2010-06-15 12:06:59.000000000 
+0200
@@ -173,15 +173,14 @@ extern unsigned int nr_mce_banks;
 static inline int mce_vendor_bank_msr(uint32_t msr)
 {
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-        (msr > MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks)) )
+         msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks) )
           return 1;
     return 0;
 }
 
 static inline int mce_bank_msr(uint32_t msr)
 {
-    if ( (msr > MSR_IA32_MC0_CTL2 &&
-         msr < (MSR_IA32_MCx_CTL(nr_mce_banks - 1))) ||
+    if ( (msr >= MSR_IA32_MC0_CTL && msr < MSR_IA32_MCx_CTL(nr_mce_banks)) ||
         mce_vendor_bank_msr(msr) )
         return 1;
     return 0;
--- 2010-06-15.orig/xen/arch/x86/cpu/mcheck/mce_intel.c 2010-06-14 
08:49:36.000000000 +0200
+++ 2010-06-15/xen/arch/x86/cpu/mcheck/mce_intel.c      2010-06-15 
12:08:53.000000000 +0200
@@ -1145,26 +1145,26 @@ static void intel_init_mca(struct cpuinf
 
     first = mce_firstbank(c);
 
-    dprintk(XENLOG_INFO, "MCA Capaility: CPU %x SER %x"
-       "CMCI %x firstbank %x extended MCE MSR %x\n",
-       smp_processor_id(), ser, cmci, first, ext_num);
-
-    if (smp_processor_id())
+    if (smp_processor_id() == 0)
     {
+        dprintk(XENLOG_INFO, "MCA Capability: BCAST %x SER %x"
+                " CMCI %x firstbank %x extended MCE MSR %x\n",
+                broadcast, ser, cmci, first, ext_num);
+
         mce_broadcast = broadcast;
         cmci_support = cmci;
         ser_support = ser;
         nr_intel_ext_msrs = ext_num;
         firstbank = first;
     }
-    else
-    {
-        if (cmci != cmci_support || ser != ser_support ||
-            broadcast != mce_broadcast ||
-            first != firstbank)
-            dprintk(XENLOG_WARNING,
-              "CPU %x has different MCA capability with BSP\n"
-              "may cause undetermined result!!!\n", smp_processor_id());
+    else if (cmci != cmci_support || ser != ser_support ||
+             broadcast != mce_broadcast ||
+             first != firstbank || ext_num != nr_intel_ext_msrs)
+    {
+        dprintk(XENLOG_WARNING,
+                "CPU %u has different MCA capability (%x,%x,%x,%x,%x)"
+                " than BSP, may cause undetermined result!!!\n",
+                smp_processor_id(), broadcast, ser, cmci, first, ext_num);
     }
 }
 
@@ -1264,8 +1264,7 @@ int intel_mce_wrmsr(uint32_t msr, uint64
 {
     int ret = 0;
 
-    if (msr > MSR_IA32_MC0_CTL2 &&
-        msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks - 1))
+    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not write this MSR!\n");
@@ -1279,8 +1278,7 @@ int intel_mce_rdmsr(uint32_t msr, uint64
 {
     int ret = 0;
 
-    if (msr > MSR_IA32_MC0_CTL2 &&
-        msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks - 1))
+    if (msr >= MSR_IA32_MC0_CTL2 && msr < (MSR_IA32_MC0_CTL2 + nr_mce_banks))
     {
         mce_printk(MCE_QUIET, "We have disabled CMCI capability, "
                  "Guest should not read this MSR!\n");



Attachment: x86-mce-intel.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86/mce: assorted fixes, Jan Beulich <=