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

Re: [Xen-devel] [PATCH] x86/mce: handle DOMID_XEN properly in XEN_MC_msrinject



On 26/05/16 03:07, Haozhong Zhang wrote:
> Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> address" forgot to consider dom_xen, which fails tools/xen-mceinj when
> it's going to inject into domain DOMID_XEN (e.g. when -d option is not
> used) via XEN_MC_msrinject. Use dom_xen when the domain id DOMID_XEN is
> passed in.
> 
> Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>

Why not also consider DOMID_IO, DOMID_COW, DOMID_INVALID ?
In "nature" a memory error can happen everywhere anytime.

Christoph

> ---
>  xen/arch/x86/cpu/mcheck/mce.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index cc446eb..65de627 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1427,17 +1427,18 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>  
>          if ( mc_msrinject->mcinj_flags & MC_MSRINJ_F_GPADDR )
>          {
> -            struct domain *d;
> +            domid_t domid = mc_msrinject->mcinj_domid;
> +            struct domain *d = (domid == DOMID_XEN) ?
> +                               dom_xen : get_domain_by_id(domid);
>              struct mcinfo_msr *msr;
>              unsigned int i;
>              paddr_t gaddr;
>              unsigned long gfn, mfn;
>              p2m_type_t t;
>  
> -            d = get_domain_by_id(mc_msrinject->mcinj_domid);
>              if ( d == NULL )
>                  return x86_mcerr("do_mca inject: bad domain id %d",
> -                                 -EINVAL, mc_msrinject->mcinj_domid);
> +                                 -EINVAL, domid);
>  
>              for ( i = 0, msr = &mc_msrinject->mcinj_msr[0];
>                    i < mc_msrinject->mcinj_count;
> @@ -1452,7 +1453,7 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>                      put_gfn(d, gfn);
>                      put_domain(d);
>                      return x86_mcerr("do_mca inject: bad gfn %#lx of domain 
> %d",
> -                                     -EINVAL, gfn, 
> mc_msrinject->mcinj_domid);
> +                                     -EINVAL, gfn, domid);
>                  }
>  
>                  msr->value = pfn_to_paddr(mfn) | (gaddr & (PAGE_SIZE - 1));
> 

Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
_______________________________________________
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®.