[xen-unstable] vmx: Better tracing in vmcs_dump_vcpu() -- grab RIP/RSP/RFLAGS from

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen-unstable] vmx: Better tracing in vmcs_dump_vcpu() -- grab RIP/RSP/RFLAGS from

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# Date 1196289393 0
# Node ID e10eacec8b919b4fea0d16b6dadb61bde1e9734a
# Parent  0b9048f7f257c95e7df9b84ffda2f9ec1dd83185
vmx: Better tracing in vmcs_dump_vcpu() -- grab RIP/RSP/RFLAGS from
cpu_user_regs structure as well as VMCS.
Signed-off-by: Keir Fraser <[hidden email]>
---
 xen/arch/x86/hvm/vmx/vmcs.c        |   25 +++++++++++++++++--------
 xen/arch/x86/hvm/vmx/vmx.c         |    7 ++++---
 xen/include/asm-x86/hvm/vmx/vmcs.h |    2 +-
 3 files changed, 22 insertions(+), 12 deletions(-)

diff -r 0b9048f7f257 -r e10eacec8b91 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Wed Nov 28 22:09:19 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Wed Nov 28 22:36:33 2007 +0000
@@ -819,9 +819,15 @@ static unsigned long vmr(unsigned long f
     return rc ? 0 : val;
 }
 
-void vmcs_dump_vcpu(void)
-{
+void vmcs_dump_vcpu(struct vcpu *v)
+{
+    struct cpu_user_regs *regs = &v->arch.guest_context.user_regs;
     unsigned long long x;
+
+    if ( v == current )
+        regs = guest_cpu_user_regs();
+
+    vmx_vmcs_enter(v);
 
     printk("*** Guest State ***\n");
     printk("CR0: actual=0x%016llx, shadow=0x%016llx, gh_mask=%016llx\n",
@@ -841,11 +847,14 @@ void vmcs_dump_vcpu(void)
     printk("     target2=%016llx, target3=%016llx\n",
            (unsigned long long)vmr(CR3_TARGET_VALUE2),
            (unsigned long long)vmr(CR3_TARGET_VALUE3));
-    printk("RSP = 0x%016llx  RIP = 0x%016llx\n",
+    printk("RSP = 0x%016llx (0x%016llx)  RIP = 0x%016llx (0x%016llx)\n",
            (unsigned long long)vmr(GUEST_RSP),
-           (unsigned long long)vmr(GUEST_RIP));
-    printk("RFLAGS=0x%016llx  DR7 = 0x%016llx\n",
+           (unsigned long long)regs->esp,
+           (unsigned long long)vmr(GUEST_RIP),
+           (unsigned long long)regs->eip);
+    printk("RFLAGS=0x%016llx (0x%016llx)  DR7 = 0x%016llx\n",
            (unsigned long long)vmr(GUEST_RFLAGS),
+           (unsigned long long)regs->eflags,
            (unsigned long long)vmr(GUEST_DR7));
     printk("Sysenter RSP=%016llx CS:RIP=%04x:%016llx\n",
            (unsigned long long)vmr(GUEST_SYSENTER_ESP),
@@ -926,6 +935,8 @@ void vmcs_dump_vcpu(void)
            (uint32_t)vmr(IDT_VECTORING_ERROR_CODE));
     printk("TPR Threshold = 0x%02x\n",
            (uint32_t)vmr(TPR_THRESHOLD));
+
+    vmx_vmcs_exit(v);
 }
 
 static void vmcs_dump(unsigned char ch)
@@ -945,9 +956,7 @@ static void vmcs_dump(unsigned char ch)
         for_each_vcpu ( d, v )
         {
             printk("\tVCPU %d\n", v->vcpu_id);
-            vmx_vmcs_enter(v);
-            vmcs_dump_vcpu();
-            vmx_vmcs_exit(v);
+            vmcs_dump_vcpu(v);
         }
     }
 
diff -r 0b9048f7f257 -r e10eacec8b91 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Wed Nov 28 22:09:19 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Nov 28 22:36:33 2007 +0000
@@ -2722,6 +2722,7 @@ static void vmx_failed_vmentry(unsigned
 {
     unsigned int failed_vmentry_reason = (uint16_t)exit_reason;
     unsigned long exit_qualification = __vmread(EXIT_QUALIFICATION);
+    struct vcpu *curr = current;
 
     printk("Failed vm entry (exit reason 0x%x) ", exit_reason);
     switch ( failed_vmentry_reason )
@@ -2734,7 +2735,7 @@ static void vmx_failed_vmentry(unsigned
         break;
     case EXIT_REASON_MACHINE_CHECK:
         printk("caused by machine check.\n");
-        HVMTRACE_0D(MCE, current);
+        HVMTRACE_0D(MCE, curr);
         do_machine_check(regs);
         break;
     default:
@@ -2743,10 +2744,10 @@ static void vmx_failed_vmentry(unsigned
     }
 
     printk("************* VMCS Area **************\n");
-    vmcs_dump_vcpu();
+    vmcs_dump_vcpu(curr);
     printk("**************************************\n");
 
-    domain_crash(current->domain);
+    domain_crash(curr->domain);
 }
 
 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
diff -r 0b9048f7f257 -r e10eacec8b91 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Nov 28 22:09:19 2007 +0000
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Nov 28 22:36:33 2007 +0000
@@ -28,7 +28,7 @@
 #endif
 
 extern void start_vmx(void);
-extern void vmcs_dump_vcpu(void);
+extern void vmcs_dump_vcpu(struct vcpu *v);
 extern void setup_vmcs_dump(void);
 extern int  vmx_cpu_up(void);
 extern void vmx_cpu_down(void);

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog