KVM: trace kvm_ple_window grow/shrink
authorRadim Krčmář <rkrcmar@redhat.com>
Thu, 21 Aug 2014 16:08:09 +0000 (18:08 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 21 Aug 2014 16:45:23 +0000 (18:45 +0200)
Tracepoint for dynamic PLE window, fired on every potential change.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/trace.h
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c

index e850a7d332be32a0f8c736bc0dced26b213b4b2d..1742dfbd26b30f6f3fb5ad0c7c77f4cb220d7c63 100644 (file)
@@ -848,6 +848,36 @@ TRACE_EVENT(kvm_track_tsc,
                  __print_symbolic(__entry->host_clock, host_clocks))
 );
 
+TRACE_EVENT(kvm_ple_window,
+       TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old),
+       TP_ARGS(grow, vcpu_id, new, old),
+
+       TP_STRUCT__entry(
+               __field(                bool,      grow         )
+               __field(        unsigned int,   vcpu_id         )
+               __field(                 int,       new         )
+               __field(                 int,       old         )
+       ),
+
+       TP_fast_assign(
+               __entry->grow           = grow;
+               __entry->vcpu_id        = vcpu_id;
+               __entry->new            = new;
+               __entry->old            = old;
+       ),
+
+       TP_printk("vcpu %u: ple_window %d (%s %d)",
+                 __entry->vcpu_id,
+                 __entry->new,
+                 __entry->grow ? "grow" : "shrink",
+                 __entry->old)
+);
+
+#define trace_kvm_ple_window_grow(vcpu_id, new, old) \
+       trace_kvm_ple_window(true, vcpu_id, new, old)
+#define trace_kvm_ple_window_shrink(vcpu_id, new, old) \
+       trace_kvm_ple_window(false, vcpu_id, new, old)
+
 #endif /* CONFIG_X86_64 */
 
 #endif /* _TRACE_KVM_H */
index baeac7f580a73c3a5032d8c54209390dae4b7d08..661abc2f7049b136c85d023202a80542e566c258 100644 (file)
@@ -5738,6 +5738,8 @@ static void grow_ple_window(struct kvm_vcpu *vcpu)
 
        if (vmx->ple_window != old)
                vmx->ple_window_dirty = true;
+
+       trace_kvm_ple_window_grow(vcpu->vcpu_id, vmx->ple_window, old);
 }
 
 static void shrink_ple_window(struct kvm_vcpu *vcpu)
@@ -5750,6 +5752,8 @@ static void shrink_ple_window(struct kvm_vcpu *vcpu)
 
        if (vmx->ple_window != old)
                vmx->ple_window_dirty = true;
+
+       trace_kvm_ple_window_shrink(vcpu->vcpu_id, vmx->ple_window, old);
 }
 
 /*
index 575d3fc67e7e692c2ff85153f096aa8f5f16986e..c10408ef9ab1e3dda92f8b1ae008cea24c32d317 100644 (file)
@@ -7673,3 +7673,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts);
 EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_write_tsc_offset);
+EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_ple_window);