ia64/xen-unstable

changeset 16499:e10eacec8b91

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 <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Nov 28 22:36:33 2007 +0000 (2007-11-28)
parents 0b9048f7f257
children 3057f813da14
files xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/include/asm-x86/hvm/vmx/vmcs.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmcs.c	Wed Nov 28 22:09:19 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmcs.c	Wed Nov 28 22:36:33 2007 +0000
     1.3 @@ -819,10 +819,16 @@ static unsigned long vmr(unsigned long f
     1.4      return rc ? 0 : val;
     1.5  }
     1.6  
     1.7 -void vmcs_dump_vcpu(void)
     1.8 +void vmcs_dump_vcpu(struct vcpu *v)
     1.9  {
    1.10 +    struct cpu_user_regs *regs = &v->arch.guest_context.user_regs;
    1.11      unsigned long long x;
    1.12  
    1.13 +    if ( v == current )
    1.14 +        regs = guest_cpu_user_regs();
    1.15 +
    1.16 +    vmx_vmcs_enter(v);
    1.17 +
    1.18      printk("*** Guest State ***\n");
    1.19      printk("CR0: actual=0x%016llx, shadow=0x%016llx, gh_mask=%016llx\n",
    1.20             (unsigned long long)vmr(GUEST_CR0),
    1.21 @@ -841,11 +847,14 @@ void vmcs_dump_vcpu(void)
    1.22      printk("     target2=%016llx, target3=%016llx\n",
    1.23             (unsigned long long)vmr(CR3_TARGET_VALUE2),
    1.24             (unsigned long long)vmr(CR3_TARGET_VALUE3));
    1.25 -    printk("RSP = 0x%016llx  RIP = 0x%016llx\n", 
    1.26 +    printk("RSP = 0x%016llx (0x%016llx)  RIP = 0x%016llx (0x%016llx)\n", 
    1.27             (unsigned long long)vmr(GUEST_RSP),
    1.28 -           (unsigned long long)vmr(GUEST_RIP));
    1.29 -    printk("RFLAGS=0x%016llx  DR7 = 0x%016llx\n", 
    1.30 +           (unsigned long long)regs->esp,
    1.31 +           (unsigned long long)vmr(GUEST_RIP),
    1.32 +           (unsigned long long)regs->eip);
    1.33 +    printk("RFLAGS=0x%016llx (0x%016llx)  DR7 = 0x%016llx\n", 
    1.34             (unsigned long long)vmr(GUEST_RFLAGS),
    1.35 +           (unsigned long long)regs->eflags,
    1.36             (unsigned long long)vmr(GUEST_DR7));
    1.37      printk("Sysenter RSP=%016llx CS:RIP=%04x:%016llx\n",
    1.38             (unsigned long long)vmr(GUEST_SYSENTER_ESP),
    1.39 @@ -926,6 +935,8 @@ void vmcs_dump_vcpu(void)
    1.40             (uint32_t)vmr(IDT_VECTORING_ERROR_CODE));
    1.41      printk("TPR Threshold = 0x%02x\n",
    1.42             (uint32_t)vmr(TPR_THRESHOLD));
    1.43 +
    1.44 +    vmx_vmcs_exit(v);
    1.45  }
    1.46  
    1.47  static void vmcs_dump(unsigned char ch)
    1.48 @@ -945,9 +956,7 @@ static void vmcs_dump(unsigned char ch)
    1.49          for_each_vcpu ( d, v )
    1.50          {
    1.51              printk("\tVCPU %d\n", v->vcpu_id);
    1.52 -            vmx_vmcs_enter(v);
    1.53 -            vmcs_dump_vcpu();
    1.54 -            vmx_vmcs_exit(v);
    1.55 +            vmcs_dump_vcpu(v);
    1.56          }
    1.57      }
    1.58  
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 28 22:09:19 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 28 22:36:33 2007 +0000
     2.3 @@ -2722,6 +2722,7 @@ static void vmx_failed_vmentry(unsigned 
     2.4  {
     2.5      unsigned int failed_vmentry_reason = (uint16_t)exit_reason;
     2.6      unsigned long exit_qualification = __vmread(EXIT_QUALIFICATION);
     2.7 +    struct vcpu *curr = current;
     2.8  
     2.9      printk("Failed vm entry (exit reason 0x%x) ", exit_reason);
    2.10      switch ( failed_vmentry_reason )
    2.11 @@ -2734,7 +2735,7 @@ static void vmx_failed_vmentry(unsigned 
    2.12          break;
    2.13      case EXIT_REASON_MACHINE_CHECK:
    2.14          printk("caused by machine check.\n");
    2.15 -        HVMTRACE_0D(MCE, current);
    2.16 +        HVMTRACE_0D(MCE, curr);
    2.17          do_machine_check(regs);
    2.18          break;
    2.19      default:
    2.20 @@ -2743,10 +2744,10 @@ static void vmx_failed_vmentry(unsigned 
    2.21      }
    2.22  
    2.23      printk("************* VMCS Area **************\n");
    2.24 -    vmcs_dump_vcpu();
    2.25 +    vmcs_dump_vcpu(curr);
    2.26      printk("**************************************\n");
    2.27  
    2.28 -    domain_crash(current->domain);
    2.29 +    domain_crash(curr->domain);
    2.30  }
    2.31  
    2.32  asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
     3.1 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h	Wed Nov 28 22:09:19 2007 +0000
     3.2 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h	Wed Nov 28 22:36:33 2007 +0000
     3.3 @@ -28,7 +28,7 @@
     3.4  #endif
     3.5  
     3.6  extern void start_vmx(void);
     3.7 -extern void vmcs_dump_vcpu(void);
     3.8 +extern void vmcs_dump_vcpu(struct vcpu *v);
     3.9  extern void setup_vmcs_dump(void);
    3.10  extern int  vmx_cpu_up(void);
    3.11  extern void vmx_cpu_down(void);