KVM: trace guest fpu loads and unloads
authorAvi Kivity <avi@redhat.com>
Thu, 21 Jan 2010 13:31:52 +0000 (15:31 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 1 Mar 2010 15:36:05 +0000 (12:36 -0300)
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/x86.c
include/trace/events/kvm.h

index 27af6e353b06101bf63f16c0bf3873a153ac0194..3b90298fb980aa4fcc8784490b059f6cfaceae94 100644 (file)
@@ -5292,6 +5292,7 @@ void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
        vcpu->guest_fpu_loaded = 1;
        kvm_fx_save(&vcpu->arch.host_fx_image);
        kvm_fx_restore(&vcpu->arch.guest_fx_image);
+       trace_kvm_fpu(1);
 }
 
 void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
@@ -5304,6 +5305,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
        kvm_fx_restore(&vcpu->arch.host_fx_image);
        ++vcpu->stat.fpu_reload;
        set_bit(KVM_REQ_DEACTIVATE_FPU, &vcpu->requests);
+       trace_kvm_fpu(0);
 }
 
 void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
index dbe1084552757da03d47a8ee64e98581974a14a3..8abdc1230143f887146224fa1c4f10fae7328bd8 100644 (file)
@@ -145,6 +145,25 @@ TRACE_EVENT(kvm_mmio,
                  __entry->len, __entry->gpa, __entry->val)
 );
 
+#define kvm_fpu_load_symbol    \
+       {0, "unload"},          \
+       {1, "load"}
+
+TRACE_EVENT(kvm_fpu,
+       TP_PROTO(int load),
+       TP_ARGS(load),
+
+       TP_STRUCT__entry(
+               __field(        u32,            load            )
+       ),
+
+       TP_fast_assign(
+               __entry->load           = load;
+       ),
+
+       TP_printk("%s", __print_symbolic(__entry->load, kvm_fpu_load_symbol))
+);
+
 #endif /* _TRACE_KVM_MAIN_H */
 
 /* This part must be outside protection */