x86/vmx: Print the problematic MSR if a vmentry fails
PATCH 1/2 x86/vmx: Print the problematic MSR if a vmentry fails
Sample error looks like:
(XEN) Failed vm entry (exit reason 0x80000022) caused by MSR loading (entry 13).
(XEN) msr 0000068a, val 1fff800000102af0, (mbz 0)
(XEN) ************* VMCS Area **************
---
CC: Jan Beulich <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
--- xen/arch/x86/hvm/vmx/vmx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/vmx/vmx.c +16 -1
@@ -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 );
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 x86/vmx: Reduce the verbosity of the vmentry failure error reporting
Identify the affected vcpu at the start of the message. While tweaking this area, add extra newlines between cases.
---
CC: Jan Beulich <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
--- xen/arch/x86/hvm/vmx/vmx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
xen/arch/x86/hvm/vmx/vmx.c +8 -5
@@ -3096,19 +3096,20 @@ static void vmx_failed_vmentry(unsigned int exit_reason,unsigned long exit_qualification;struct vcpu *curr = current; -printk ("Failed vm entry (exit reason %#x) " , exit_reason); +printk ("%pv vmentry failure (reason %#x): " , curr, exit_reason);__vmread (EXIT_QUALIFICATION , &exit_qualification);switch ( failed_vmentry_reason ) {case EXIT_REASON_INVALID_GUEST_STATE : -printk ("caused by invalid guest state (%ld).\n" , exit_qualification); +printk ("Invalid guest state (%ld)\n" , exit_qualification);break ; +case EXIT_REASON_MSR_LOADING : {unsigned long idx = exit_qualification -1 ;struct vmx_msr_entry *msr; -printk ("caused by MSR loading (entry %ld).\n" , idx); +printk ("MSR loading (entry %ld)\n" , idx);if ( idx > (PAGE_SIZE /sizeof (*msr)) )printk (" Entry out of range\n" );
@@ -3121,13 +3122,15 @@ static void vmx_failed_vmentry(unsigned int exit_reason, }break ; } +case EXIT_REASON_MCE_DURING_VMENTRY : -printk ("caused by machine check.\n" ); +printk ("MCE\n" );HVMTRACE_0D (MCE );/* Already handled. */ break ; +default : -printk ("reason not known yet!" ); +printk ("Unknown\n" );break ; }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/2] x86/vmx: Reduce the verbosity of the vmentry failure error reporting
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 13:15, <[email protected]> wrote:
Identify the affected vcpu at the start of the message. While tweaking this area, add extra newlines between cases.
Signed-off-by Andrew Cooper <[email protected]>
with ...
Quoted 4 lines
xen/arch/x86/hvm/vmx/vmx.c +0
-0@@ -3096,19 +3096,20 @@ static void vmx_failed_vmentry(unsigned int exit_reason,unsigned long exit_qualification;
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3104
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +2
-2struct vcpu *curr = current; -printk ("Failed vm entry (exit reason %#x) " , exit_reason); +printk ("%pv vmentry failure (reason %#x): " , curr, exit_reason);__vmread (EXIT_QUALIFICATION , &exit_qualification);switch ( failed_vmentry_reason ) {case EXIT_REASON_INVALID_GUEST_STATE : -printk ("caused by invalid guest state (%ld).\n" , exit_qualification); +printk ("Invalid guest state (%ld)\n" , exit_qualification);
... %lu here.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 13:15, <[email protected]> wrote:
Sample error looks like:
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)
(XEN) ************* VMCS Area **************Signed-off-by Andrew Cooper <[email protected]>
with
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3109
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +3
-1@@ -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), ...
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3111
Quoted 1 line
xen/arch/x86/hvm/vmx/vmx.c +1
-0+printk ("caused by MSR loading (entry %ld).\n" , idx);
... %lu (plus ideally the full stop dropped) here, and ...
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3113
Quoted 1 line
xen/arch/x86/hvm/vmx/vmx.c +1
-0+if ( idx > (PAGE_SIZE /sizeof (*msr)) )
... >= here.
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3119
Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +6
-0+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
[email protected]
https://lists.xen.org/xen-devel
Quoted 11 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 13:15, <[email protected]> wrote:
Sample error looks like:
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)
(XEN) ************* VMCS Area **************Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>with
Quoted 11 lines
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3109
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmx.c +3
-1@@ -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.
Quoted 2 lines
(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)
Quoted 3 lines
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3111
Quoted 2 lines
xen/arch/x86/hvm/vmx/vmx.c +1
-0+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.
Quoted 4 lines
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3113
Quoted 2 lines
xen/arch/x86/hvm/vmx/vmx.c +1
-0+if ( idx > (PAGE_SIZE /sizeof (*msr)) )... >= here.
Quoted 8 lines
xen/arch/x86/hvm/vmx/vmx.c static void vmx_failed_vmentry(unsigned int exit_reason, · line 3119
Quoted 6 lines
xen/arch/x86/hvm/vmx/vmx.c +6
-0+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
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 1/2 x86/vmx: Print the problematic MSR if a vmentry fails
In reply to Andrew CooperSample error looks like:
(XEN) Failed vm entry (exit reason 0x80000022) caused by MSR loading (entry 13).
(XEN) msr 0000068a, val 1fff800000102af0, (mbz 0)
(XEN) ************* VMCS Area **************
---
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
v2:
* const, %lu, remove some commas, boundary check
--- xen/arch/x86/hvm/vmx/vmx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/vmx/vmx.c +16 -1
@@ -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 ; +const struct vmx_msr_entry *msr; + +printk ("caused by MSR loading (entry %lu).\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 );
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v2 2/2 x86/vmx: Reduce the verbosity of the vmentry failure error reporting
Identify the affected vcpu at the start of the message. While tweaking this area, add extra newlines between cases.
---
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
v2:
* %lu
--- xen/arch/x86/hvm/vmx/vmx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
xen/arch/x86/hvm/vmx/vmx.c +8 -5
@@ -3096,19 +3096,20 @@ static void vmx_failed_vmentry(unsigned int exit_reason,unsigned long exit_qualification;struct vcpu *curr = current; -printk ("Failed vm entry (exit reason %#x) " , exit_reason); +printk ("%pv vmentry failure (reason %#x): " , curr, exit_reason);__vmread (EXIT_QUALIFICATION , &exit_qualification);switch ( failed_vmentry_reason ) {case EXIT_REASON_INVALID_GUEST_STATE : -printk ("caused by invalid guest state (%ld).\n" , exit_qualification); +printk ("Invalid guest state (%lu)\n" , exit_qualification);break ; +case EXIT_REASON_MSR_LOADING : {unsigned long idx = exit_qualification -1 ;const struct vmx_msr_entry *msr; -printk ("caused by MSR loading (entry %lu).\n" , idx); +printk ("MSR loading (entry %lu)\n" , idx);if ( idx >= (PAGE_SIZE /sizeof (*msr)) )printk (" Entry out of range\n" );
@@ -3121,13 +3122,15 @@ static void vmx_failed_vmentry(unsigned int exit_reason, }break ; } +case EXIT_REASON_MCE_DURING_VMENTRY : -printk ("caused by machine check.\n" ); +printk ("MCE\n" );HVMTRACE_0D (MCE );/* Already handled. */ break ; +default : -printk ("reason not known yet!" ); +printk ("Unknown\n" );break ; }
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v2 2/2] x86/vmx: Reduce the verbosity of the vmentry failure error reporting
Quoted 12 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Thursday, October 13, 2016 9:46 PMIdentify the affected vcpu at the start of the message. While tweaking this area, add extra newlines between cases.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Jan Beulich <[email protected]>---
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 15:46, <[email protected]> wrote:
Sample error looks like:
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)
A _really_ minor remark: This is no longer in line with what gets actually logged.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 15:46, <[email protected]> wrote:
Sample error looks like:
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)A _really_ minor remark: This is no longer in line with what gets actually logged.
Oops yes. Fixed locally.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Tian, Kevin
Acked-byQuoted 7 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Friday, October 14, 2016 5:29 PMQuoted 3 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 15:46, <[email protected]> wrote:
Sample error looks like:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)A _really_ minor remark: This is no longer in line with what gets actually logged.
Oops yes. Fixed locally.
~Andrew
Sorry overlooked this patch. If still required,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines · Kevin
Quoted 9 lines
From: Andrew Cooper [mailto:[email protected]]
Sent: Friday, October 14, 2016 5:29 PMQuoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 13.10.16 at 15:46, <[email protected]> wrote:
Sample error looks like:
(XEN) Failed vm entry (exit reason
0x80000022) caused by MSR loading (entry 13).
(XEN) msr0000068a, val1fff800000102af0, (mbz 0)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
A _really_ minor remark: This is no longer in line with what gets actually logged.
Oops yes. Fixed locally.
~Andrew
Sorry overlooked this patch. If still required,
Acked-by Kevin Tian <[email protected]>
Thanks. (I was about to get around to pinging you)
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel