Re: [Xen-devel] [PATCH 1/2] x86/vmx: Print the problematic MSR if a vmentry fails
On 13/10/16 12:38, Jan Beulich wrote: On 13.10.16 at 13:15, wrote: >> Sample error looks like: >> >> (XEN) Failed vm entry (exit reason 0x8022) caused by MSR loading >> (entry 13). >> (XEN) msr 068a, val 1fff80102af0, (mbz 0) >> (XEN) * VMCS Area ** >> >> Signed-off-by: Andrew Cooper > Reviewed-by: Jan Beulich > with > >> --- a/xen/arch/x86/hvm/vmx/vmx.c >> +++ b/xen/arch/x86/hvm/vmx/vmx.c >> @@ -3104,8 +3104,23 @@ static void vmx_failed_vmentry(unsigned int >> exit_reason, >> printk("caused by invalid guest state (%ld).\n", >> exit_qualification); >> break; >> case EXIT_REASON_MSR_LOADING: >> -printk("caused by MSR entry %ld loading.\n", exit_qualification); >> +{ >> +unsigned long idx = exit_qualification - 1; >> +struct vmx_msr_entry *msr; > ... preferably const here Will do. > (and the declaration perhaps moved into > the more narrow scope it's needed in), ... Cant, due to its use in the sizeof() expression. (I tried that first) > >> +printk("caused by MSR loading (entry %ld).\n", idx); > ... %lu (plus ideally the full stop dropped) here, and ... Ok for %lu. The full stop is dealt with in the following patch, so will leave this as-is for consistency of both patches. > >> +if ( idx > (PAGE_SIZE / sizeof(*msr)) ) > ... >= here. > >> +printk(" Entry out of range\n"); >> +else >> +{ >> +msr = &curr->arch.hvm_vmx.msr_area[idx]; >> + >> +printk(" msr %08x, val %016"PRIx64", (mbz %#x)\n", > I'm also unsure about the usefulness of the commas here - at least > the second one seems a little strange with the value in parentheses. Ok. ~Andrew ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 1/2] x86/vmx: Print the problematic MSR if a vmentry fails
>>> On 13.10.16 at 13:15, wrote: > Sample error looks like: > > (XEN) Failed vm entry (exit reason 0x8022) caused by MSR loading (entry > 13). > (XEN) msr 068a, val 1fff80102af0, (mbz 0) > (XEN) * VMCS Area ** > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich with > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -3104,8 +3104,23 @@ static void vmx_failed_vmentry(unsigned int > exit_reason, > printk("caused by invalid guest state (%ld).\n", exit_qualification); > break; > case EXIT_REASON_MSR_LOADING: > -printk("caused by MSR entry %ld loading.\n", exit_qualification); > +{ > +unsigned long idx = exit_qualification - 1; > +struct vmx_msr_entry *msr; ... preferably const here (and the declaration perhaps moved into the more narrow scope it's needed in), ... > +printk("caused by MSR loading (entry %ld).\n", idx); ... %lu (plus ideally the full stop dropped) here, and ... > +if ( idx > (PAGE_SIZE / sizeof(*msr)) ) ... >= here. > +printk(" Entry out of range\n"); > +else > +{ > +msr = &curr->arch.hvm_vmx.msr_area[idx]; > + > +printk(" msr %08x, val %016"PRIx64", (mbz %#x)\n", I'm also unsure about the usefulness of the commas here - at least the second one seems a little strange with the value in parentheses. Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
[Xen-devel] [PATCH 1/2] x86/vmx: Print the problematic MSR if a vmentry fails
Sample error looks like: (XEN) Failed vm entry (exit reason 0x8022) caused by MSR loading (entry 13). (XEN) msr 068a, val 1fff80102af0, (mbz 0) (XEN) * VMCS Area ** Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Jun Nakajima CC: Kevin Tian --- xen/arch/x86/hvm/vmx/vmx.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index b9102ce..38cbcea 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3104,8 +3104,23 @@ static void vmx_failed_vmentry(unsigned int exit_reason, printk("caused by invalid guest state (%ld).\n", exit_qualification); break; case EXIT_REASON_MSR_LOADING: -printk("caused by MSR entry %ld loading.\n", exit_qualification); +{ +unsigned long idx = exit_qualification - 1; +struct vmx_msr_entry *msr; + +printk("caused by MSR loading (entry %ld).\n", idx); + +if ( idx > (PAGE_SIZE / sizeof(*msr)) ) +printk(" Entry out of range\n"); +else +{ +msr = &curr->arch.hvm_vmx.msr_area[idx]; + +printk(" msr %08x, val %016"PRIx64", (mbz %#x)\n", + msr->index, msr->data, msr->mbz); +} break; +} case EXIT_REASON_MCE_DURING_VMENTRY: printk("caused by machine check.\n"); HVMTRACE_0D(MCE); -- 2.1.4 ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel