All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: "Liu, Eric E" <eric.e.liu@intel.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: [PATCH RFC 1/5]Add some trace enties and define	interface for tracing
Date: Thu, 03 Apr 2008 13:50:55 +0300	[thread overview]
Message-ID: <47F4B68F.3040502@qumranet.com> (raw)
In-Reply-To: <9D7649D18729DE4BB2BD7B494F7FEDC2011846B0@pdsmsx415.ccr.corp.intel.com>

Liu, Eric E wrote:
> >From d56731ffc6d5742a88a157dfe0e4344d35f7db58 Mon Sep 17 00:00:00 2001
> From: Feng(Eric) Liu <eric.e.liu@intel.com>
> Date: Mon, 31 Mar 2008 10:08:55 -0400
> Subject: [PATCH] KVM: Add some trace entries in current code and define
> some interfaces for userspace app to contrl and use tracing data.
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 9951ec9..8f70405 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -1794,6 +1794,10 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu,
> int irq)
>  {
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  
> +	KVMTRACE_1D(INJ_VIRQ, vcpu,
> +		    (u32)(irq | INTR_TYPE_SOFT_INTR |
> INTR_INFO_VALID_MASK),
> +		    handler);
> +
>   

Why not just send irq as data?

>  	if (vcpu->arch.rmode.active) {
>  		vmx->rmode.irq.pending = true;
>  		vmx->rmode.irq.vector = irq;
> @@ -1944,6 +1948,7 @@ static int handle_exception(struct kvm_vcpu *vcpu,
> struct kvm_run *kvm_run)
>  		error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
>  	if (is_page_fault(intr_info)) {
>  		cr2 = vmcs_readl(EXIT_QUALIFICATION);
> +		KVMTRACE_2D(PAGE_FAULT, vcpu, error_code, (u32)cr2,
> handler);
>   

High order 32 bits of cr2 are lost.

>  		return kvm_mmu_page_fault(vcpu, cr2, error_code);
>  	}
>  
> @@ -1972,6 +1977,7 @@ static int handle_external_interrupt(struct
> kvm_vcpu *vcpu,
>  				     struct kvm_run *kvm_run)
>  {
>  	++vcpu->stat.irq_exits;
> +	KVMTRACE_1D(INTR, vcpu, vmcs_read32(VM_EXIT_INTR_INFO),
> handler);
>  	return 1;
>  }
>  
> @@ -2029,6 +2035,8 @@ static int handle_cr(struct kvm_vcpu *vcpu, struct
> kvm_run *kvm_run)
>  	reg = (exit_qualification >> 8) & 15;
>  	switch ((exit_qualification >> 4) & 3) {
>  	case 0: /* mov to cr */
> +		KVMTRACE_2D(CR_WRITE, vcpu, (u32)cr,
> (u32)vcpu->arch.regs[reg],
> +			    handler);
>   

High order bits are lost.

>  	if (vmx_set_msr(vcpu, ecx, data) != 0) {
>  		kvm_inject_gp(vcpu, 0);
>  		return 1;
> @@ -2181,6 +2201,9 @@ static int handle_interrupt_window(struct kvm_vcpu
> *vcpu,
>  	cpu_based_vm_exec_control =
> vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
>  	cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
>  	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
> cpu_based_vm_exec_control);
> +
> +	KVMTRACE_1D(PEND_INTR, vcpu, cpu_based_vm_exec_control,
> handler);
>   

Can record 0 unconditionally here, no?

> @@ -2271,6 +2296,9 @@ static int kvm_handle_exit(struct kvm_run
> *kvm_run, struct kvm_vcpu *vcpu)
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  	u32 vectoring_info = vmx->idt_vectoring_info;
>  
> +	KVMTRACE_2D(VMEXIT, vcpu, exit_reason,
> (u32)vmcs_readl(GUEST_RIP),
> +		    entryexit);
> +
>  	if (unlikely(vmx->fail)) {
>  		kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
>  		kvm_run->fail_entry.hardware_entry_failure_reason
> @@ -2351,7 +2379,7 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
>  				enable_irq_window(vcpu);
>  			return;
>  		}
> -
> +		KVMTRACE_1D(INJ_VIRQ, vcpu, idtv_info_field, handler);
>   

Probably need a different marker than INJ_VIRQ, as this is on exit, not 
entry.

>  	if (!count) {
>  		kvm_x86_ops->skip_emulated_instruction(vcpu);
>  		return 1;
> @@ -2428,6 +2445,7 @@ void kvm_arch_exit(void)
>  int kvm_emulate_halt(struct kvm_vcpu *vcpu)
>  {
>  	++vcpu->stat.halt_exits;
> +	KVMTRACE_0D(HLT, vcpu, handler);
>  	if (irqchip_in_kernel(vcpu->kvm)) {
>  		vcpu->arch.mp_state = VCPU_MP_STATE_HALTED;
>  		kvm_vcpu_block(vcpu);
>   

Would be nice to have an UNHLT to see how long sleeps are.  But this 
will probably be seen by the irq injection.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

  reply	other threads:[~2008-04-03 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-31  6:18 [PATCH RFC 1/5]Add some trace enties and define interface for tracing Liu, Eric E
2008-04-03 10:50 ` Avi Kivity [this message]
2008-04-08  3:34   ` Liu, Eric E
2008-04-08 21:53     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F4B68F.3040502@qumranet.com \
    --to=avi@qumranet.com \
    --cc=eric.e.liu@intel.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.