]> git.karo-electronics.de Git - linux-beck.git/commitdiff
KVM: Move kvm_exit tracepoint rip reading inside tracepoint
authorAvi Kivity <avi@redhat.com>
Thu, 11 Mar 2010 08:50:44 +0000 (10:50 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 17 May 2010 09:15:25 +0000 (12:15 +0300)
Reading rip is expensive on vmx, so move it inside the tracepoint so we only
incur the cost if tracing is enabled.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/trace.h
arch/x86/kvm/vmx.c

index 490bec199887964c9f8c9037d2d22a4b345cdfd8..abbc3f9d03b24fdd1435059b1e133646e87bc1fd 100644 (file)
@@ -2686,7 +2686,7 @@ static int handle_exit(struct kvm_vcpu *vcpu)
        struct kvm_run *kvm_run = vcpu->run;
        u32 exit_code = svm->vmcb->control.exit_code;
 
-       trace_kvm_exit(exit_code, svm->vmcb->save.rip);
+       trace_kvm_exit(exit_code, vcpu);
 
        if (unlikely(svm->nested.exit_required)) {
                nested_svm_vmexit(svm);
index b75efef79e56e187f0ca3aa0f43dd22aea9a85c3..d10b359a21f3743403dee4f520307b09959786c6 100644 (file)
@@ -182,8 +182,8 @@ TRACE_EVENT(kvm_apic,
  * Tracepoint for kvm guest exit:
  */
 TRACE_EVENT(kvm_exit,
-       TP_PROTO(unsigned int exit_reason, unsigned long guest_rip),
-       TP_ARGS(exit_reason, guest_rip),
+       TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu),
+       TP_ARGS(exit_reason, vcpu),
 
        TP_STRUCT__entry(
                __field(        unsigned int,   exit_reason     )
@@ -192,7 +192,7 @@ TRACE_EVENT(kvm_exit,
 
        TP_fast_assign(
                __entry->exit_reason    = exit_reason;
-               __entry->guest_rip      = guest_rip;
+               __entry->guest_rip      = kvm_rip_read(vcpu);
        ),
 
        TP_printk("reason %s rip 0x%lx",
index 8e2a24693be9d474724e8b1a4c633a55b60628f4..3dbfc20824b72a9c37e8eee900c217588f6ef234 100644 (file)
@@ -3612,7 +3612,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
        u32 exit_reason = vmx->exit_reason;
        u32 vectoring_info = vmx->idt_vectoring_info;
 
-       trace_kvm_exit(exit_reason, kvm_rip_read(vcpu));
+       trace_kvm_exit(exit_reason, vcpu);
 
        /* If guest state is invalid, start emulating */
        if (vmx->emulation_required && emulate_invalid_guest_state)