debuggers.hg

diff xen/arch/x86/cpu/mcheck/mce_intel.c @ 20963:da7ae6d8838a

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 10 09:18:11 2010 +0000 (2010-02-10)
parents 5b895c3f4386
children 50ea24db1f88
line diff
     1.1 --- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Wed Feb 10 09:09:35 2010 +0000
     1.2 +++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Wed Feb 10 09:18:11 2010 +0000
     1.3 @@ -225,22 +225,13 @@ static struct bank_entry* alloc_bank_ent
     1.4        for vMCE# MSRs virtualization
     1.5  */
     1.6  
     1.7 -static int fill_vmsr_data(struct mcinfo_bank *mc_bank, 
     1.8 +static int fill_vmsr_data(struct mcinfo_bank *mc_bank, struct domain *d,
     1.9          uint64_t gstatus) {
    1.10 -    struct domain *d;
    1.11      struct bank_entry *entry;
    1.12  
    1.13      /* This error bank impacts one domain, we need to fill domain related
    1.14       * data for vMCE MSRs virtualization and vMCE# injection */
    1.15      if (mc_bank->mc_domid != (uint16_t)~0) {
    1.16 -        d = get_domain_by_id(mc_bank->mc_domid);
    1.17 -
    1.18 -        /* Not impact a valid domain, skip this error of the bank */
    1.19 -        if (!d) {
    1.20 -            mce_printk(MCE_QUIET, "MCE: Not found valid impacted DOM\n");
    1.21 -            return 0;
    1.22 -        }
    1.23 -
    1.24          /* For HVM guest, Only when first vMCE is consumed by HVM guest successfully,
    1.25           * will we generete another node and inject another vMCE
    1.26           */
    1.27 @@ -365,15 +356,18 @@ static void intel_UCR_handler(struct mci
    1.28                            if ( mca_ctl_conflict(bank, d) )
    1.29                            {
    1.30                                /* Guest has different MCE ctl with hypervisor */
    1.31 -                              put_domain(d);
    1.32 +                              if ( d )
    1.33 +                                  put_domain(d);
    1.34                                return;
    1.35                            }
    1.36  
    1.37 +                          ASSERT(d);
    1.38                            gfn =
    1.39                                get_gpfn_from_mfn((bank->mc_addr) >> PAGE_SHIFT);
    1.40                            bank->mc_addr =  gfn << PAGE_SHIFT |
    1.41                                          (bank->mc_addr & (PAGE_SIZE -1 ));
    1.42 -                          if (fill_vmsr_data(bank, global->mc_gstatus) == -1)
    1.43 +                          if ( fill_vmsr_data(bank, d,
    1.44 +                                              global->mc_gstatus) == -1 )
    1.45                            {
    1.46                                mce_printk(MCE_QUIET, "Fill vMCE# data for DOM%d "
    1.47                                        "failed\n", result->owner);