[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.5 v7 6/7] Add xentrace to vmware_port
Also added missing TRAP_DEBUG & VLAPIC. Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> --- v7: Dropped some of the new traces. Added HVMTRACE_ND7. v6: Dropped the attempt to use svm_nextrip_insn_length via __get_instruction_length (added in v2). Just always look at upto 15 bytes on AMD. v5: exitinfo1 is used twice. Fixed. tools/xentrace/formats | 5 +++++ xen/arch/x86/hvm/vmware/vmport.c | 22 ++++++++++++++++++++++ xen/include/asm-x86/hvm/trace.h | 22 ++++++++++++++++++++++ xen/include/public/trace.h | 3 +++ 4 files changed, 52 insertions(+) diff --git a/tools/xentrace/formats b/tools/xentrace/formats index da658bf..2c86fe9 100644 --- a/tools/xentrace/formats +++ b/tools/xentrace/formats @@ -79,6 +79,11 @@ 0x00082020 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) INTR_WINDOW [ value = 0x%(1)08x ] 0x00082021 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) NPF [ gpa = 0x%(2)08x%(1)08x mfn = 0x%(4)08x%(3)08x qual = 0x%(5)04x p2mt = 0x%(6)04x ] 0x00082023 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) TRAP [ vector = 0x%(1)02x ] +0x00082024 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) TRAP_DEBUG [ exit_qualification = 0x%(1)08x ] +0x00082025 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VLAPIC +0x00082026 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMPORT_HANDLED [ cmd = %(1)d eax = 0x%(2)08x ebx = 0x%(3)08x ecx = 0x%(4)08x edx = 0x%(5)08x esi = 0x%(6)08x edi = 0x%(7)08x ] +0x00082027 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMPORT_UNHANDLED [ bytes << 8 | dir = 0x%(1)03x cmd = 0x%(2)x cmd = %(2)d ebx = 0x%(3)08x ecx = 0x%(4)08x edx = 0x%(5)08x esi = 0x%(6)08x edi = 0x%(7)08x ] +0x00082028 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) VMPORT_DECODE [ dir = %(1)d bytes = %(2)d ] 0x0010f001 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) page_grant_map [ domid = %(1)d ] 0x0010f002 CPU%(cpu)d %(tsc)d (+%(reltsc)8d) page_grant_unmap [ domid = %(1)d ] diff --git a/xen/arch/x86/hvm/vmware/vmport.c b/xen/arch/x86/hvm/vmware/vmport.c index e73a5e6..2c9452f 100644 --- a/xen/arch/x86/hvm/vmware/vmport.c +++ b/xen/arch/x86/hvm/vmware/vmport.c @@ -18,6 +18,7 @@ #include <asm/hvm/hvm.h> #include <asm/hvm/support.h> #include <asm/hvm/vmport.h> +#include <asm/hvm/trace.h> #include "backdoor_def.h" @@ -67,6 +68,7 @@ int vmport_ioport(int dir, uint32_t port, uint32_t bytes, uint32_t *val) struct vcpu *curr = current; struct domain *d = curr->domain; struct segment_register sreg; + int handled = 1; switch ( cmd ) { @@ -151,8 +153,16 @@ int vmport_ioport(int dir, uint32_t port, uint32_t bytes, uint32_t *val) break; default: regs->rax = (uint32_t)~0ul; + handled = 0; + HVMTRACE_ND7(VMPORT_UNHANDLED, 0, 0/*cycles*/, 7, + (bytes << 8) | dir, cmd, regs->rbx, + regs->rcx, regs->rdx, regs->rsi, regs->rdi); break; } + if ( handled ) + HVMTRACE_ND7(VMPORT_HANDLED, 0, 0/*cycles*/, 7, + cmd, regs->rax, regs->rbx, regs->rcx, + regs->rdx, regs->rsi, regs->rdi); if ( dir == IOREQ_READ ) { switch ( bytes ) @@ -246,13 +256,25 @@ int vmport_gp_check(struct cpu_user_regs *regs, struct vcpu *v, byte_cnt = 4; } if ( bytes[i] == 0xed ) /* in (%dx),%eax or in (%dx),%ax */ + { + HVMTRACE_2D(VMPORT_DECODE, IOREQ_READ, byte_cnt); return vmport_ioport(IOREQ_READ, BDOOR_PORT, byte_cnt, &val); + } else if ( bytes[i] == 0xec ) /* in (%dx),%al */ + { + HVMTRACE_2D(VMPORT_DECODE, IOREQ_READ, 1); return vmport_ioport(IOREQ_READ, BDOOR_PORT, 1, &val); + } else if ( bytes[i] == 0xef ) /* out %eax,(%dx) or out %ax,(%dx) */ + { + HVMTRACE_2D(VMPORT_DECODE, IOREQ_WRITE, byte_cnt); return vmport_ioport(IOREQ_WRITE, BDOOR_PORT, byte_cnt, &val); + } else if ( bytes[i] == 0xee ) /* out %al,(%dx) */ + { + HVMTRACE_2D(VMPORT_DECODE, IOREQ_WRITE, 1); return vmport_ioport(IOREQ_WRITE, BDOOR_PORT, 1, &val); + } else { *inst_len = 0; /* This is unknown. */ diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/asm-x86/hvm/trace.h index de802a6..bb25a95 100644 --- a/xen/include/asm-x86/hvm/trace.h +++ b/xen/include/asm-x86/hvm/trace.h @@ -54,6 +54,9 @@ #define DO_TRC_HVM_TRAP DEFAULT_HVM_MISC #define DO_TRC_HVM_TRAP_DEBUG DEFAULT_HVM_MISC #define DO_TRC_HVM_VLAPIC DEFAULT_HVM_MISC +#define DO_TRC_HVM_VMPORT_HANDLED DEFAULT_HVM_IO +#define DO_TRC_HVM_VMPORT_UNHANDLED DEFAULT_HVM_IO +#define DO_TRC_HVM_VMPORT_DECODE DEFAULT_HVM_IO #define TRC_PAR_LONG(par) ((par)&0xFFFFFFFF),((par)>>32) @@ -83,6 +86,25 @@ } \ } while(0) +#define HVMTRACE_ND7(evt, modifier, cycles, count, d1, d2, d3, d4, d5, d6, d7) \ + do { \ + if ( unlikely(tb_init_done) && DO_TRC_HVM_ ## evt ) \ + { \ + struct { \ + u32 d[7]; \ + } _d; \ + _d.d[0]=(d1); \ + _d.d[1]=(d2); \ + _d.d[2]=(d3); \ + _d.d[3]=(d4); \ + _d.d[4]=(d5); \ + _d.d[5]=(d6); \ + _d.d[6]=(d7); \ + __trace_var(TRC_HVM_ ## evt | (modifier), cycles, \ + sizeof(*_d.d) * count, &_d); \ + } \ + } while(0) + #define HVMTRACE_6D(evt, d1, d2, d3, d4, d5, d6) \ HVMTRACE_ND(evt, 0, 0, 6, d1, d2, d3, d4, d5, d6) #define HVMTRACE_5D(evt, d1, d2, d3, d4, d5) \ diff --git a/xen/include/public/trace.h b/xen/include/public/trace.h index 5211ae7..a4d51ec 100644 --- a/xen/include/public/trace.h +++ b/xen/include/public/trace.h @@ -227,6 +227,9 @@ #define TRC_HVM_TRAP (TRC_HVM_HANDLER + 0x23) #define TRC_HVM_TRAP_DEBUG (TRC_HVM_HANDLER + 0x24) #define TRC_HVM_VLAPIC (TRC_HVM_HANDLER + 0x25) +#define TRC_HVM_VMPORT_HANDLED (TRC_HVM_HANDLER + 0x26) +#define TRC_HVM_VMPORT_UNHANDLED (TRC_HVM_HANDLER + 0x27) +#define TRC_HVM_VMPORT_DECODE (TRC_HVM_HANDLER + 0x28) #define TRC_HVM_IOPORT_WRITE (TRC_HVM_HANDLER + 0x216) #define TRC_HVM_IOMEM_WRITE (TRC_HVM_HANDLER + 0x217) -- 1.8.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |