Liu, Eric E wrote:
> >From d56731ffc6d5742a88a157dfe0e4344d35f7db58 Mon Sep 17 00:00:00 2001
> From: Feng(Eric) Liu <[EMAIL PROTECTED]>
> 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
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to