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 fixes

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: MCE fixes
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Tue, 09 Feb 2010 13:26:26 +0000
Delivery-date: Tue, 09 Feb 2010 05:26:48 -0800
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
- fill_vmsr_data() leaked a domain reference; since the caller already
  obtained one, there's no need to obtain another one here
- intel_UCR_handler() could call put_domain() with a NULL pointer
- mcheck_mca_logout() updated a local data structure that wasn't used
  after the update

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

--- 2010-02-09.orig/xen/arch/x86/cpu/mcheck/mce.c       2010-02-03 
16:15:15.000000000 +0100
+++ 2010-02-09/xen/arch/x86/cpu/mcheck/mce.c    2010-02-09 09:00:50.000000000 
+0100
@@ -300,13 +300,15 @@ mctelem_cookie_t mcheck_mca_logout(enum 
 
        if (mci != NULL && errcnt > 0) {
                x86_mcinfo_lookup(mic, mci, MC_TYPE_GLOBAL);
-               mig = (struct mcinfo_global *)mic;
-               if (pcc)
-                       mcg.mc_flags |= MC_FLAG_UNCORRECTABLE;
+               mig = container_of(mic, struct mcinfo_global, common);
+               if (mic == NULL)
+                       ;
+               else if (pcc)
+                       mig->mc_flags |= MC_FLAG_UNCORRECTABLE;
                else if (uc)
-                       mcg.mc_flags |= MC_FLAG_RECOVERABLE;
+                       mig->mc_flags |= MC_FLAG_RECOVERABLE;
                else
-                       mcg.mc_flags |= MC_FLAG_CORRECTABLE;
+                       mig->mc_flags |= MC_FLAG_CORRECTABLE;
        }
 
 
--- 2010-02-09.orig/xen/arch/x86/cpu/mcheck/mce_intel.c 2010-02-03 
16:15:15.000000000 +0100
+++ 2010-02-09/xen/arch/x86/cpu/mcheck/mce_intel.c      2010-02-09 
09:16:49.000000000 +0100
@@ -225,22 +225,13 @@ static struct bank_entry* alloc_bank_ent
       for vMCE# MSRs virtualization
 */
 
-static int fill_vmsr_data(struct mcinfo_bank *mc_bank, 
+static int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d,
         uint64_t gstatus) {
-    struct domain *d;
     struct bank_entry *entry;
 
     /* This error bank impacts one domain, we need to fill domain related
      * data for vMCE MSRs virtualization and vMCE# injection */
     if (mc_bank->mc_domid != (uint16_t)~0) {
-        d = get_domain_by_id(mc_bank->mc_domid);
-
-        /* Not impact a valid domain, skip this error of the bank */
-        if (!d) {
-            mce_printk(MCE_QUIET, "MCE: Not found valid impacted DOM\n");
-            return 0;
-        }
-
         /* For HVM guest, Only when first vMCE is consumed by HVM guest 
successfully,
          * will we generete another node and inject another vMCE
          */
@@ -365,15 +356,18 @@ static void intel_UCR_handler(struct mci
                           if ( mca_ctl_conflict(bank, d) )
                           {
                               /* Guest has different MCE ctl with hypervisor */
-                              put_domain(d);
+                              if ( d )
+                                  put_domain(d);
                               return;
                           }
 
+                          ASSERT(d);
                           gfn =
                               get_gpfn_from_mfn((bank->mc_addr) >> PAGE_SHIFT);
                           bank->mc_addr =  gfn << PAGE_SHIFT |
                                         (bank->mc_addr & (PAGE_SIZE -1 ));
-                          if (fill_vmsr_data(bank, global->mc_gstatus) == -1)
+                          if ( fill_vmsr_data(bank, d,
+                                              global->mc_gstatus) == -1 )
                           {
                               mce_printk(MCE_QUIET, "Fill vMCE# data for DOM%d 
"
                                       "failed\n", result->owner);



Attachment: x86-mce-domain.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 fixes, Jan Beulich <=