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

Re: [Xen-devel] [PATCH 3/4] x86/mce: Translate passed-in GPA to host machine address



>>> On 15.09.15 at 10:29, <haozhong.zhang@xxxxxxxxx> wrote:
> @@ -1422,6 +1423,38 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>          if (mc_msrinject->mcinj_count == 0)
>              return 0;
>  
> +        if (mc_msrinject->mcinj_flags & MC_MSRINJ_F_GPADDR) {

Perhaps you earlier patch fixing coding style didn't go far enough:
Patch context as well as you additions make immediately clear that
this file (or just this function) doesn't follow either Xen or Linux
coding style. Going through the file as whole I see attempts to
follow Xen style, so please at least make sure new addition follow
that style rather than the surrounding broken one.

> +            struct domain *d;
> +            struct mcinfo_msr *msr;
> +            int i;

unsigned int

> +            uint64_t gaddr, gpfn, mfn, haddr;

paddr_t and unsigned long.

> +            p2m_type_t t;
> +
> +            d = get_domain_by_id(mc_msrinject->mcinj_domid);
> +            if (d == NULL)
> +                return x86_mcerr("do_mca inject: illegal domain id", 
> -EINVAL);
> +
> +            for (i = 0, msr = &mc_msrinject->mcinj_msr[0];
> +                 i < mc_msrinject->mcinj_count; i++, msr++) {
> +                gaddr = msr->value;
> +                gpfn = gaddr >> PAGE_SHIFT;

PFN_DOWN()

> +                mfn = mfn_x(get_gfn(d, gpfn, &t));
> +
> +                if (mfn == INVALID_MFN) {
> +                    put_domain(d);
> +                    return x86_mcerr("do_mca inject: illegal MSR value",
> +                                     -EINVAL);

This message should be better distinguishable from the one further
down (or else it's pretty pointless) - perhaps you mean GPFN instead
of MSR?

> +                }
> +
> +                haddr = (mfn << PAGE_SHIFT) | (gaddr & (PAGE_SIZE - 1));

pfn_to_paddr()

> +                msr->value = haddr;

I also don't see the purpose of the intermediate variable here.

Jan


_______________________________________________
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®.