diff options
-rw-r--r-- | tools/xentrace/formats | 3 | ||||
-rw-r--r-- | xen/arch/x86/hvm/svm/svm.c | 25 | ||||
-rw-r--r-- | xen/include/public/trace.h | 1 |
3 files changed, 19 insertions, 10 deletions
diff --git a/tools/xentrace/formats b/tools/xentrace/formats index 7d5cdff938..04e54d5eb0 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -38,6 +38,9 @@ 0x00081001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMENTRY 0x00081002 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMEXIT [ exitcode = 0x%(1)08x, rIP = 0x%(2)08x ] 0x00081102 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMEXIT [ exitcode = 0x%(1)08x, rIP = 0x%(3)08x%(2)08x ] +0x00081401 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) nVMENTRY +0x00081402 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) nVMEXIT [ exitcode = 0x%(1)08x, rIP = 0x%(2)08x ] +0x00081502 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) nVMEXIT [ exitcode = 0x%(1)08x, rIP = 0x%(3)08x%(2)08x ] 0x00082001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) PF_XEN [ errorcode = 0x%(2)02x, virt = 0x%(1)08x ] 0x00082101 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) PF_XEN [ errorcode = 0x%(3)02x, virt = 0x%(2)08x%(1)08x ] 0x00082002 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) PF_INJECT [ errorcode = 0x%(1)02x, virt = 0x%(2)08x ] diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 462ca88ab4..981e5c3217 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1668,6 +1668,17 @@ asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs) exit_reason = vmcb->exitcode; + if ( hvm_long_mode_enabled(v) ) + HVMTRACE_ND(VMEXIT64, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, + 1/*cycles*/, 3, exit_reason, + (uint32_t)regs->eip, (uint32_t)((uint64_t)regs->eip >> 32), + 0, 0, 0); + else + HVMTRACE_ND(VMEXIT, vcpu_guestmode ? TRC_HVM_NESTEDFLAG : 0, + 1/*cycles*/, 2, exit_reason, + (uint32_t)regs->eip, + 0, 0, 0, 0); + if ( vcpu_guestmode ) { enum nestedhvm_vmexits nsret; struct nestedvcpu *nv = &vcpu_nestedhvm(v); @@ -1728,15 +1739,6 @@ asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs) } } - if ( hvm_long_mode_enabled(v) ) - HVMTRACE_ND(VMEXIT64, 0, 1/*cycles*/, 3, exit_reason, - (uint32_t)regs->eip, (uint32_t)((uint64_t)regs->eip >> 32), - 0, 0, 0); - else - HVMTRACE_ND(VMEXIT, 0, 1/*cycles*/, 2, exit_reason, - (uint32_t)regs->eip, - 0, 0, 0, 0); - if ( unlikely(exit_reason == VMEXIT_INVALID) ) { svm_vmcb_dump(__func__, vmcb); @@ -2014,7 +2016,10 @@ asmlinkage void svm_vmexit_handler(struct cpu_user_regs *regs) asmlinkage void svm_trace_vmentry(void) { - HVMTRACE_ND(VMENTRY, 0, 1/*cycles*/, 0, 0, 0, 0, 0, 0, 0); + struct vcpu *curr = current; + HVMTRACE_ND(VMENTRY, + nestedhvm_vcpu_in_guestmode(curr) ? TRC_HVM_NESTEDFLAG : 0, + 1/*cycles*/, 0, 0, 0, 0, 0, 0, 0); } /* diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index eab988fb60..9c321e79aa 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -123,6 +123,7 @@ #define TRC_SHADOW_RESYNC_ONLY (TRC_SHADOW + 15) /* trace events per subclass */ +#define TRC_HVM_NESTEDFLAG (0x400) #define TRC_HVM_VMENTRY (TRC_HVM_ENTRYEXIT + 0x01) #define TRC_HVM_VMEXIT (TRC_HVM_ENTRYEXIT + 0x02) #define TRC_HVM_VMEXIT64 (TRC_HVM_ENTRYEXIT + TRC_64_FLAG + 0x02) |