Re: [Xen-devel] [PATCH] x86/amd: fix crash as Xen Dom0 on AMDTrinity systems

From: Konrad Rzeszutek Wilk
Date: Wed May 30 2012 - 13:25:07 EST


> Yes, the following patch also fixed the crash for us:
>
> Implement rdmsr_regs and wrmsr_regs for Xen pvops.

That needs more data. Such as the reason for it, the crash
tombstone, and an analysis of the bug.

But at this point I am not sure what we are going to do.

I think Peter leans towards ripping the .rdmsr_regs/wdmsr_regs
function out altogether (so altering the amd_rdmsr... to use the
.rdmsr/.wrdmsr). At which point I think this would all work
just fine?

I am tempted to write a patch that checks all the pv-cpu-ops
to see if there are any that are NULL and throw a warning so
that this does not hit us in the future - to be at least more
proactive about this sort of thing.


>
> Signed-off-by: Jacob Shin <jacob.shin@xxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx # 3.4+
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index 75f33b2..f3ae5ec 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -945,9 +945,12 @@ static void xen_write_cr4(unsigned long cr4)
> native_write_cr4(cr4);
> }
>
> -static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
> +static int xen_wrmsr_safe_regs(u32 regs[8])
> {
> int ret;
> + unsigned int msr = regs[1];
> + unsigned low = regs[0];
> + unsigned high = regs[2];
>
> ret = 0;
>
> @@ -985,12 +988,23 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
> break;
>
> default:
> - ret = native_write_msr_safe(msr, low, high);
> + ret = native_wrmsr_safe_regs(regs);
> }
>
> return ret;
> }
>
> +static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
> +{
> + u32 regs[8] = { 0 };
> +
> + regs[0] = low;
> + regs[1] = msr;
> + regs[2] = high;
> +
> + return xen_wrmsr_safe_regs(regs);
> +}
> +
> void xen_setup_shared_info(void)
> {
> if (!xen_feature(XENFEAT_auto_translated_physmap)) {
> @@ -1116,7 +1130,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
> .wbinvd = native_wbinvd,
>
> .read_msr = native_read_msr_safe,
> + .rdmsr_regs = native_rdmsr_safe_regs,
> .write_msr = xen_write_msr_safe,
> + .wrmsr_regs = xen_wrmsr_safe_regs,
> .read_tsc = native_read_tsc,
> .read_pmc = native_read_pmc,
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/