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

[Xen-changelog] [xen-unstable] x86: MCE fixes



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1265793491 0
# Node ID da7ae6d8838a17ccccd73a103dbb7a8118b5ea36
# Parent  869884b9358421e39088073219febba811917647
x86: MCE fixes

- 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>
---
 xen/arch/x86/cpu/mcheck/mce.c       |   12 +++++++-----
 xen/arch/x86/cpu/mcheck/mce_intel.c |   18 ++++++------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff -r 869884b93584 -r da7ae6d8838a xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c     Wed Feb 10 09:09:35 2010 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce.c     Wed Feb 10 09:18:11 2010 +0000
@@ -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;
        }
 
 
diff -r 869884b93584 -r da7ae6d8838a xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c       Wed Feb 10 09:09:35 2010 +0000
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c       Wed Feb 10 09:18:11 2010 +0000
@@ -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);

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


 


Rackspace

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