aditya shevalkar
2006-Nov-27 05:43 UTC
[Xen-devel] Information required on TRACE_VMEXIT working.
Hi all, Can anybody explain the process of TRACE_VMEXIT ? I am trying to understand its use in xen3.0.3\xen\arch\x86\hvm\vmx\vmx.c file in the vmx_vmexit_handler function. Also explain the meaning of its arguments and from where does it fetches the values for different arguments. Some code snippets from above file are given below: TRACE_VMEXIT(0,exit_reason); switch ( exit_reason ) { case EXIT_REASON_EXCEPTION_NMI: vector &= INTR_INFO_VECTOR_MASK; TRACE_VMEXIT(1,vector); __vmread(EXIT_QUALIFICATION, &va); __vmread(VM_EXIT_INTR_ERROR_CODE, ®s->error_code); TRACE_VMEXIT(3, regs->error_code); TRACE_VMEXIT(4, va); Also trying to understand the following expression in the same file: #define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=value With Regards, Aditya Shevalkar. __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Li, Xin B
2006-Nov-27 06:08 UTC
RE: [Xen-devel] Information required on TRACE_VMEXIT working.
>I am trying to understand its use in >xen3.0.3\xen\arch\x86\hvm\vmx\vmx.c >file in the vmx_vmexit_handler function. >Also explain the meaning of its arguments and from where does >it fetches >the values for different arguments. >Some code snippets from above file are given below: > > >TRACE_VMEXIT(0,exit_reason); >switch ( exit_reason ) >{ >case EXIT_REASON_EXCEPTION_NMI: > > > >vector &= INTR_INFO_VECTOR_MASK; >TRACE_VMEXIT(1,vector); > > >__vmread(EXIT_QUALIFICATION, &va); >__vmread(VM_EXIT_INTR_ERROR_CODE, ®s->error_code); >TRACE_VMEXIT(3, regs->error_code); >TRACE_VMEXIT(4, va); > >Also trying to understand the following expression in the same file: >#define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=value >It''s used to debug and do performance tunning. We defined 5 unsigned long integers in current physical processor data area to store the information of a VMExit, obviously for different types of VMExit, we need store different information, for example, for VMExits caused by IO instructions, we log: 1, exit reason, surely every VMExit has its own reason, 2, port number; 3, read or write; 4, TSC when the VMExit happen; 5, TSC when the VMEXit is done. And then these data are logged into XenTrace (xen/common/trace.c), and then we can use xentrace tools to get and translate these data, analyzing these data we can know VMExits distribution, and average cost of each type. Surely you can log data you need to meet your own requirements. -Xin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
George Dunlap
2006-Nov-27 14:38 UTC
Re: [Xen-devel] Information required on TRACE_VMEXIT working.
On 11/27/06, aditya shevalkar <aditya27783@yahoo.co.in> wrote:> Hi all, > > Can anybody explain the process of TRACE_VMEXIT ? > I am trying to understand its use in xen3.0.3\xen\arch\x86\hvm\vmx\vmx.c > file in the vmx_vmexit_handler function. > Also explain the meaning of its arguments and from where does it fetches > the values for different arguments. > Some code snippets from above file are given below: > > > TRACE_VMEXIT(0,exit_reason); > switch ( exit_reason ) > { > case EXIT_REASON_EXCEPTION_NMI: > > > > vector &= INTR_INFO_VECTOR_MASK; > TRACE_VMEXIT(1,vector); > > > __vmread(EXIT_QUALIFICATION, &va); > __vmread(VM_EXIT_INTR_ERROR_CODE, ®s->error_code); > TRACE_VMEXIT(3, regs->error_code); > TRACE_VMEXIT(4, va); > > Also trying to understand the following expression in the same file: > #define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=valueI think the missing piece of the puzzle are the following functions, also found in vmx.c: asmlinkage void vmx_trace_vmentry(void) { struct vcpu *v = current; TRACE_5D(TRC_VMX_VMENTRY + current->vcpu_id, v->arch.hvm_vcpu.hvm_trace_values[0], v->arch.hvm_vcpu.hvm_trace_values[1], v->arch.hvm_vcpu.hvm_trace_values[2], v->arch.hvm_vcpu.hvm_trace_values[3], v->arch.hvm_vcpu.hvm_trace_values[4]); TRACE_VMEXIT(0, 0); TRACE_VMEXIT(1, 0); TRACE_VMEXIT(2, 0); TRACE_VMEXIT(3, 0); TRACE_VMEXIT(4, 0); } asmlinkage void vmx_trace_vmexit (void) { TRACE_3D(TRC_VMX_VMEXIT + current->vcpu_id, 0, 0, 0); } When a VMEXIT happens, vmx_trace_vmexit() is called, and a trace record is generated. (This includes an RDTSC timetamp). Then, as the VMEXIT is handled, the various trace_values[] are filled in, depending upon what kind of vmexit it is. Then, just before the next> > > With Regards, > Aditya Shevalkar. > > > > __________________________________________________________ > Yahoo! India Answers: Share what you know. Learn something new > http://in.answers.yahoo.com/ > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
George Dunlap
2006-Nov-27 14:41 UTC
Re: [Xen-devel] Information required on TRACE_VMEXIT working.
> When a VMEXIT happens, vmx_trace_vmexit() is called, and a trace > record is generated. (This includes an RDTSC timetamp). Then, as the > VMEXIT is handled, the various trace_values[] are filled in, depending > upon what kind of vmexit it is. Then, just before the next[stupid mailer program...] VMENTER, another trace record is generated with the values in trace_values[]. This turns out to be a pretty powerful profiling and analysis tool; the two RDTSC values can be used to calculate how many cycles Xen spent in the hypervisor for any particular type of VMEXIT. The records are only generated if tracing is actually enabled, of course. See tools/xentrace and xen/public/trace.h for more information. -George _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel